Package com.google.enterprise.connector.spi

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


    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


    return authenticate(username, password, false);
  }

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

   */
  public void testAuthorizeDocids() {
    /*
     * Create AuthenticationIdentity for user-name "user1"
     */
    AuthenticationIdentity authNIdentity = new AuthenticationIdentity() {
      @Override public String getUsername() { return "user1"; }
      @Override public String getPassword() { return null; }
      @Override public String getDomain() { return null; }
    };

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

    assertEquals(2, countUrlsForIdentityConnectorPair(ap, id, "ex-tca-01"));
    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"));
View Full Code Here

    numDocs = 0;

    for (int i = 0; i < queryList.getLength(); ++i) {
      Element queryItem = (Element) queryList.item(i);
      AuthenticationIdentity identity = parseIdentityGroup(queryItem);
      // Only consider Resources for which there is an associated identity.
      // A null Identity is considered an error on the part of the GSA.
      // Skip all its resources and continue with the next ConnectorQuery item.
      // Subsequently, this ConnectorQuery will not run and none of its
      // QueryResources will be returned. The GSA will then consider them
View Full Code Here

          + "authentication rules defined.");
      setStatus(ConnectorMessageCode.RESPONSE_NULL_IDENTITY, "Null Identity");
      return null;
    }

    AuthenticationIdentity identity = findIdentity(username, password, domain);
    ConnectorQueries urlsByConnector = getConnectorQueriesForIdentity(identity);
    if (urlsByConnector == null) {
      urlsByConnector = new ConnectorQueries();
      putConnectorQueriesForIdentity(identity, urlsByConnector);
    }
View Full Code Here

  private void testAuthorization(AuthorizationManager authorizationManager,
      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();
View Full Code Here

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

TOP

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

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.