use of org.apache.accumulo.core.securityImpl.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testWrongTokenType.
@Test
public void testWrongTokenType() {
final String principal = "root";
TCredentials tcreds = new TCredentials(principal, PasswordToken.class.getName(), ByteBuffer.allocate(0), UUID.randomUUID().toString());
UGIAssumingProcessor.rpcPrincipal.set(principal);
assertThrows(ThriftSecurityException.class, () -> proxy.updateArgs(new Object[] { new Object(), tcreds }));
}
use of org.apache.accumulo.core.securityImpl.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testDisallowedImpersonationForMultipleUsers.
@Test
public void testDisallowedImpersonationForMultipleUsers() {
final String proxyServer = "proxy";
// let "otherproxy" impersonate, but not "proxy"
cc.set(Property.INSTANCE_RPC_SASL_ALLOWED_USER_IMPERSONATION, "otherproxy1:*;otherproxy2: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);
assertThrows(ThriftSecurityException.class, () -> proxy.updateArgs(new Object[] { new Object(), tcreds }));
}
use of org.apache.accumulo.core.securityImpl.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testMissingPrincipal.
@Test
public void testMissingPrincipal() {
final String principal = "root";
TCredentials tcreds = new TCredentials(principal, KerberosToken.CLASS_NAME, ByteBuffer.allocate(0), UUID.randomUUID().toString());
UGIAssumingProcessor.rpcPrincipal.set(null);
assertThrows(ThriftSecurityException.class, () -> proxy.updateArgs(new Object[] { new Object(), tcreds }));
}
use of org.apache.accumulo.core.securityImpl.thrift.TCredentials in project accumulo by apache.
the class TCredentialsUpdatingInvocationHandlerTest method testMismatchedPrincipal.
@Test
public void testMismatchedPrincipal() {
final String principal = "root";
TCredentials tcreds = new TCredentials(principal, KerberosToken.CLASS_NAME, ByteBuffer.allocate(0), UUID.randomUUID().toString());
UGIAssumingProcessor.rpcPrincipal.set(principal + "foobar");
assertThrows(ThriftSecurityException.class, () -> proxy.updateArgs(new Object[] { new Object(), tcreds }));
}
use of org.apache.accumulo.core.securityImpl.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);
}
Aggregations