Package com.google.enterprise.connector.spi

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


  public void testGroupLookup_onlyWorld() throws Exception {
    groupSetUp();

    AuthenticationResponse result =
        authentManager.authenticate(new SimpleAuthenticationIdentity(
            DmInitialize.DM_LOGIN_OK2, DmInitialize.DM_PWD_OK2));
    assertTrue(result.isValid());
    Collection<?> groups = result.getGroups();
    assertEquals(ImmutableList.of("dm_world"), toStrings(groups));
  }
View Full Code Here


    // the group lookup query, so we can test the exception handling.
    insertUser("d''oh!", "homer", "", "");

    try {
      authentManager.authenticate(
          new SimpleAuthenticationIdentity("homer", null));
      fail("Expected an exception");
    } catch (RepositoryException expected) {
      if (!expected.getMessage().startsWith("Database error")) {
        throw expected;
      }
View Full Code Here

   * groups (along with dm_world) are returned for the user.
   */
  private void testGroupLookup(String user, String domain,
      String... expectedGroups) throws Exception {
    AuthenticationResponse result = authentManager.authenticate(
        new SimpleAuthenticationIdentity(user, null, domain));
    assertTrue(result.isValid());
    ImmutableList.Builder<String> builder = ImmutableList.builder();
    assertEquals(builder.add(expectedGroups).add("dm_world").build(),
        toStrings(result.getGroups()));
  }
View Full Code Here

  /** Helper method tests group lookup only and verifies that it fails. */
  private void testGroupLookupFail(String user, String domain)
      throws Exception {
    AuthenticationResponse result = authentManager.authenticate(
        new SimpleAuthenticationIdentity(user, null, domain));
    assertFalse(result.isValid());
  }
View Full Code Here

      throws Exception {
    insertUser("aceuser", "ldapuser", "LDAP",
        "CN=LDAP User,dc=ace,dc=example,dc=com");

    AuthenticationResponse result = authentManager.authenticate(
        new SimpleAuthenticationIdentity(user, null, domain));
    assertFalse(result.isValid());
  }
View Full Code Here

    assertEquals("example", IdentityUtil.getFirstDomainFromDN(dnString));
  }

  public void testGetCanonicalUsername() {
    AuthenticationIdentity identity =
        new SimpleAuthenticationIdentity("", DmInitialize.DM_PWD_OK1);
    String result = IdentityUtil.getCanonicalUsername(identity);
    assertEquals(null, result);

    identity =
        new SimpleAuthenticationIdentity(null, DmInitialize.DM_PWD_OK1);
    result = IdentityUtil.getCanonicalUsername(identity);
    assertEquals(null, result);

    identity =
        new SimpleAuthenticationIdentity("Joe@corp", DmInitialize.DM_PWD_OK1);
    result = IdentityUtil.getCanonicalUsername(identity);
    assertEquals("Joe", result);

    identity =
        new SimpleAuthenticationIdentity("Mary@corp.example.com",
            DmInitialize.DM_PWD_OK1);
    result = IdentityUtil.getCanonicalUsername(identity);
    assertEquals("Mary", result);
  }
View Full Code Here

    assertEquals("Mary", result);
  }

  public void testGetDomain() {
    AuthenticationIdentity identity =
        new SimpleAuthenticationIdentity("", DmInitialize.DM_PWD_OK1);
    String result = IdentityUtil.getDomain(identity);
    assertEquals(null, result);

    identity =
        new SimpleAuthenticationIdentity("Joe@corp", DmInitialize.DM_PWD_OK1);
    result = IdentityUtil.getDomain(identity);
    assertEquals("corp", result);

    identity =
        new SimpleAuthenticationIdentity("Mary@entops.example.com",
            DmInitialize.DM_PWD_OK1);
    result = IdentityUtil.getDomain(identity);
    assertEquals("entops", result);

    identity =
        new SimpleAuthenticationIdentity("Mary@entops.example.com",
            DmInitialize.DM_PWD_OK1, "");
    result = IdentityUtil.getDomain(identity);
    assertEquals("entops", result);

    identity =
        new SimpleAuthenticationIdentity("Mary@entops.example.com",
            DmInitialize.DM_PWD_OK1, "eng");
    result = IdentityUtil.getDomain(identity);
    assertEquals("eng", result);
  }
View Full Code Here

  private void testAuthorization(Map<String, Boolean> expectedResults,
      String username) throws RepositoryException {
    Collection<AuthorizationResponse> list =
        authorizationManager.authorizeDocids(expectedResults.keySet(),
            new SimpleAuthenticationIdentity(username, null));
    assertNotNull(list);
    assertEquals(expectedResults.size(), list.size());
    for (AuthorizationResponse pm : list) {
      String uuid = pm.getDocid();
      boolean ok = pm.isValid();
View Full Code Here

      Map<String, Boolean> expectedResults, String username)
      throws RepositoryException {
    List<String> docids = new LinkedList<String>(expectedResults.keySet());

    Collection<AuthorizationResponse> resultSet = fam.authorizeDocids(docids,
        new SimpleAuthenticationIdentity(username, null));

    for (AuthorizationResponse ar : resultSet) {
      String uuid = ar.getDocid();

      Boolean expected = expectedResults.get(uuid);
View Full Code Here

   * @param username the username to authorize
   */
  private Collection<AuthorizationResponse> authorizeDocids(List<String> docids,
      String username) throws RepositoryException {
    return authManager.authorizeDocids(docids,
        new SimpleAuthenticationIdentity(username));
  }
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.