Search in sources :

Example 11 with TestUserState

use of alluxio.security.user.TestUserState 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

TestUserState (alluxio.security.user.TestUserState)11 FileSystem (alluxio.client.file.FileSystem)6 AlluxioURI (alluxio.AlluxioURI)4 Test (org.junit.Test)4 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)2 FileSystemShellUtilsTest (alluxio.client.cli.fs.FileSystemShellUtilsTest)2 FileSystemMasterClient (alluxio.client.file.FileSystemMasterClient)2 CoreMasterContext (alluxio.master.CoreMasterContext)2 MasterRegistry (alluxio.master.MasterRegistry)2 BlockMasterFactory (alluxio.master.block.BlockMasterFactory)2 MetricsMasterFactory (alluxio.master.metrics.MetricsMasterFactory)2 UserState (alluxio.security.user.UserState)2 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)2 Before (org.junit.Before)2 URIStatus (alluxio.client.file.URIStatus)1 StorageList (alluxio.grpc.StorageList)1 NoopJournalSystem (alluxio.master.journal.noop.NoopJournalSystem)1 WorkerNetAddress (alluxio.wire.WorkerNetAddress)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1