Package com.google.enterprise.connector.spi

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


            "type", NotesItem.TEXT, "values", d));
    return doc;
  }

  public void testAuthorizeDocidsUnknownUser() throws Exception {
    SimpleAuthenticationIdentity id = new SimpleAuthenticationIdentity("foo");
    ArrayList<String> docids = Lists.newArrayList("docid1", "docid2");
    Collection<AuthorizationResponse> response =
        authorizationManager.authorizeDocids(docids, id);
    assertEquals(docids.size(), response.size());
    for (AuthorizationResponse r : response) {
View Full Code Here


      assertFalse(r.isValid());
    }
  }

  public void testAuthorizeDocidsAllowedByDatabase() throws Exception {
    SimpleAuthenticationIdentity id =
        new SimpleAuthenticationIdentity("anakin");
    ArrayList<String> docids = Lists.newArrayList(
        "http://host:80/jtmreplicaid0123/0/E54902C71C28594F852578CE004B223B",
        "http://host:80/jtmreplicaid0123/0/E54902C71C28594F852578CE004B223C",
        "http://host:80/jtmreplicaid0123/0/E54902C71C28594F852578CE004B223D");
    Collection<AuthorizationResponse> response =
View Full Code Here

    docIdList.add(
        "http://NewYork/852578CE004AF5F8/0/1726A130A2B970CC852578CE004B1E70");
    docIdList.add(
        "http://NewYork/852578CE004AF5F8/0/E54902C71C28594F852578CE004B223B");
    Collection<AuthorizationResponse> responseList = manager.authorizeDocids(
        docIdList, new SimpleAuthenticationIdentity("not a valid user"));

    assertTrue("Too many elements in response list",
        responseList.size() <= docIdList.size());
    for (AuthorizationResponse response : responseList) {
      assertFalse(response.getDocid(), response.isValid());
View Full Code Here

    docIds.add(4, id.toString());

    NotesAuthorizationManager manager =
        (NotesAuthorizationManager) session.getAuthorizationManager();
    Collection<AuthorizationResponse> responseList = manager.authorizeDocids(
        docIds, new SimpleAuthenticationIdentity(username));
    assertEquals(6, responseList.size());
    for (AuthorizationResponse response : responseList) {
      assertTrue(response.getDocid(), response.isValid());
    }
  }
View Full Code Here

    assertEquals(6, docIds.size());

    NotesAuthorizationManager manager =
        (NotesAuthorizationManager) session.getAuthorizationManager();
    Collection<AuthorizationResponse> responseList = manager.authorizeDocids(
        docIds, new SimpleAuthenticationIdentity(username));
    assertEquals(6, responseList.size());
    for (AuthorizationResponse response : responseList) {
      if ("not a doc id".equals(response.getDocid())) {
        assertFalse(response.getDocid(), response.isValid());
      } else {
View Full Code Here

   */
  public void testInvalidUser() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity("not a real username"));
    assertFalse(response.isValid());
  }
View Full Code Here

   */
  public void testValidUser() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity(username, password));
    assertTrue("Failed to authenticate: " + username, response.isValid());
    @SuppressWarnings({ "unchecked", "cast" })
        Collection<Principal> groups = (Collection<Principal>) response.getGroups();
    if (groups != null) {
      String groupPrefix = ((NotesConnectorSession) session)
View Full Code Here

   */
  public void testValidUserGroupResolutionOnly() throws RepositoryException {
    Session session = connector.login();
    AuthenticationManager manager = session.getAuthenticationManager();
    AuthenticationResponse response = manager.authenticate(
        new SimpleAuthenticationIdentity(username, null));
    assertTrue("Authenticated: " + username, response.isValid());
    @SuppressWarnings({ "unchecked", "cast" })
        Collection<Principal> groups = (Collection<Principal>) response.getGroups();
    if (groups != null) {
      String groupPrefix = ((NotesConnectorSession) session)
View Full Code Here

  public void testAuthenticateKnownUser() throws Exception {
    // Validate the first name in the list
    String user = names[0];
    NotesNameMock nameMock = notesNamesCache.get(user);
    AuthenticationResponse response = authenticationManager.authenticate(
        new SimpleAuthenticationIdentity(nameMock.getShortName(),"password"));
    assertTrue(user + " is valid: ", response.isValid());
    testUserGroups(connectorSession, response, user);
  }
View Full Code Here

    }
  }

  public void testAuthenticateUnknownUser() throws Exception {
    AuthenticationResponse response = authenticationManager
        .authenticate(new SimpleAuthenticationIdentity("foo"));
    assertFalse(response.isValid());
  }
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.