Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.AuthenticationResponse


  /** AuthenticationManager that authenticates anybody. */
  private static class AuthenticatingAuthenticationManager
      implements AuthenticationManager {
    public AuthenticationResponse authenticate(AuthenticationIdentity id) {
      return new AuthenticationResponse(true, id.getUsername());
    }
View Full Code Here


  /** Test authenticate() with no AuthenticationManager. */
  public void testAuthenticateNoAuthenticationManger() throws Exception {
    instantiator.addConnector(connectorName,
        new MockConnector(null, null, null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
    assertFalse(response.isValid());
    assertNull(response.getData());
    assertNull(response.getGroups());
  }
View Full Code Here

  /** Test authenticate() with success response. */
  public void testAuthenticateSuccess() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new AuthenticatingAuthenticationManager(), null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
    assertTrue(response.isValid());
    assertEquals("bar", response.getData());
  }
View Full Code Here

  /** Test authenticate() ConnectorNotFoundException. */
  public void testAuthenticateConnectorNotFoundException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new AuthenticatingAuthenticationManager(), null, null, null));
    AuthenticationResponse response =
        manager.authenticate("nonexistent", identity);
    assertNotNull(response);
    assertFalse(response.isValid());
    assertNull(response.getData());
    assertNull(response.getGroups());
  }
View Full Code Here

  /** Test authenticate() throws RepositoryException. */
  public void testAuthenticateRepositoryException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new ExceptionalAuthenticationManager(new RepositoryException()),
        null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
    assertFalse(response.isValid());
    assertNull(response.getData());
    assertNull(response.getGroups());
  }
View Full Code Here

  /** Test authenticate() throws RepositoryLoginException. */
  public void testAuthenticateRepositoryLoginException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new ExceptionalAuthenticationManager(new RepositoryLoginException()),
        null, null, null));
    AuthenticationResponse response =
        manager.authenticate(connectorName, identity);
    assertNotNull(response);
    assertFalse(response.isValid());
    assertNull(response.getData());
    assertNull(response.getGroups());
  }
View Full Code Here

  /** Test authenticate() throws RuntimeException. */
  public void testAuthenticateRuntimeException() throws Exception {
    instantiator.addConnector(connectorName, new MockConnector(null,
        new ExceptionalAuthenticationManager(null), null, null, null));
    AuthenticationResponse response = manager.authenticate(
        connectorName, identity);
    assertNotNull(response);
    assertFalse(response.isValid());
    assertNull(response.getData());
    assertNull(response.getGroups());
  }
View Full Code Here

            sharedPassword.equals(identity.getPassword());
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("AUTHENTICATE " + identity.getUsername() +
                ": " + isValid);
        }
        return new AuthenticationResponse(isValid, null);
    }
View Full Code Here

        manager = new NoOpAuthenticationManager();
        identity = new SimpleAuthenticationIdentity("nobody", "goodPassword");
    }

    public void testNoPassword() throws RepositoryException {
        AuthenticationResponse response = manager.authenticate(identity);
        assertTrue(response.isValid());
    }
View Full Code Here

        assertTrue(response.isValid());
    }

    public void testGoodSharedPassword() throws RepositoryException {
        manager.setSharedPassword("goodPassword");
        AuthenticationResponse response = manager.authenticate(identity);
        assertTrue(response.isValid());
    }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.AuthenticationResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.