/** * Add a simple login form. Useful for development and quick startup. * * @param pattern Pattern to protect.ver * @return This module. */ public Pac4j form(String pattern) { return clientInternal(pattern, conf -> { showDevLogin = true; return new FormClient("/login", new SimpleTestUsernamePasswordAuthenticator()); }, null); }
protected Authenticator getAuthenticator(final String name) { if (AUTHENTICATOR_TEST_TOKEN.equals(name)) { return new SimpleTestTokenAuthenticator(); } else if (AUTHENTICATOR_TEST_USERNAME_PASSWORD.equals(name)) { return new SimpleTestUsernamePasswordAuthenticator(); } else { return authenticators.get(name); } } }
@Test public void testHasDefaultProfileCreator() { final IpClient client = new IpClient(new SimpleTestTokenAuthenticator()); client.init(); }
private DirectFormClient getFormClient() { return new DirectFormClient(new SimpleTestUsernamePasswordAuthenticator()); }
@Test public void testHasDefaultProfileCreator() { final DirectBearerAuthClient bearerAuthClient = new DirectBearerAuthClient(new SimpleTestTokenAuthenticator()); bearerAuthClient.init(); }
private FormClient getFormClient() { final FormClient client = new FormClient(LOGIN_URL, new SimpleTestUsernamePasswordAuthenticator()); client.setCallbackUrl(CALLBACK_URL); return client; }
@Test public void testHasDefaultProfileCreator() { final DirectDigestAuthClient digestAuthClient = new DirectDigestAuthClient(new SimpleTestTokenAuthenticator()); digestAuthClient.init(); }
private IndirectBasicAuthClient getBasicAuthClient() { final IndirectBasicAuthClient basicAuthClient = new IndirectBasicAuthClient(new SimpleTestUsernamePasswordAuthenticator()); basicAuthClient.setCallbackUrl(CALLBACK_URL); return basicAuthClient; }
@Test public void testHasDefaultProfileCreator() { final CookieClient cookieClient = new CookieClient("testcookie", new SimpleTestTokenAuthenticator()); cookieClient.init(); }
@Test public void testHasDefaultProfileCreator() { final DirectBasicAuthClient basicAuthClient = new DirectBasicAuthClient(new SimpleTestUsernamePasswordAuthenticator()); basicAuthClient.init(); }
@Test(expected=Exception.class) public void testMissingCookieName() { final CookieClient cookieClient = new CookieClient(null, new SimpleTestTokenAuthenticator()); cookieClient.init(); }
@Test public void testHasDefaultProfileCreator() { final FormClient formClient = new FormClient(LOGIN_URL, new SimpleTestUsernamePasswordAuthenticator()); formClient.setCallbackUrl(CALLBACK_URL); formClient.init(); }
@Test public void testHasDefaultProfileCreator() { final HeaderClient client = new HeaderClient(HEADER_NAME, new SimpleTestTokenAuthenticator()); client.init(); }
@Test public void testHasDefaultProfileCreator() { final IndirectBasicAuthClient basicAuthClient = new IndirectBasicAuthClient(new SimpleTestUsernamePasswordAuthenticator()); basicAuthClient.setCallbackUrl(CALLBACK_URL); basicAuthClient.init(); }
@Test public void testMissingParameterName() { final ParameterClient client = new ParameterClient(null, new SimpleTestTokenAuthenticator()); TestsHelper.initShouldFail(client, "parameterName cannot be blank"); }
@Test public void testHasDefaultProfileCreator() { final DirectFormClient formClient = new DirectFormClient(new LocalCachingAuthenticator<>(new SimpleTestUsernamePasswordAuthenticator(), 10, 10, TimeUnit.DAYS)); formClient.init(); }
@Test public void testHasDefaultProfileCreator() { final ParameterClient client = new ParameterClient(null, new SimpleTestTokenAuthenticator()); client.setParameterName(PARAMETER_NAME); client.init(); }
@Test public void testMissingRealm() { final IndirectBasicAuthClient basicAuthClient = new IndirectBasicAuthClient(null, new SimpleTestUsernamePasswordAuthenticator()); basicAuthClient.setCallbackUrl(CALLBACK_URL); TestsHelper.initShouldFail(basicAuthClient, "realmName cannot be blank"); }
@Test public void testMissingHeaderName() { final HeaderClient client = new HeaderClient(null, new SimpleTestTokenAuthenticator()); TestsHelper.initShouldFail(client, "headerName cannot be blank"); }
@Test public void testMissingLoginUrl() { final FormClient formClient = new FormClient(null, new SimpleTestUsernamePasswordAuthenticator()); formClient.setCallbackUrl(CALLBACK_URL); TestsHelper.initShouldFail(formClient, "loginUrl cannot be blank"); }