Search in sources :

Example 6 with GrpcServer

use of alluxio.grpc.GrpcServer in project alluxio by Alluxio.

the class GrpcSecurityTest method testCustomAuthenticationFails.

@Test
public void testCustomAuthenticationFails() throws Exception {
    mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.CUSTOM.getAuthName());
    mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS, ExactlyMatchAuthenticationProvider.class.getName());
    GrpcServer server = createServer(AuthType.CUSTOM);
    try {
        server.start();
        GrpcChannelBuilder channelBuilder = GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
        mThrown.expect(UnauthenticatedException.class);
        channelBuilder.setSubject(createSubject("fail", "fail")).build();
    } finally {
        server.shutdown();
    }
}
Also used : GrpcServer(alluxio.grpc.GrpcServer) GrpcChannelBuilder(alluxio.grpc.GrpcChannelBuilder) Test(org.junit.Test)

Example 7 with GrpcServer

use of alluxio.grpc.GrpcServer in project alluxio by Alluxio.

the class GrpcSecurityTest method testNoSaslAuthentication.

@Test
public void testNoSaslAuthentication() throws Exception {
    GrpcServer server = createServer(AuthType.NOSASL);
    try {
        server.start();
        GrpcChannelBuilder channelBuilder = GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
        channelBuilder.build();
    } finally {
        server.shutdown();
    }
}
Also used : GrpcServer(alluxio.grpc.GrpcServer) GrpcChannelBuilder(alluxio.grpc.GrpcChannelBuilder) Test(org.junit.Test)

Example 8 with GrpcServer

use of alluxio.grpc.GrpcServer in project alluxio by Alluxio.

the class GrpcSecurityTest method testAuthMismatch.

@Test
public void testAuthMismatch() throws Exception {
    GrpcServer server = createServer(AuthType.NOSASL);
    try {
        server.start();
        mConfiguration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE);
        GrpcChannelBuilder channelBuilder = GrpcChannelBuilder.newBuilder(getServerConnectAddress(server), mConfiguration);
        mThrown.expect(UnauthenticatedException.class);
        channelBuilder.build();
    } finally {
        server.shutdown();
    }
}
Also used : GrpcServer(alluxio.grpc.GrpcServer) GrpcChannelBuilder(alluxio.grpc.GrpcChannelBuilder) Test(org.junit.Test)

Aggregations

GrpcServer (alluxio.grpc.GrpcServer)8 Test (org.junit.Test)8 GrpcChannelBuilder (alluxio.grpc.GrpcChannelBuilder)6 UserState (alluxio.security.user.UserState)3 GrpcChannel (alluxio.grpc.GrpcChannel)2 UnauthenticatedException (alluxio.exception.status.UnauthenticatedException)1 GrpcConnection (alluxio.grpc.GrpcConnection)1 UUID (java.util.UUID)1