本文整理了Java中org.apache.accumulo.server.security.handler.ZKAuthenticator.userExists()
方法的一些代码示例,展示了ZKAuthenticator.userExists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKAuthenticator.userExists()
方法的具体详情如下:
包路径:org.apache.accumulo.server.security.handler.ZKAuthenticator
类名称:ZKAuthenticator
方法名:userExists
[英]Checks if a user exists
[中]检查用户是否存在
代码示例来源:origin: apache/accumulo
@Override
public synchronized boolean userExists(String user) {
user = Base64.getEncoder().encodeToString(user.getBytes(UTF_8));
return zkAuthenticator.userExists(user);
}
代码示例来源:origin: apache/accumulo
@Override
public void changePassword(String principal, AuthenticationToken token)
throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
if (userExists(principal)) {
try {
synchronized (zooCache) {
zooCache.clear(ZKUserPath + "/" + principal);
context.getZooReaderWriter().putPrivatePersistentData(ZKUserPath + "/" + principal,
ZKSecurityTool.createPass(pt.getPassword()), NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
} catch (AccumuloException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(principal, SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
}
} else
// user doesn't exist
throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_DOESNT_EXIST);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public synchronized boolean userExists(String user) throws AccumuloSecurityException {
user = Base64.encodeBase64String(user.getBytes(UTF_8));
return zkAuthenticator.userExists(user);
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public void changePassword(String principal, AuthenticationToken token) throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
if (userExists(principal)) {
try {
synchronized (zooCache) {
zooCache.clear(ZKUserPath + "/" + principal);
ZooReaderWriter.getRetryingInstance().putPrivatePersistentData(ZKUserPath + "/" + principal, ZKSecurityTool.createPass(pt.getPassword()),
NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error(e, e);
throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error(e, e);
throw new RuntimeException(e);
} catch (AccumuloException e) {
log.error(e, e);
throw new AccumuloSecurityException(principal, SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
}
} else
throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_DOESNT_EXIST); // user doesn't exist
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public void changePassword(String principal, AuthenticationToken token)
throws AccumuloSecurityException {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
if (userExists(principal)) {
try {
synchronized (zooCache) {
zooCache.clear(ZKUserPath + "/" + principal);
ZooReaderWriter.getInstance().putPrivatePersistentData(ZKUserPath + "/" + principal,
ZKSecurityTool.createPass(pt.getPassword()), NodeExistsPolicy.OVERWRITE);
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(principal, SecurityErrorCode.CONNECTION_ERROR, e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
} catch (AccumuloException e) {
log.error("{}", e.getMessage(), e);
throw new AccumuloSecurityException(principal, SecurityErrorCode.DEFAULT_SECURITY_ERROR, e);
}
} else
// user doesn't exist
throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_DOESNT_EXIST);
}
内容来源于网络,如有侵权,请联系作者删除!