mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-06-17 17:10:26 +08:00
add:根据name(传入String)获取Identity;设置默认Identity(不带密码的)
This commit is contained in:
@@ -98,6 +98,49 @@ public class KeyChain {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认的的网络身份,不带密码
|
||||
* @param identity 身份对象
|
||||
* @return boolean
|
||||
* @author zhengqi wu
|
||||
* @date 2021/6/12
|
||||
**/
|
||||
public void setDefaultIdentity(Identity identity) throws KeyChainException {
|
||||
boolean res = false;
|
||||
try {
|
||||
res = this.identityManager.setDefaultIdentity(identity, true); // 操作修改到数据库中
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new KeyChainException("Set Default Identity Failed! " + e.getMessage());
|
||||
}
|
||||
|
||||
if (!res)
|
||||
{
|
||||
throw new KeyChainException("Maybe the identity is null.");
|
||||
}
|
||||
this.currentIdentity = identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 以身份名称字符串名称获取身份对象,查询不到返回为空
|
||||
* @param identityName 身份名称字符串
|
||||
* @return Identity 身份对象
|
||||
* @author zhengqi wu
|
||||
* @date 2021/6/12
|
||||
**/
|
||||
public Identity getIdentityByName(String identityName) throws KeyChainException {
|
||||
Identity res = null;
|
||||
try {
|
||||
res = this.identityManager.getIdentityByName(identityName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new KeyChainException("Get" + identityName + " failed! " + e.getMessage());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为一个网络身份申请证书
|
||||
* @param identity
|
||||
|
||||
Reference in New Issue
Block a user