@Test public void testAddSimpleAuthenticator() { Authenticator authenticator = new Authenticator(SIMPLE_URL); AuthenticationModule simpleAuthModule = authenticator.auth(SIMPLE_MODULE_NAME, new AuthenticationConfig()); assertNotNull(simpleAuthModule); }
@Test public void testAddAndGetSimpleAuthenticator() { Authenticator authenticator = new Authenticator(SIMPLE_URL); AuthenticationModule simpleAuthModule = authenticator.auth(SIMPLE_MODULE_NAME, new AuthenticationConfig()); assertEquals(simpleAuthModule, authenticator.get(SIMPLE_MODULE_NAME)); authenticator.remove(SIMPLE_MODULE_NAME); assertNull(authenticator.get(SIMPLE_MODULE_NAME)); }
@Test(expected = IllegalArgumentException.class) public void testAddAuthenticatorFailsWithUnsupportedType() { Authenticator authenticator = new Authenticator(SIMPLE_URL); AuthenticationConfig config = new AuthenticationConfig(); config.setAuthType( new AuthType() { @Override public String getName() { return "Bad type"; } }); AuthenticationModule simpleAuthModule = authenticator.auth(SIMPLE_MODULE_NAME, config); assertNotNull(simpleAuthModule); }
@Test public void testAddAuthenticator() { Authenticator authenticator = new Authenticator(SIMPLE_URL); AuthenticationConfig config = new AuthenticationConfig(); config.setAuthType(AuthTypes.AG_SECURITY); config.setEnrollEndpoint("testEnroll"); config.setLoginEndpoint("testLogin"); config.setLogoutEndpoint("testLogout"); AuthenticationModule simpleAuthModule = authenticator.auth(SIMPLE_MODULE_NAME, config); assertEquals(simpleAuthModule, authenticator.get(SIMPLE_MODULE_NAME)); assertEquals("testEnroll", simpleAuthModule.getEnrollEndpoint()); assertEquals("testLogin", simpleAuthModule.getLoginEndpoint()); assertEquals("testLogout", simpleAuthModule.getLogoutEndpoint()); }