Package com.google.enterprise.connector.spi

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


  public void testTwoDomainSpecificIdentitiesMultipleQueries() {
    AuthorizationParser ap =
        new AuthorizationParser(TWO_DOMAINSPECIFIC_IDENTITIES_MULTIPLE_QUERIES);
    assertEquals(2, ap.countParsedIdentities());
    SimpleAuthenticationIdentity i1 =
        new SimpleAuthenticationIdentity("xyzzy", null, "arglebargle");
    assertEquals(1, countConnectorsForIdentity(ap, i1));
    assertEquals(2, countUrlsForIdentityConnectorPair(ap, i1, "connector1"));
    assertEquals(0, countUrlsForIdentityConnectorPair(ap, i1, "connector2"));
    SimpleAuthenticationIdentity i2 =
        new SimpleAuthenticationIdentity("xyzzy", null, "bazfaz");
    assertEquals(1, countConnectorsForIdentity(ap, i2));
    assertEquals(0, countUrlsForIdentityConnectorPair(ap, i2, "connector1"));
    assertEquals(2, countUrlsForIdentityConnectorPair(ap, i2, "connector2"));
  }
View Full Code Here


      + "</AuthorizationQuery>\n";

  public void testPasswordQuery() {
    AuthorizationParser ap = new AuthorizationParser(PASSWORD_IDENTITY);
    assertEquals(1, ap.countParsedIdentities());
    SimpleAuthenticationIdentity id =
        new SimpleAuthenticationIdentity("username", "password");
    assertEquals(2, countConnectorsForIdentity(ap, id));
    assertEquals(2, countUrlsForIdentityConnectorPair(ap, id, "ex-tca-01"));
    assertEquals(2, countUrlsForIdentityConnectorPair(ap, id, "ex-tca-02"));
  }
View Full Code Here

    assertEquals(2, countUrlsForIdentityConnectorPair(ap, id, "ex-tca-02"));
  }

  public void testMatchesIdentity() {
    AuthenticationIdentity nameId =
        new SimpleAuthenticationIdentity("user1");
    assertTrue(AuthorizationParser.matchesIdentity(nameId,
        "user1", null, null));
    assertTrue(AuthorizationParser.matchesIdentity(nameId,
        "user1", "", null));
    assertTrue(AuthorizationParser.matchesIdentity(nameId,
        "user1", null, ""));
    assertTrue(AuthorizationParser.matchesIdentity(nameId,
        "user1", "", ""));
    assertFalse(AuthorizationParser.matchesIdentity(nameId,
        "user2", null, null));
    assertFalse(AuthorizationParser.matchesIdentity(nameId,
        "user1", "pass1", null));
    assertFalse(AuthorizationParser.matchesIdentity(nameId,
        "user1", null, "domain1"));

    AuthenticationIdentity namePassId =
        new SimpleAuthenticationIdentity("user1", "pass1");
    assertTrue(AuthorizationParser.matchesIdentity(namePassId,
        "user1", "pass1", null));
    assertTrue(AuthorizationParser.matchesIdentity(namePassId,
        "user1", "pass1", ""));
    assertFalse(AuthorizationParser.matchesIdentity(namePassId,
        "user2", "pass1", null));
    assertFalse(AuthorizationParser.matchesIdentity(namePassId,
        "user1", "pass2", null));
    assertFalse(AuthorizationParser.matchesIdentity(namePassId,
        "user1", "", null));

    AuthenticationIdentity namePassDomainId =
        new SimpleAuthenticationIdentity("user1", "pass1", "domain1");
    assertTrue(AuthorizationParser.matchesIdentity(namePassDomainId,
        "user1", "pass1", "domain1"));
    assertFalse(AuthorizationParser.matchesIdentity(namePassDomainId,
        "user1", "pass1", "domain2"));
    assertFalse(AuthorizationParser.matchesIdentity(namePassDomainId,
        "user1", "pass2", "domain1"));
    assertFalse(AuthorizationParser.matchesIdentity(namePassDomainId,
        "user2", "pass1", "domain1"));

    AuthenticationIdentity nameDomainId =
        new SimpleAuthenticationIdentity("user1", null, "domain1");
    assertTrue(AuthorizationParser.matchesIdentity(nameDomainId,
        "user1", "", "domain1"));
    assertTrue(AuthorizationParser.matchesIdentity(nameDomainId,
        "user1", null, "domain1"));
    assertFalse(AuthorizationParser.matchesIdentity(nameDomainId,
View Full Code Here

    for (AuthenticationIdentity identity : parseMap.keySet()) {
      if (matchesIdentity(identity, username, password, domain)) {
        return identity;
      }
    }
    return new SimpleAuthenticationIdentity(username, password, domain);
  }
View Full Code Here

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

    AuthenticationIdentity identity =
      new SimpleAuthenticationIdentity(username);
    Collection<AuthorizationResponse> results =
        authorizationManager.authorizeDocids(docids, identity);
    for (AuthorizationResponse response : results) {
      String uuid = response.getDocid();
      boolean ok = response.isValid();
View Full Code Here

        continue;
      }
      NDC.pushAppend(connectorName);
      try {
        AuthenticationIdentity identity =
            new SimpleAuthenticationIdentity(username, password, domain);
        AuthenticationResponse response =
            manager.authenticate(connectorName, identity);
        if (response.isValid()) {
          ServletUtil.writeXMLTagWithAttrs(
              out, 2, ServletUtil.XMLTAG_SUCCESS,
View Full Code Here

    instantiator.setupTestTraversers();
    manager = new ProductionManager();
    manager.setInstantiator(instantiator);
    manager.setFeedConnection(new MockFeedConnection());
    connectorName = MockInstantiator.TRAVERSER_NAME1;
    identity = new SimpleAuthenticationIdentity("bar");
  }
View Full Code Here

  /**
   * Helper method to shrink the text in the tests and hide the
   * password parameter, which we do not need.
   */
  private AuthenticationIdentity getIdentity(String username, String domain) {
    return new SimpleAuthenticationIdentity(username, null, domain);
  }
View Full Code Here

    private AuthenticationIdentity identity;

    @Override
    protected void setUp() {
        manager = new NoOpAuthenticationManager();
        identity = new SimpleAuthenticationIdentity("nobody", "goodPassword");
    }
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.