Package com.google.enterprise.connector.spi

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


        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;

      // 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());
        int groups = response.getGroups().size();
View Full Code Here


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

      AuthenticationResponse response = s.getAuthenticationManager()
          .authenticate(new SimpleAuthenticationIdentity(
              user.sAMAccountName, TestConfiguration.password));

      assertTrue("Authentication must succeed for resurrected user",
          response.isValid());

      assertFalse(
          "New user mustn't belong to the group he belonged to prior deletion",
          response.getGroups().contains(
              new Principal(group.sAMAccountName.toLowerCase())));

      // add new user as member to the group
      ad.initialize();
      group.children.add(user);
      ad.setMembers(false, group);
      s.getTraversalManager().resumeTraversal(null);

      // delete the group, create the same one with different GUID
      ad.deleteEntity(group);
      ad.createGroup(false, group, ou);
      s.getTraversalManager().resumeTraversal(null);

      response = s.getAuthenticationManager().authenticate(
          new SimpleAuthenticationIdentity(
              user.sAMAccountName, TestConfiguration.password));

      assertTrue("User from resurrected group can be authenticated",
          response.isValid());
View Full Code Here

      // verify that each of x members belongs to this group
      String groupName = ad.getnETBIOSName() + AdConstants.BACKSLASH
          + group.sAMAccountName.toLowerCase();
      for (AdTestEntity user : group.children) {
        AuthenticationResponse response = am.authenticate(
            new SimpleAuthenticationIdentity(user.sAMAccountName));
        Set<String> groups = new HashSet<String>();
        @SuppressWarnings("unchecked") Collection<Principal> principals =
            (Collection<Principal>) response.getGroups();
        for (Principal p : principals) {
          groups.add(p.getName());
View Full Code Here

  private TreeSet<String> docids;

  @Override
  public void setUp() throws Exception {
    identity1 = new SimpleAuthenticationIdentity("rock", "hudson");
    identity2 = new SimpleAuthenticationIdentity("dwayne", "rock", "johnson");
    identity3 = new SimpleAuthenticationIdentity("stone", "phillips");

    docids = new TreeSet<String>();

    MockReadonlyFile flintstone = MockReadonlyFile.createRoot("/flintstone");
    docids.add(flintstone.addFile("fred", TEST_DATA).getPath());
View Full Code Here

  /** Null user is not authorized for any documents. */
  public void testNullUserName() throws Exception {
    // Technically the jetsons should pass this (I think).
    Set<String> expected = Sets.newTreeSet();
    testIdentity(new SimpleAuthenticationIdentity(null), expected);
  }
View Full Code Here

    ImmutableSet<String> docid =
        ImmutableSet.of(flintstone.addFile("fred", TEST_DATA).getPath());

    Set<String> expected = Sets.newTreeSet();
    Set<String> authorized =
        authorizeDocids(docid, new SimpleAuthenticationIdentity("rock"));
    assertTrue(authorized.toString(), authorized.isEmpty());
  }
View Full Code Here

    Session session = repo.login(creds);
    AuthenticationManager authenticationManager =
        new JcrAuthenticationManager(session);

    Assert.assertFalse(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("jimbo","jimbo")).isValid());
    Assert.assertFalse(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("admin","admin1")).isValid());
    Assert.assertFalse(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("joe","password")).isValid());
    Assert.assertFalse(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("jimbo")).isValid());

    // in this repository, the superuser account is open with any password
    Assert.assertTrue(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity(null,"jimbo")).isValid());
    Assert.assertTrue(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity(null)).isValid());

    Assert.assertTrue(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("admin","admin")).isValid());
    Assert.assertTrue(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("joe","joe")).isValid());
    Assert.assertTrue(authenticationManager.authenticate(
        new SimpleAuthenticationIdentity("mary","mary")).isValid());
  }
View Full Code Here

    return result;
  }

  private int countConnectorsForUsername(AuthorizationParser p,
      String username) {
    AuthenticationIdentity i = new SimpleAuthenticationIdentity(username);
    return countConnectorsForIdentity(p, i);
  }
View Full Code Here

    return (connectorQueries == null) ? 0 : connectorQueries.size();
  }

  private int countUrlsForUsernameConnectorPair(AuthorizationParser p,
      String username, String connectorName) {
    AuthenticationIdentity i = new SimpleAuthenticationIdentity(username);
    return countUrlsForIdentityConnectorPair(p, i, connectorName);
  }
View Full Code Here

  public void testOneDomainSpecificIdentity() {
    AuthorizationParser ap =
        new AuthorizationParser(ONE_DOMAINSPECIFIC_IDENTITY);
    assertEquals(1, ap.countParsedIdentities());
    SimpleAuthenticationIdentity id =
        new SimpleAuthenticationIdentity("username", null, "foodomain");
    assertEquals(2, countConnectorsForIdentity(ap, id));
    assertEquals(2, countUrlsForIdentityConnectorPair(ap, id, "connector1"));
    assertEquals(2, countUrlsForIdentityConnectorPair(ap, id, "connector2"));
  }
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.