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);
 }
  @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());
  }