Package com.google.enterprise.connector.spi

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


    // Mark Authorization Response status PERMIT for authorized documents.
    for (String docId : authorizedDocIdList) {
      String encodedDocId = docIdMap.get(docId);
      if (encodedDocId != null) {
        encodedDocuments.add(new AuthorizationResponse(Status.PERMIT,
            encodedDocId));
        logMessage.append(encodedDocId + ", ");
        docIdMap.remove(docId);
      }
    }
    logMessage.append(" and not authorized for document ID: ");

    // Mark Authorization Response status DENY for non-authorized documents.
    Set<String> docIdKeys = docIdMap.keySet();
    for (String docId : docIdKeys) {
      String encodedDocId = docIdMap.get(docId);
      if (encodedDocId != null) {
        encodedDocuments.add(new AuthorizationResponse(Status.DENY,
            encodedDocId));
        logMessage.append(encodedDocId + ", ");
      }
    }
    LOG.info(logMessage.toString());
View Full Code Here


          // Normal behavior if the user does not have privileges for this item.
          readPrivilege = false;
        } catch (javax.jcr.RepositoryException e) {
          throw new RepositoryException(e);
        }
        AuthorizationResponse response =
            new AuthorizationResponse(readPrivilege, uuid);
        result.add(response);
      }
      return result;
    } finally {
      userSession.logout();
View Full Code Here

  public static class SimpleAuthorizationManager implements AuthorizationManager {
    public Collection<AuthorizationResponse> authorizeDocids(
        Collection<String> col, AuthenticationIdentity id) {
      List<AuthorizationResponse> l = new ArrayList<AuthorizationResponse>();
      for (String docId : col) {
        l.add(new AuthorizationResponse(Boolean.TRUE, docId));
      }
      return l;
    }
View Full Code Here

    }

    // Connector1 returns same response for every doc.
    if (CONNECTOR1.equals(connectorName)) {
      for (String docid : docidList) {
        results.add(new AuthorizationResponse(permit, docid));
      }
    }

    // Connector2 returns indeterminate every other doc.
    if (CONNECTOR2.equals(connectorName)) {
      boolean odd = false;
      Status status = (permit) ? Status.PERMIT : Status.DENY;
      for (String docid : docidList) {
        results.add(new AuthorizationResponse(
            ((odd) ? Status.INDETERMINATE : status), docid));
        odd = !odd;
      }
    }

    // Connector3 strictly returns permits, but only every other doc.
    if (CONNECTOR3.equals(connectorName)) {
      if (permit) {
        for (String docid : docidList) {
          if (permit) {
            results.add(new AuthorizationResponse(permit, docid));
          }
          permit = !permit;
        }
      }
    }
View Full Code Here

    public Collection<AuthorizationResponse> authorizeDocids(
        Collection<String> docids, AuthenticationIdentity identity) {
      HashSet<AuthorizationResponse> response =
          new HashSet<AuthorizationResponse>();
      for (String docid : docids) {
        response.add(new AuthorizationResponse(true, docid));
      }
      return response;
    }
View Full Code Here

TOP

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

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.