本文整理了Java中org.apache.accumulo.server.security.handler.ZKAuthenticator.constructUser()
方法的一些代码示例,展示了ZKAuthenticator.constructUser()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKAuthenticator.constructUser()
方法的具体详情如下:
包路径:org.apache.accumulo.server.security.handler.ZKAuthenticator
类名称:ZKAuthenticator
方法名:constructUser
[英]Sets up the user in ZK for the provided user. No checking for existence is done here, it should be done before calling.
[中]在ZK中为提供的用户设置用户。这里没有检查是否存在,应该在打电话之前检查。
代码示例来源:origin: apache/accumulo
@Override
public void initializeSecurity(String principal, byte[] token) {
try {
// remove old settings from zookeeper first, if any
IZooReaderWriter zoo = context.getZooReaderWriter();
synchronized (zooCache) {
zooCache.clear();
if (zoo.exists(ZKUserPath)) {
zoo.recursiveDelete(ZKUserPath, NodeMissingPolicy.SKIP);
log.info("Removed {}/ from zookeeper", ZKUserPath);
}
// prep parent node of users with root username
zoo.putPersistentData(ZKUserPath, principal.getBytes(UTF_8), NodeExistsPolicy.FAIL);
constructUser(principal, ZKSecurityTool.createPass(token));
}
} catch (KeeperException | AccumuloException | InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/accumulo
@Override
public void createUser(String principal, AuthenticationToken token)
throws AccumuloSecurityException {
try {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
constructUser(principal, ZKSecurityTool.createPass(pt.getPassword()));
} catch (KeeperException e) {
if (e.code().equals(KeeperException.Code.NODEEXISTS))
throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_EXISTS, 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);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
@Override
public void initializeSecurity(TCredentials credentials, String principal, byte[] token) throws AccumuloSecurityException {
try {
// remove old settings from zookeeper first, if any
IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
synchronized (zooCache) {
zooCache.clear();
if (zoo.exists(ZKUserPath)) {
zoo.recursiveDelete(ZKUserPath, NodeMissingPolicy.SKIP);
log.info("Removed " + ZKUserPath + "/" + " from zookeeper");
}
// prep parent node of users with root username
zoo.putPersistentData(ZKUserPath, principal.getBytes(UTF_8), NodeExistsPolicy.FAIL);
constructUser(principal, ZKSecurityTool.createPass(token));
}
} catch (KeeperException e) {
log.error(e, e);
throw new RuntimeException(e);
} catch (InterruptedException e) {
log.error(e, e);
throw new RuntimeException(e);
} catch (AccumuloException e) {
log.error(e, e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public void initializeSecurity(TCredentials credentials, String principal, byte[] token)
throws AccumuloSecurityException {
try {
// remove old settings from zookeeper first, if any
IZooReaderWriter zoo = ZooReaderWriter.getInstance();
synchronized (zooCache) {
zooCache.clear();
if (zoo.exists(ZKUserPath)) {
zoo.recursiveDelete(ZKUserPath, NodeMissingPolicy.SKIP);
log.info("Removed " + ZKUserPath + "/" + " from zookeeper");
}
// prep parent node of users with root username
zoo.putPersistentData(ZKUserPath, principal.getBytes(UTF_8), NodeExistsPolicy.FAIL);
constructUser(principal, ZKSecurityTool.createPass(token));
}
} catch (KeeperException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
} catch (AccumuloException e) {
log.error("{}", e.getMessage(), e);
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public void createUser(String principal, AuthenticationToken token)
throws AccumuloSecurityException {
try {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
constructUser(principal, ZKSecurityTool.createPass(pt.getPassword()));
} catch (KeeperException e) {
if (e.code().equals(KeeperException.Code.NODEEXISTS))
throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_EXISTS, 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);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
/**
* Creates a user with no permissions whatsoever
*/
@Override
public void createUser(String principal, AuthenticationToken token) throws AccumuloSecurityException {
try {
if (!(token instanceof PasswordToken))
throw new AccumuloSecurityException(principal, SecurityErrorCode.INVALID_TOKEN);
PasswordToken pt = (PasswordToken) token;
constructUser(principal, ZKSecurityTool.createPass(pt.getPassword()));
} catch (KeeperException e) {
if (e.code().equals(KeeperException.Code.NODEEXISTS))
throw new AccumuloSecurityException(principal, SecurityErrorCode.USER_EXISTS, 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);
}
}
内容来源于网络,如有侵权,请联系作者删除!