Package com.google.enterprise.connector.spi

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


   *
   * @throws RepositoryException
   */
  public void testInvalidUser() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity("not a real username"));
    assertFalse(response.isValid());
  }
View Full Code Here


   *
   * @throws RepositoryException
   */
  public void testValidUser() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity(username, password));
    assertTrue("Failed to authenticate: " + username, response.isValid());
    @SuppressWarnings({ "unchecked", "cast" })
        Collection<Principal> groups = (Collection<Principal>) response.getGroups();
    if (groups != null) {
View Full Code Here

   *
   * @throws RepositoryException
   */
  public void testValidUserGroupResolutionOnly() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity(username, null));
    assertTrue("Authenticated: " + username, response.isValid());
    @SuppressWarnings({ "unchecked", "cast" })
        Collection<Principal> groups = (Collection<Principal>) response.getGroups();
    if (groups != null) {
View Full Code Here

 
  public void testConnectorImplementsRequiredInterfaces() {
    try {
      Connector connector = new AfydConnector(null, "ignored.properties", null);
      Session session = connector.login();
      AuthenticationManager authnManager = session.getAuthenticationManager();
      AuthorizationManager authzManager = session.getAuthorizationManager();
      TraversalManager traversalManager = session.getTraversalManager();
    } catch (ClassCastException cce) {
      Assert.fail(cce.toString());
    } catch (RepositoryException re) {
View Full Code Here

    assertEquals(DmInitialize.DM_WEBTOP_SERVER_URL, serverUrl);
  }

  public void testGetAuthenticationManager() throws InstantiationException,
      IllegalAccessException, ClassNotFoundException {
    AuthenticationManager dctmAm = dctmSession.getAuthenticationManager();
    assertNotNull(dctmAm);
  }
View Full Code Here

    assertEquals(serverUrl, DmInitialize.DM_WEBTOP_SERVER_URL);
  }

  public void testGetAuthenticationManager() throws InstantiationException,
      IllegalAccessException, ClassNotFoundException {
    AuthenticationManager DctmAm = dctmSession.getAuthenticationManager();
    assertNotNull(DctmAm);
  }
View Full Code Here

    connector.setFQDNConversion(TestConfiguration.FQDNflag);
    this.session = new SharepointSession(connector, sharepointClientContext);
  }

  public void testGetAuthenticationManager() throws Exception {
    final AuthenticationManager authZMan = session.getAuthenticationManager();
    assertNotNull(authZMan);
  }
View Full Code Here

 
  public void testConnectorImplementsRequiredInterfaces() {
    try {
      Connector connector = new GdConnector();
      Session session = connector.login();
      AuthenticationManager authnManager = session.getAuthenticationManager();
      AuthorizationManager authzManager = session.getAuthorizationManager();
      TraversalManager traversalManager = session.getTraversalManager();
    } catch (ClassCastException cce) {
      Assert.fail(cce.toString());
    } catch (RepositoryException re) {
View Full Code Here

/** Tests the {@code LivelinkAuthenticationManager}. */
public class LivelinkAuthenticationManagerTest extends TestCase {
  public void testNullClientFactory() throws RepositoryException {
    try {
      AuthenticationManager lam = new LivelinkAuthenticationManager();
      lam.authenticate(new SimpleAuthenticationIdentity("fred"));
      fail();
    } catch (RepositoryException e) {
      if (e.getMessage().indexOf("client factory") == -1) {
        throw e;
      }
View Full Code Here

    con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
    con.setIncludeBuiltinGroups(true);

    Session s = con.login();
    s.getTraversalManager().startTraversal();
    AuthenticationManager am = s.getAuthenticationManager();
    String username = TestConfiguration.d1principal.split("\\\\")[1];
    AuthenticationResponse response = am.authenticate(
        new SimpleAuthenticationIdentity(username));
    assertNotNull(response);

    Collection<Principal> principals = getGroups(response);
    assertNotNull(principals);
    assertTrue(principals.size() > 0);

    // Count the builtin groups to make sure at least one is found.
    ArrayList<Principal> groupsFound = new ArrayList<Principal>();
    int foundCount = 0;
    for (Principal principal : principals) {
      if (isBuiltin(principal.getName())) {
        foundCount++;
      } else {
        groupsFound.add(principal);
      }
    }
    assertTrue(foundCount > 0);

    // Run the traversal again, this time excluding builtin groups.
    con.setIncludeBuiltinGroups(false);
    am = s.getAuthenticationManager();
    response = am.authenticate(new SimpleAuthenticationIdentity(username));

    principals = getGroups(response);
    assertNotNull(principals);
    assertTrue(principals.size() > 0);
View Full Code Here

TOP

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

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.