Search in sources :

Example 11 with TCredentials

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 }));
}
Also used : PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) TCredentials(org.apache.accumulo.core.securityImpl.thrift.TCredentials) Test(org.junit.Test)

Example 12 with TCredentials

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 }));
}
Also used : TCredentials(org.apache.accumulo.core.securityImpl.thrift.TCredentials) KerberosToken(org.apache.accumulo.core.client.security.tokens.KerberosToken) Test(org.junit.Test)

Example 13 with TCredentials

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 }));
}
Also used : TCredentials(org.apache.accumulo.core.securityImpl.thrift.TCredentials) Test(org.junit.Test)

Example 14 with TCredentials

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 }));
}
Also used : TCredentials(org.apache.accumulo.core.securityImpl.thrift.TCredentials) Test(org.junit.Test)

Example 15 with TCredentials

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);
}
Also used : PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) TCredentials(org.apache.accumulo.core.securityImpl.thrift.TCredentials) Credentials(org.apache.accumulo.core.clientImpl.Credentials)

Aggregations

TCredentials (org.apache.accumulo.core.securityImpl.thrift.TCredentials)27 Test (org.junit.Test)18 KerberosToken (org.apache.accumulo.core.client.security.tokens.KerberosToken)7 ArrayList (java.util.ArrayList)6 TabletClientService (org.apache.accumulo.core.tabletserver.thrift.TabletClientService)6 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)5 AccumuloConfiguration (org.apache.accumulo.core.conf.AccumuloConfiguration)5 TServerInstance (org.apache.accumulo.core.metadata.TServerInstance)5 TCompactionQueueSummary (org.apache.accumulo.core.tabletserver.thrift.TCompactionQueueSummary)5 Client (org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client)5 TInfo (org.apache.accumulo.core.trace.thrift.TInfo)5 HostAndPort (org.apache.accumulo.core.util.HostAndPort)5 AbstractServer (org.apache.accumulo.server.AbstractServer)5 ServerContext (org.apache.accumulo.server.ServerContext)5 LiveTServerSet (org.apache.accumulo.server.manager.LiveTServerSet)5 ServerAddress (org.apache.accumulo.server.rpc.ServerAddress)5 AuditedSecurityOperation (org.apache.accumulo.server.security.AuditedSecurityOperation)5 HashSet (java.util.HashSet)4 TreeSet (java.util.TreeSet)4 Credentials (org.apache.accumulo.core.clientImpl.Credentials)4