Package com.google.enterprise.connector.spi

Examples of com.google.enterprise.connector.spi.AuthenticationManager.authenticate()


   * @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

/** 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

    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);
View Full Code Here

    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

      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      s.getTraversalManager().startTraversal();
      AuthenticationManager am = s.getAuthenticationManager();

      AuthenticationResponse response = am.authenticate(
          new SimpleAuthenticationIdentity(
              "non-existing user", "wrong password", "wrong domain"));
      assertFalse("Non existing user fails authn", response.isValid());
      assertNull("No groups resolved for non-existing user",
          response.getGroups());
View Full Code Here

      Session s = con.login();
      s.getTraversalManager().startTraversal();
      AuthenticationManager am = s.getAuthenticationManager();

      for (AdTestEntity user : ad.users) {
        AuthenticationResponse response = am.authenticate(
            new SimpleAuthenticationIdentity(user.sAMAccountName));

        Set<AdTestEntity> groupsCorrect = new HashSet<AdTestEntity>();
        user.getAllGroups(groupsCorrect);
View Full Code Here

        t.start();
        threads.add(t);
      }

      String username = TestConfiguration.d1principal.split("\\\\")[1];
      AuthenticationResponse response = am.authenticate(
          new SimpleAuthenticationIdentity(username));
      // we will expect to find exactly the same number of groups during crawl
      int constGroups = response.getGroups().size();
      boolean finished = false;
View Full Code Here

      // Run Authentication every 200ms and measure if it was faster than 3 sec
      while (!finished) {
        Thread.sleep(200);
        long start = System.currentTimeMillis();
        response = am.authenticate(
          new SimpleAuthenticationIdentity(username));
        long diff = System.currentTimeMillis() - start;
        assertTrue("Less than three seconds [" + diff + "]" , diff < 3000);
        assertTrue("Principal valid: " + TestConfiguration.d1principal,
            response.isValid());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.