Package com.google.enterprise.connector.spi

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


    }

    private boolean authenticate(String username, String password) {
        try {
            AuthenticationIdentity identity =
                new SimpleAuthenticationIdentity(username, password);
            return manager.authenticate(identity).isValid();
        }
        catch (RepositoryException e) {
            return false;
        }
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);
    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

    SiteDiscoveryHelper siteDisc =
        new SiteDiscoveryHelper(sharepointClientContext, null);
    SharepointAuthorizationManager authMan = new SharepointAuthorizationManager(
        clientFactory, this.sharepointClientContext,
        siteDisc.getMatchingSiteCollections());
    AuthenticationIdentity authID = new SimpleAuthenticationIdentity(
        TestConfiguration.searchUserID, TestConfiguration.searchUserPwd);

    Set<String> docids = new HashSet<String>();
    docids.add(TestConfiguration.SearchDocID1);
    docids.add(TestConfiguration.SearchDocID2);
View Full Code Here

  }

  private boolean authenticate(String username, String password, boolean log) {
    try {
      AuthenticationIdentity identity =
          new SimpleAuthenticationIdentity(username, password);
      return authManager.authenticate(identity).isValid();
    }
    catch (RepositoryException e) {
      if (log)
        System.out.println(getName() + " " + e.getMessage());
View Full Code Here

    SiteDiscoveryHelper siteDisc =
        new SiteDiscoveryHelper(sharepointClientContext, null);
    SharepointAuthorizationManager authMan = new SharepointAuthorizationManager(
        clientFactory, this.sharepointClientContext,
        siteDisc.getMatchingSiteCollections());
    AuthenticationIdentity authID = new SimpleAuthenticationIdentity(
        TestConfiguration.searchUserID, TestConfiguration.searchUserPwd);

    Set<String> docids = new HashSet<String>();
    docids.add(TestConfiguration.SearchDocID4);
    docids.add(TestConfiguration.SearchDocID6);
View Full Code Here

      String username, String domain, String password)
      throws Exception {
    AuthenticationResponse response;

    response = am.authenticate(
        new SimpleAuthenticationIdentity(username));
    assertTrue(comment + ": Username, no domain, no password",
        response.isValid());

    response = am.authenticate(new SimpleAuthenticationIdentity(
        username, null));
    assertTrue(comment + ": Username, no domain, null password",
        response.isValid());

    response = am.authenticate(new SimpleAuthenticationIdentity(
        username, ""));
    assertFalse(comment + ": Username, no domain, empty password",
        response.isValid());

    response = am.authenticate(
        new SimpleAuthenticationIdentity(username, null, domain));
    assertTrue(comment + ": Username, domain, null password",
        response.isValid());

    response = am.authenticate(new SimpleAuthenticationIdentity(
            username, "", domain));
    assertFalse(comment + ": Username, domain, empty password",
        response.isValid());

    response = am.authenticate(new SimpleAuthenticationIdentity(
        username, password, domain));
    assertTrue(comment + ": Username, domain, password",
        response.isValid());

    response = am.authenticate(new SimpleAuthenticationIdentity(
        username, password + "makeinvalid"));
    assertFalse(comment + ": Username, no domain, incorrect password",
        response.isValid());

    response = am.authenticate(new SimpleAuthenticationIdentity(
        username, password + "makeinvalid", domain));
    assertFalse(comment + ": Username, domain, incorrect password",
        response.isValid());
  }
View Full Code Here

      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

      // recrawl the active directory
      s.getTraversalManager().resumeTraversal("");

      // get groups for the created user
      AuthenticationResponse response = s.getAuthenticationManager()
          .authenticate(new SimpleAuthenticationIdentity(user.sAMAccountName));

      @SuppressWarnings("unchecked") Collection<Principal> principals =
          (Collection<Principal>) response.getGroups();
      assertNotNull(principals);
      assertTrue(principals.size() > 0);
View Full Code Here

      // recrawl AD
      s.getTraversalManager().resumeTraversal("");

      assertTrue("Authentication successful for renamed user",
          s.getAuthenticationManager().authenticate(
              new SimpleAuthenticationIdentity(
                  user.sAMAccountName, TestConfiguration.password)).isValid());
    }
  }
View Full Code Here

      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);

        Set<String> groups = new HashSet<String>();
View Full Code Here

TOP

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

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.