Package com.google.enterprise.connector.spi

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


      con.setPassword(TestConfiguration.d1password);

      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


      con.setPassword(TestConfiguration.d1password);

      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      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

      con.setPrincipal(TestConfiguration.d1principal);
      con.setPassword(TestConfiguration.d1password);

      con.setDataSource(dbType, TestConfiguration.dbs.get(dbType));
      Session s = con.login();
      AuthenticationManager am = s.getAuthenticationManager();
      TraversalManager tm = s.getTraversalManager();
      tm.startTraversal();
     
      // four threads which will be crawling the database simultaneously
      List<TestThread> threads = new ArrayList<TestThread>();
      for (int i = 0; i < 4; ++i) {
        TestThread t = new TestThread(TestConfiguration.d1hostname,
            TestConfiguration.d1port,
            TestConfiguration.d1principal,
            TestConfiguration.d1password,
            dbType, TestConfiguration.dbs.get(dbType), 2);
        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;

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

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

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

        new MockRepositoryEventList("MockRepositoryEventLog2.txt");
    MockRepository r = new MockRepository(mrel);
    MockJcrRepository repo = new MockJcrRepository(r);
    Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
    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

    }
    assertFalse(connectorExists("connector1"));

    instantiator.removeConnector("connector2");
    try {
      AuthenticationManager authn =
          instantiator.getAuthenticationManager("connector2");
      assertNull(authn);
    } catch (ConnectorNotFoundException e2) {
      assertTrue(true);
    }
View Full Code Here

    }
    assertFalse(connectorExists("connector100"));

    instantiator.removeConnector("connector200");
    try {
      AuthenticationManager authn =
          instantiator.getAuthenticationManager("connector200");
      assertNull(authn);
    } catch (ConnectorNotFoundException e2) {
      assertTrue(true);
    }
View Full Code Here

    assertEquals(config.getTypeName(), instantiator.getConnectorTypeName(name));

    AuthorizationManager authz = instantiator.getAuthorizationManager(name);
    assertNotNull(authz);

    AuthenticationManager authn = instantiator.getAuthenticationManager(name);
    assertNotNull(authn);

    TraversalManager traversalManager =
        instantiator.getConnectorCoordinator(name).getTraversalManager();
    assertNotNull(traversalManager);
View Full Code Here

  @Override
  public AuthenticationResponse authenticate(String connectorName,
      AuthenticationIdentity identity) {
    try {
      AuthenticationManager authnManager =
          instantiator.getAuthenticationManager(connectorName);
      // Some connectors don't implement the AuthenticationManager interface so
      // we need to check.
      if (authnManager != null) {
        if (LOGGER.isLoggable(Level.FINE)) {
          LOGGER.fine("AUTHENTICATE: " + identity);
        }
        AuthenticationResponse response = authnManager.authenticate(identity);
        if (LOGGER.isLoggable(Level.FINE)) {
          LOGGER.fine("AUTHENTICATION "
              + (response.isValid() ? "SUCCEEDED" : "FAILED") + ": "
              + identity + ": " + response);
        }
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.