Search in sources :

Example 1 with RESTAuthHelper

use of io.pravega.shared.rest.security.RESTAuthHelper in project pravega by pravega.

the class RESTAuthHelperTest method testAuthIsEnabledWhenPravegaAuthManagerIsNonNull.

@Test
public void testAuthIsEnabledWhenPravegaAuthManagerIsNonNull() {
    RESTAuthHelper sut = new RESTAuthHelper(new AuthHandlerManager(null));
    assertTrue(sut.isAuthEnabled());
}
Also used : RESTAuthHelper(io.pravega.shared.rest.security.RESTAuthHelper) AuthHandlerManager(io.pravega.shared.rest.security.AuthHandlerManager) Test(org.junit.Test)

Example 2 with RESTAuthHelper

use of io.pravega.shared.rest.security.RESTAuthHelper in project pravega by pravega.

the class RESTAuthHelperTest method testAuthIsDisabledWhenPravegaAuthManagerIsNull.

@Test
public void testAuthIsDisabledWhenPravegaAuthManagerIsNull() {
    RESTAuthHelper sut = new RESTAuthHelper(null);
    assertFalse(sut.isAuthEnabled());
}
Also used : RESTAuthHelper(io.pravega.shared.rest.security.RESTAuthHelper) Test(org.junit.Test)

Example 3 with RESTAuthHelper

use of io.pravega.shared.rest.security.RESTAuthHelper in project pravega by pravega.

the class RESTAuthHelperTest method testAuthOkWhenAuthMgrIsNull.

@Test
public void testAuthOkWhenAuthMgrIsNull() throws AuthException {
    RESTAuthHelper authHelper = new RESTAuthHelper(null);
    assertTrue(authHelper.isAuthorized(null, null, null, null));
    authHelper.authenticate(null);
    authHelper.authorize(null, null, null, null);
    authHelper.authenticateAuthorize(null, null, null);
}
Also used : RESTAuthHelper(io.pravega.shared.rest.security.RESTAuthHelper) Test(org.junit.Test)

Example 4 with RESTAuthHelper

use of io.pravega.shared.rest.security.RESTAuthHelper in project pravega by pravega.

the class RESTAuthHelperTest method init.

@Before
public void init() {
    RESTServerConfig config = RESTServerConfigImpl.builder().host("localhost").port(TestUtils.getAvailableListenPort()).authorizationEnabled(true).userPasswordFile("passwd").tlsEnabled(false).build();
    AuthHandlerManager authManager = new AuthHandlerManager(config);
    authManager.registerHandler(new FakeAuthHandler());
    authHelper = new RESTAuthHelper(authManager);
}
Also used : RESTAuthHelper(io.pravega.shared.rest.security.RESTAuthHelper) AuthHandlerManager(io.pravega.shared.rest.security.AuthHandlerManager) FakeAuthHandler(io.pravega.auth.FakeAuthHandler) RESTServerConfig(io.pravega.shared.rest.RESTServerConfig) Before(org.junit.Before)

Aggregations

RESTAuthHelper (io.pravega.shared.rest.security.RESTAuthHelper)4 Test (org.junit.Test)3 AuthHandlerManager (io.pravega.shared.rest.security.AuthHandlerManager)2 FakeAuthHandler (io.pravega.auth.FakeAuthHandler)1 RESTServerConfig (io.pravega.shared.rest.RESTServerConfig)1 Before (org.junit.Before)1