private void configureBackendAuthentication() {
   Authenticator authenticator = new Authenticator(BASE_BACKEND_URL);
   AuthenticationConfig authenticationConfig = new AuthenticationConfig();
   authenticationConfig.setLoginEndpoint("/login");
   authenticationConfig.setLogoutEndpoint("/logout");
   authBackEnd = authenticator.auth("login", authenticationConfig);
 }
コード例 #2
0
  @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);
  }
コード例 #3
0
  @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());
  }