Search in sources :

Example 11 with UserState

use of alluxio.security.user.UserState in project alluxio by Alluxio.

the class MasterClientAuthenticationIntegrationTest method customAuthenticationDenyConnect.

@Test
@LocalAlluxioClusterResource.Config(confParams = { PropertyKey.Name.SECURITY_AUTHENTICATION_TYPE, "CUSTOM", PropertyKey.Name.SECURITY_AUTHENTICATION_CUSTOM_PROVIDER_CLASS, NameMatchAuthenticationProvider.FULL_CLASS_NAME, PropertyKey.Name.SECURITY_LOGIN_USERNAME, "alluxio" })
public void customAuthenticationDenyConnect() throws Exception {
    UserState s = new TestUserState("no-alluxio", ServerConfiguration.global());
    try (FileSystemMasterClient masterClient = FileSystemMasterClient.Factory.create(MasterClientContext.newBuilder(ClientContext.create(s.getSubject(), ServerConfiguration.global())).build())) {
        Assert.assertFalse(masterClient.isConnected());
        // Using no-alluxio as loginUser to connect to Master, the IOException will be thrown
        mThrown.expect(UnauthenticatedException.class);
        masterClient.connect();
    }
}
Also used : UserState(alluxio.security.user.UserState) TestUserState(alluxio.security.user.TestUserState) FileSystemMasterClient(alluxio.client.file.FileSystemMasterClient) TestUserState(alluxio.security.user.TestUserState) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

UserState (alluxio.security.user.UserState)11 Test (org.junit.Test)5 GrpcServer (alluxio.grpc.GrpcServer)3 Before (org.junit.Before)3 AlluxioURI (alluxio.AlluxioURI)2 FileSystemMasterClient (alluxio.client.file.FileSystemMasterClient)2 GrpcChannel (alluxio.grpc.GrpcChannel)2 TestUserState (alluxio.security.user.TestUserState)2 File (java.io.File)2 InetSocketAddress (java.net.InetSocketAddress)2 TemporaryFolder (org.junit.rules.TemporaryFolder)2 UnauthenticatedException (alluxio.exception.status.UnauthenticatedException)1 GrpcChannelBuilder (alluxio.grpc.GrpcChannelBuilder)1 GrpcConnection (alluxio.grpc.GrpcConnection)1 GrpcServerBuilder (alluxio.grpc.GrpcServerBuilder)1 JobConfig (alluxio.job.JobConfig)1 JobInfo (alluxio.job.wire.JobInfo)1 DefaultSafeModeManager (alluxio.master.DefaultSafeModeManager)1 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)1 UnderFileSystem (alluxio.underfs.UnderFileSystem)1