use of org.apache.accumulo.core.security.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testAllowedImpersonationFromSpecificHostNewConfig.
@Test
public void testAllowedImpersonationFromSpecificHostNewConfig() throws Exception {
final String proxyServer = "proxy", client = "client", host = "host.domain.com";
cc.set(Property.INSTANCE_RPC_SASL_ALLOWED_USER_IMPERSONATION, proxyServer + ":" + client);
cc.set(Property.INSTANCE_RPC_SASL_ALLOWED_HOST_IMPERSONATION, host);
proxy = new TCredentialsUpdatingInvocationHandler<>(new Object(), conf);
TCredentials tcreds = new TCredentials("client", KerberosToken.class.getName(), ByteBuffer.allocate(0), UUID.randomUUID().toString());
UGIAssumingProcessor.rpcPrincipal.set(proxyServer);
TServerUtils.clientAddress.set(host);
proxy.updateArgs(new Object[] { new Object(), tcreds });
}
use of org.apache.accumulo.core.security.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testAllowedAnyImpersonationForAnyUser.
@SuppressWarnings("deprecation")
@Test
public void testAllowedAnyImpersonationForAnyUser() throws Exception {
final String proxyServer = "proxy";
cc.set(Property.INSTANCE_RPC_SASL_PROXYUSERS.getKey() + proxyServer + ".users", "*");
cc.set(Property.INSTANCE_RPC_SASL_PROXYUSERS.getKey() + proxyServer + ".hosts", "*");
proxy = new TCredentialsUpdatingInvocationHandler<>(new Object(), conf);
TCredentials tcreds = new TCredentials("client", KerberosToken.class.getName(), ByteBuffer.allocate(0), UUID.randomUUID().toString());
UGIAssumingProcessor.rpcPrincipal.set(proxyServer);
proxy.updateArgs(new Object[] { new Object(), tcreds });
}
use of org.apache.accumulo.core.security.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testAllowedImpersonationForSpecificUsersNewConfig.
@Test
public void testAllowedImpersonationForSpecificUsersNewConfig() throws Exception {
final String proxyServer = "proxy";
cc.set(Property.INSTANCE_RPC_SASL_ALLOWED_USER_IMPERSONATION, proxyServer + ":client1,client2");
cc.set(Property.INSTANCE_RPC_SASL_ALLOWED_HOST_IMPERSONATION, "*");
proxy = new TCredentialsUpdatingInvocationHandler<>(new Object(), conf);
TCredentials tcreds = new TCredentials("client1", KerberosToken.class.getName(), ByteBuffer.allocate(0), UUID.randomUUID().toString());
UGIAssumingProcessor.rpcPrincipal.set(proxyServer);
proxy.updateArgs(new Object[] { new Object(), tcreds });
tcreds = new TCredentials("client2", KerberosToken.class.getName(), ByteBuffer.allocate(0), UUID.randomUUID().toString());
proxy.updateArgs(new Object[] { new Object(), tcreds });
}
use of org.apache.accumulo.core.security.thrift.TCredentials in project accumulo by apache.
the class ClientServiceHandler method changeLocalUserPassword.
@Override
public void changeLocalUserPassword(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
PasswordToken token = new PasswordToken(password);
Credentials toChange = new Credentials(principal, token);
security.changePassword(credentials, toChange);
}
use of org.apache.accumulo.core.security.thrift.TCredentials in project accumulo by apache.
the class ClientServiceHandler method createLocalUser.
@Override
public void createLocalUser(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
AuthenticationToken token;
if (null != context.getSaslParams()) {
try {
token = new KerberosToken();
} catch (IOException e) {
log.warn("Failed to create KerberosToken");
throw new ThriftSecurityException(e.getMessage(), SecurityErrorCode.DEFAULT_SECURITY_ERROR);
}
} else {
token = new PasswordToken(password);
}
Credentials newUser = new Credentials(principal, token);
security.createUser(credentials, newUser, new Authorizations());
}
Aggregations