manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1543764 - in /manifoldcf/trunk: ./ connectors/sharepoint/ connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/ connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/ c...
Date Wed, 20 Nov 2013 11:02:04 GMT
Author: kwright
Date: Wed Nov 20 11:02:03 2013
New Revision: 1543764

URL: http://svn.apache.org/r1543764
Log:
Pull up changes from CONNECTORS-754-2.  They aren't necessarily done yet, because we don't
yet have someone to confirm they work.  But I am concerned about code drift, and I have little
doubt that the overall structure is right.

Added:
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/
      - copied from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java
      - copied unchanged from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/sharepoint/
      - copied from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/sharepoint/
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/
      - copied from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/
      - copied from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html
      - copied unchanged from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/sharepoint/
      - copied from r1543763, manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/sharepoint/
Removed:
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/CommonsHTTPSender.java
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/sharepoint-client-config.wsdd
Modified:
    manifoldcf/trunk/   (props changed)
    manifoldcf/trunk/build.xml
    manifoldcf/trunk/connectors/sharepoint/   (props changed)
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html
    manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorities/BaseAuthorityConnector.java

Propchange: manifoldcf/trunk/
------------------------------------------------------------------------------
  Merged /manifoldcf/branches/CONNECTORS-754-2:r1535987-1543763
  Merged /manifoldcf/branches/CONNECTORS-754:r1528374-1535986

Modified: manifoldcf/trunk/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/build.xml?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/build.xml (original)
+++ manifoldcf/trunk/build.xml Wed Nov 20 11:02:03 2013
@@ -2426,6 +2426,16 @@
             <param name="connector-label" value="SharePoint"/>
             <param name="connector-class" value="org.apache.manifoldcf.crawler.connectors.sharepoint.SharePointRepository"/>
         </antcall>
+        <antcall target="general-add-authority-connector">
+            <param name="connector-name" value="sharepoint"/>
+            <param name="connector-label" value="SharePoint/ActiveDirectory"/>
+            <param name="connector-class" value="org.apache.manifoldcf.authorities.authorities.sharepoint.SharePointADAuthority"/>
+        </antcall>
+        <antcall target="general-add-authority-connector">
+            <param name="connector-name" value="sharepoint"/>
+            <param name="connector-label" value="SharePoint/Native"/>
+            <param name="connector-class" value="org.apache.manifoldcf.authorities.authorities.sharepoint.SharePointAuthority"/>
+        </antcall>
     </target>
     
     <target name="deliver-sharepoint-connector-doc" depends="calculate-sharepoint-doc-condition"
if="sharepoint-doc.include">

Propchange: manifoldcf/trunk/connectors/sharepoint/
------------------------------------------------------------------------------
  Merged /manifoldcf/branches/CONNECTORS-754-2/connectors/sharepoint:r1535987-1543763
  Merged /manifoldcf/branches/CONNECTORS-754/connectors/sharepoint:r1528374-1535986

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
(original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java
Wed Nov 20 11:02:03 2013
@@ -23,6 +23,8 @@ import java.util.Map;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
 import java.util.regex.*;
 
 import java.io.InputStream;
@@ -67,7 +69,7 @@ import org.w3c.dom.Document;
 public class SPSProxyHelper {
 
 
-  public static final String HTTPCLIENT_PROPERTY = "ManifoldCF_HttpClient";
+  public static final String HTTPCLIENT_PROPERTY = org.apache.manifoldcf.sharepoint.CommonsHTTPSender.HTTPCLIENT_PROPERTY;
 
   private String serverUrl;
   private String serverLocation;
@@ -107,7 +109,7 @@ public class SPSProxyHelper {
   * @return array of sids
   * @throws Exception
   */
-  public String[] getACLs(String site, String guid )
+  public String[] getACLs(String site, String guid, boolean activeDirectoryAuthority )
     throws ManifoldCFException, ServiceInterruption
   {
     long currentTime;
@@ -145,7 +147,7 @@ public class SPSProxyHelper {
       parent = nodeList.get(0);
       nodeList.clear();
       doc.processPath( nodeList, "*", parent );
-      java.util.HashSet sids = new java.util.HashSet();
+      Set<String> sids = new HashSet<String>();
       int i = 0;
       for (; i< nodeList.size(); i++ )
       {
@@ -161,34 +163,33 @@ public class SPSProxyHelper {
           {
             // Use AD user or group
             String userLogin = doc.getValue( node, "UserLogin" );
-            String userSid = getSidForUser( userCall, userLogin );
+            String userSid = getSidForUser( userCall, userLogin, activeDirectoryAuthority
);
             sids.add( userSid );
           }
           else
           {
             // Role
-            String[] roleSids;
+            List<String> roleSids;
             String roleName = doc.getValue( node, "RoleName" );
             if ( roleName.length() == 0)
             {
               roleName = doc.getValue(node,"GroupName");
-              roleSids = getSidsForGroup(userCall, roleName);
+              roleSids = getSidsForGroup(userCall, roleName, activeDirectoryAuthority);
             }
             else
             {
-              roleSids = getSidsForRole(userCall, roleName);
+              roleSids = getSidsForRole(userCall, roleName, activeDirectoryAuthority);
             }
 
-            int j = 0;
-            for (; j < roleSids.length; j++ )
+            for (String sid : roleSids)
             {
-              sids.add( roleSids[ j ] );
+              sids.add( sid );
             }
           }
         }
       }
 
-      return (String[]) sids.toArray( new String[0] );
+      return sids.toArray( new String[0] );
     }
     catch (java.net.MalformedURLException e)
     {
@@ -299,7 +300,7 @@ public class SPSProxyHelper {
   * @throws ManifoldCFException
   * @throws ServiceInterruption
   */
-  public String[] getDocumentACLs(String site, String file)
+  public String[] getDocumentACLs(String site, String file, boolean activeDirectoryAuthority)
     throws ManifoldCFException, ServiceInterruption
   {
     long currentTime;
@@ -356,7 +357,7 @@ public class SPSProxyHelper {
       parent = nodeList.get(0);
       nodeList.clear();
       doc.processPath( nodeList, "*", parent );
-      java.util.HashSet sids = new java.util.HashSet();
+      Set<String> sids = new HashSet<String>();
       int i = 0;
       for (; i< nodeList.size(); i++ )
       {
@@ -372,34 +373,33 @@ public class SPSProxyHelper {
           {
             // Use AD user or group
             String userLogin = doc.getValue( node, "UserLogin" );
-            String userSid = getSidForUser( userCall, userLogin );
+            String userSid = getSidForUser( userCall, userLogin, activeDirectoryAuthority
);
             sids.add( userSid );
           }
           else
           {
             // Role
-            String[] roleSids;
+            List<String> roleSids;
             String roleName = doc.getValue( node, "RoleName" );
             if ( roleName.length() == 0)
             {
               roleName = doc.getValue(node,"GroupName");
-              roleSids = getSidsForGroup(userCall, roleName);
+              roleSids = getSidsForGroup(userCall, roleName, activeDirectoryAuthority);
             }
             else
             {
-              roleSids = getSidsForRole(userCall, roleName);
+              roleSids = getSidsForRole(userCall, roleName, activeDirectoryAuthority);
             }
 
-            int j = 0;
-            for (; j < roleSids.length; j++ )
+            for (String sid : roleSids)
             {
-              sids.add( roleSids[ j ] );
+              sids.add( sid );
             }
           }
         }
       }
 
-      return (String[]) sids.toArray( new String[0] );
+      return sids.toArray( new String[0] );
     }
     catch (java.net.MalformedURLException e)
     {
@@ -1295,36 +1295,48 @@ public class SPSProxyHelper {
   * @return
   * @throws Exception
   */
-  private String getSidForUser(com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap
userCall, String userLogin )
-  throws ManifoldCFException, java.net.MalformedURLException, javax.xml.rpc.ServiceException,
-    java.rmi.RemoteException
+  private String getSidForUser(com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap
userCall, String userLogin,
+    boolean activeDirectoryAuthority)
+    throws ManifoldCFException, java.net.MalformedURLException, javax.xml.rpc.ServiceException,
java.rmi.RemoteException
   {
-    com.microsoft.schemas.sharepoint.soap.directory.GetUserInfoResponseGetUserInfoResult
userResp = userCall.getUserInfo( userLogin );
-    org.apache.axis.message.MessageElement[] userList = userResp.get_any();
-
-    XMLDoc doc = new XMLDoc( userList[0].toString() );
-    ArrayList nodeList = new ArrayList();
-
-    doc.processPath(nodeList, "*", null);
-    if (nodeList.size() != 1)
-    {
-      throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetUserInfo' node - there
are "+Integer.toString(nodeList.size())+" nodes");
+    String rval;
+    
+    if (!activeDirectoryAuthority)
+    {
+      // Do we want to return user ID via getUserInfo?
+      // MHL
+      rval = "U"+userLogin;
     }
-    Object parent = nodeList.get(0);
-    if (!doc.getNodeName(parent).equals("ns1:GetUserInfo"))
-      throw new ManifoldCFException("Bad xml - outer node is not 'ns1:GetUserInfo'");
+    else
+    {
+      com.microsoft.schemas.sharepoint.soap.directory.GetUserInfoResponseGetUserInfoResult
userResp = userCall.getUserInfo( userLogin );
+      org.apache.axis.message.MessageElement[] userList = userResp.get_any();
 
-    nodeList.clear();
-    doc.processPath(nodeList, "*", parent);  // ns1:User
+      if (userList.length != 1)
+        throw new ManifoldCFException("Bad response - expecting one outer 'GetUserInfo' node,
saw "+Integer.toString(userList.length));
+      
+      MessageElement users = userList[0];
+      if (!users.getElementName().getLocalName().equals("GetUserInfo"))
+        throw new ManifoldCFException("Bad response - outer node should have been 'GetUserInfo'
node");
+          
+      String userID = null;
+      
+      Iterator userIter = users.getChildElements();
+      while (userIter.hasNext())
+      {
+        MessageElement child = (MessageElement)userIter.next();
+        if (child.getElementName().getLocalName().equals("User"))
+        {
+          userID = child.getAttribute("Sid");
+        }
+      }
+      
+      if (userID == null)
+        throw new ManifoldCFException("Could not find user login '"+userLogin+"' so could
not get SID");
 
-    if ( nodeList.size() != 1 )
-    {
-      throw new ManifoldCFException( " No User found." );
+      rval = userID;
     }
-    parent = nodeList.get(0);
-    nodeList.clear();
-    String sid = doc.getValue( parent, "Sid" );
-    return sid;
+    return rval;
   }
 
   /**
@@ -1334,46 +1346,49 @@ public class SPSProxyHelper {
   * @return
   * @throws Exception
   */
-  private String[] getSidsForGroup(com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap
userCall, String groupName)
+  private List<String> getSidsForGroup(com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap
userCall, String groupName,
+    boolean activeDirectoryAuthority)
     throws ManifoldCFException, java.net.MalformedURLException, javax.xml.rpc.ServiceException,
java.rmi.RemoteException
   {
-    com.microsoft.schemas.sharepoint.soap.directory.GetUserCollectionFromGroupResponseGetUserCollectionFromGroupResult
roleResp = userCall.getUserCollectionFromGroup(groupName);
-    org.apache.axis.message.MessageElement[] roleList = roleResp.get_any();
-
-    XMLDoc doc = new XMLDoc(roleList[0].toString());
-    ArrayList nodeList = new ArrayList();
-
-    doc.processPath(nodeList, "*", null);
-    if (nodeList.size() != 1)
+    List<String> rval = new ArrayList<String>();
+    if (!activeDirectoryAuthority)
     {
-      throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetUserCollectionFromGroup'
node - there are "
-      + Integer.toString(nodeList.size()) + " nodes");
+      // Do we want to map this to an ID using usergroup.getGroupInfo?  Or will we be unable
to find the group
+      // then if it is an AD group?
+      // MHL
+      rval.add("G"+groupName);
     }
-    Object parent = nodeList.get(0);
-    if (!doc.getNodeName(parent).equals("ns1:GetUserCollectionFromGroup"))
-      throw new ManifoldCFException("Bad xml - outer node is not 'ns1:GetUserCollectionFromGroup'");
+    else
+    {
+      com.microsoft.schemas.sharepoint.soap.directory.GetUserCollectionFromGroupResponseGetUserCollectionFromGroupResult
roleResp = userCall.getUserCollectionFromGroup(groupName);
+      org.apache.axis.message.MessageElement[] roleList = roleResp.get_any();
 
-    nodeList.clear();
-    doc.processPath(nodeList, "*", parent); // <ns1:Users>
+      if (roleList.length != 1)
+        throw new ManifoldCFException("Bad response - expecting one outer 'GetUserCollectionFromGroup'
node, saw "+Integer.toString(roleList.length));
 
-    if (nodeList.size() != 1)
-    {
-      throw new ManifoldCFException(" No Users collection found.");
-    }
-    parent = nodeList.get(0);
-    nodeList.clear();
-    doc.processPath(nodeList, "*", parent); // <ns1:User>
+      MessageElement roles = roleList[0];
+      if (!roles.getElementName().getLocalName().equals("GetUserCollectionFromGroup"))
+        throw new ManifoldCFException("Bad response - outer node should have been 'GetUserCollectionFromGroup'
node");
 
-    ArrayList sidsList = new ArrayList();
-    String[] sids = new String[0];
-    int i = 0;
-    while (i < nodeList.size())
-    {
-      Object o = nodeList.get(i++);
-      sidsList.add(doc.getValue(o, "Sid"));
+      Iterator rolesIter = roles.getChildElements();
+      while (rolesIter.hasNext())
+      {
+        MessageElement child = (MessageElement)rolesIter.next();
+        if (child.getElementName().getLocalName().equals("Users"))
+        {
+          Iterator usersIterator = child.getChildElements();
+          while (usersIterator.hasNext())
+          {
+            MessageElement user = (MessageElement)usersIterator.next();
+            if (user.getElementName().getLocalName().equals("User"))
+            {
+              rval.add(user.getAttribute("Sid"));
+            }
+          }
+        }
+      }      
     }
-    sids = (String[]) sidsList.toArray((Object[]) sids);
-    return sids;
+    return rval;
   }
 
   /**
@@ -1383,47 +1398,48 @@ public class SPSProxyHelper {
   * @return
   * @throws Exception
   */
-  private String[] getSidsForRole( com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap
userCall, String roleName )
-  throws ManifoldCFException, java.net.MalformedURLException, javax.xml.rpc.ServiceException,
-    java.rmi.RemoteException
+  private List<String> getSidsForRole( com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap
userCall, String roleName,
+    boolean activeDirectoryAuthority)
+    throws ManifoldCFException, java.net.MalformedURLException, javax.xml.rpc.ServiceException,
java.rmi.RemoteException
   {
-
-    com.microsoft.schemas.sharepoint.soap.directory.GetUserCollectionFromRoleResponseGetUserCollectionFromRoleResult
roleResp = userCall.getUserCollectionFromRole( roleName );
-    org.apache.axis.message.MessageElement[] roleList = roleResp.get_any();
-
-    XMLDoc doc = new XMLDoc( roleList[0].toString() );
-    ArrayList nodeList = new ArrayList();
-
-    doc.processPath(nodeList, "*", null);
-    if (nodeList.size() != 1)
+    List<String> rval = new ArrayList<String>();
+    if (!activeDirectoryAuthority)
     {
-      throw new ManifoldCFException("Bad xml - missing outer 'ns1:GetUserCollectionFromRole'
node - there are "+Integer.toString(nodeList.size())+" nodes");
+      // Do we want to look up role ID, using usergroup.getRoleInfo?
+      // MHL
+      rval.add("R"+roleName);
     }
-    Object parent = nodeList.get(0);
-    if (!doc.getNodeName(parent).equals("ns1:GetUserCollectionFromRole"))
-      throw new ManifoldCFException("Bad xml - outer node is not 'ns1:GetUserCollectionFromRole'");
+    else
+    {
+      com.microsoft.schemas.sharepoint.soap.directory.GetUserCollectionFromRoleResponseGetUserCollectionFromRoleResult
roleResp = userCall.getUserCollectionFromRole( roleName );
+      org.apache.axis.message.MessageElement[] roleList = roleResp.get_any();
 
-    nodeList.clear();
-    doc.processPath(nodeList, "*", parent);  // <ns1:Users>
+      if (roleList.length != 1)
+        throw new ManifoldCFException("Bad response - expecting one outer 'GetUserCollectionFromRole'
node, saw "+Integer.toString(roleList.length));
 
-    if ( nodeList.size() != 1 )
-    {
-      throw new ManifoldCFException( " No Users collection found." );
-    }
-    parent = nodeList.get(0);
-    nodeList.clear();
-    doc.processPath( nodeList, "*", parent ); // <ns1:User>
+      MessageElement roles = roleList[0];
+      if (!roles.getElementName().getLocalName().equals("GetUserCollectionFromRole"))
+        throw new ManifoldCFException("Bad response - outer node should have been 'GetUserCollectionFromRole'
node");
 
-    ArrayList sidsList = new ArrayList();
-    String[] sids = new String[0];
-    int i = 0;
-    while (i < nodeList.size())
-    {
-      Object o = nodeList.get( i++ );
-      sidsList.add( doc.getValue( o, "Sid" ) );
+      Iterator rolesIter = roles.getChildElements();
+      while (rolesIter.hasNext())
+      {
+        MessageElement child = (MessageElement)rolesIter.next();
+        if (child.getElementName().getLocalName().equals("Users"))
+        {
+          Iterator usersIterator = child.getChildElements();
+          while (usersIterator.hasNext())
+          {
+            MessageElement user = (MessageElement)usersIterator.next();
+            if (user.getElementName().getLocalName().equals("User"))
+            {
+              rval.add(user.getAttribute("Sid"));
+            }
+          }
+        }
+      }      
     }
-    sids = (String[])sidsList.toArray( (Object[])sids );
-    return sids;
+    return rval;
   }
 
   /**

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
(original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
Wed Nov 20 11:02:03 2013
@@ -91,6 +91,7 @@ public class SharePointRepository extend
   private boolean supportsItemSecurity = false;
   private boolean dspStsWorks = true;
   private boolean attachmentsSupported = false;
+  private boolean activeDirectoryAuthority = true;
   
   private String serverProtocol = null;
   private String serverUrl = null;
@@ -154,19 +155,25 @@ public class SharePointRepository extend
   {
     if (proxy == null)
     {
-      String serverVersion = params.getParameter( "serverVersion" );
+      String serverVersion = params.getParameter( SharePointConfig.PARAM_SERVERVERSION );
       if (serverVersion == null)
         serverVersion = "2.0";
       supportsItemSecurity = !serverVersion.equals("2.0");
       dspStsWorks = !serverVersion.equals("4.0");
       attachmentsSupported = !serverVersion.equals("2.0");
+      
+      String authorityType = params.getParameter( SharePointConfig.PARAM_AUTHORITYTYPE );
+      if (authorityType == null)
+        authorityType = "ActiveDirectory";
+      
+      activeDirectoryAuthority = authorityType.equals("ActiveDirectory");
 
-      serverProtocol = params.getParameter( "serverProtocol" );
+      serverProtocol = params.getParameter( SharePointConfig.PARAM_SERVERPROTOCOL );
       if (serverProtocol == null)
         serverProtocol = "http";
       try
       {
-        String serverPort = params.getParameter( "serverPort" );
+        String serverPort = params.getParameter( SharePointConfig.PARAM_SERVERPORT );
         if (serverPort == null || serverPort.length() == 0)
         {
           if (serverProtocol.equals("https"))
@@ -181,7 +188,7 @@ public class SharePointRepository extend
       {
         throw new ManifoldCFException(e.getMessage(),e);
       }
-      serverLocation = params.getParameter("serverLocation");
+      serverLocation = params.getParameter(SharePointConfig.PARAM_SERVERLOCATION);
       if (serverLocation == null)
         serverLocation = "";
       if (serverLocation.endsWith("/"))
@@ -191,8 +198,8 @@ public class SharePointRepository extend
       encodedServerLocation = serverLocation;
       serverLocation = decodePath(serverLocation);
 
-      userName = params.getParameter( "userName" );
-      password = params.getObfuscatedParameter( "password" );
+      userName = params.getParameter(SharePointConfig.PARAM_SERVERUSERNAME);
+      password = params.getObfuscatedParameter(SharePointConfig.PARAM_SERVERPASSWORD);
       int index = userName.indexOf("\\");
       if (index != -1)
       {
@@ -218,7 +225,7 @@ public class SharePointRepository extend
       }
 
       // Set up ssl if indicated
-      keystoreData = params.getParameter( "keystore" );
+      keystoreData = params.getParameter(SharePointConfig.PARAM_SERVERKEYSTORE);
 
       PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager();
       localConnectionManager.setMaxTotal(1);
@@ -264,7 +271,7 @@ public class SharePointRepository extend
       httpClient = localHttpClient;
       
       proxy = new SPSProxyHelper( serverUrl, encodedServerLocation, serverLocation, userName,
password,
-        getClass(), "sharepoint-client-config.wsdd",
+        org.apache.manifoldcf.sharepoint.CommonsHTTPSender.class, "sharepoint-client-config.wsdd",
         httpClient );
       
     }
@@ -313,7 +320,7 @@ public class SharePointRepository extend
   {
     super.connect(configParameters);
     // This is needed by getBins()
-    serverName = configParameters.getParameter( "serverName" );
+    serverName = configParameters.getParameter( SharePointConfig.PARAM_SERVERNAME );
   }
 
   /** Close the connection.  Call this before discarding the repository connector.
@@ -1044,7 +1051,7 @@ public class SharePointRepository extend
                     else
                     {
                       // Security on, is native
-                      accessTokens = proxy.getDocumentACLs( encodedSitePath, encodePath(decodedDocumentPath)
);
+                      accessTokens = proxy.getDocumentACLs( encodedSitePath, encodePath(decodedDocumentPath),
activeDirectoryAuthority );
                       denyTokens = new String[]{defaultAuthorityDenyToken};
                     }
                   }
@@ -1276,7 +1283,7 @@ public class SharePointRepository extend
                 else
                 {
                   // Security enabled, native security
-                  accessTokens = proxy.getACLs( encodedSitePath, listID );
+                  accessTokens = proxy.getACLs( encodedSitePath, listID, activeDirectoryAuthority
);
                   denyTokens = new String[]{defaultAuthorityDenyToken};
                 }
 
@@ -1611,7 +1618,7 @@ public class SharePointRepository extend
                 else
                 {
                   // Security enabled, native security
-                  accessTokens = proxy.getACLs( encodedSitePath, libID );
+                  accessTokens = proxy.getACLs( encodedSitePath, libID, activeDirectoryAuthority
);
                   denyTokens = new String[]{defaultAuthorityDenyToken};
                 }
 
@@ -2311,6 +2318,7 @@ public class SharePointRepository extend
     throws ManifoldCFException, IOException
   {
     tabsArray.add(Messages.getString(locale,"SharePointRepository.Server"));
+    tabsArray.add(Messages.getString(locale,"SharePointRepository.AuthorityType"));
     Messages.outputResourceWithVelocity(out,locale,"editConfiguration.js",null);
   }
   
@@ -2331,7 +2339,9 @@ public class SharePointRepository extend
     Map<String,Object> velocityContext = new HashMap<String,Object>();
     velocityContext.put("TabName",tabName);
     fillInServerTab(velocityContext,out,parameters);
+    fillInAuthorityTypeTab(velocityContext,out,parameters);
     Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Server.html",velocityContext);
+    Messages.outputResourceWithVelocity(out,locale,"editConfiguration_AuthorityType.html",velocityContext);
   }
   
   
@@ -2351,36 +2361,36 @@ public class SharePointRepository extend
   {
     String serverVersion = variableContext.getParameter("serverVersion");
     if (serverVersion != null)
-      parameters.setParameter("serverVersion",serverVersion);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERVERSION,serverVersion);
 
     String serverProtocol = variableContext.getParameter("serverProtocol");
     if (serverProtocol != null)
-      parameters.setParameter("serverProtocol",serverProtocol);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERPROTOCOL,serverProtocol);
 
     String serverName = variableContext.getParameter("serverName");
 
     if (serverName != null)
-      parameters.setParameter("serverName",serverName);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERNAME,serverName);
 
     String serverPort = variableContext.getParameter("serverPort");
     if (serverPort != null)
-      parameters.setParameter("serverPort",serverPort);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERPORT,serverPort);
 
     String serverLocation = variableContext.getParameter("serverLocation");
     if (serverLocation != null)
-      parameters.setParameter("serverLocation",serverLocation);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERLOCATION,serverLocation);
 
     String userName = variableContext.getParameter("userName");
     if (userName != null)
-      parameters.setParameter("userName",userName);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERUSERNAME,userName);
 
     String password = variableContext.getParameter("password");
     if (password != null)
-      parameters.setObfuscatedParameter("password",variableContext.mapKeyToPassword(password));
+      parameters.setObfuscatedParameter(SharePointConfig.PARAM_SERVERPASSWORD,variableContext.mapKeyToPassword(password));
 
     String keystoreValue = variableContext.getParameter("keystoredata");
     if (keystoreValue != null)
-      parameters.setParameter("keystore",keystoreValue);
+      parameters.setParameter(SharePointConfig.PARAM_SERVERKEYSTORE,keystoreValue);
 
     String configOp = variableContext.getParameter("configop");
     if (configOp != null)
@@ -2388,20 +2398,20 @@ public class SharePointRepository extend
       if (configOp.equals("Delete"))
       {
         String alias = variableContext.getParameter("shpkeystorealias");
-        keystoreValue = parameters.getParameter("keystore");
+        keystoreValue = parameters.getParameter(SharePointConfig.PARAM_SERVERKEYSTORE);
         IKeystoreManager mgr;
         if (keystoreValue != null)
           mgr = KeystoreManagerFactory.make("",keystoreValue);
         else
           mgr = KeystoreManagerFactory.make("");
         mgr.remove(alias);
-        parameters.setParameter("keystore",mgr.getString());
+        parameters.setParameter(SharePointConfig.PARAM_SERVERKEYSTORE,mgr.getString());
       }
       else if (configOp.equals("Add"))
       {
         String alias = IDFactory.make(threadContext);
         byte[] certificateValue = variableContext.getBinaryBytes("shpcertificate");
-        keystoreValue = parameters.getParameter("keystore");
+        keystoreValue = parameters.getParameter(SharePointConfig.PARAM_SERVERKEYSTORE);
         IKeystoreManager mgr;
         if (keystoreValue != null)
           mgr = KeystoreManagerFactory.make("",keystoreValue);
@@ -2434,9 +2444,14 @@ public class SharePointRepository extend
           // Redirect to error page
           return "Illegal certificate: "+certError;
         }
-        parameters.setParameter("keystore",mgr.getString());
+        parameters.setParameter(SharePointConfig.PARAM_SERVERKEYSTORE,mgr.getString());
       }
     }
+    
+    String authorityType = variableContext.getParameter("authorityType");
+    if (authorityType != null)
+      parameters.setParameter(SharePointConfig.PARAM_AUTHORITYTYPE,authorityType);
+
     return null;
   }
   
@@ -2454,43 +2469,54 @@ public class SharePointRepository extend
   {
     Map<String,Object> velocityContext = new HashMap<String,Object>();
     fillInServerTab(velocityContext,out,parameters);
+    fillInAuthorityTypeTab(velocityContext,out,parameters);
     Messages.outputResourceWithVelocity(out,locale,"viewConfiguration.html",velocityContext);
   }
+
+  protected static void fillInAuthorityTypeTab(Map<String,Object> velocityContext,
IHTTPOutput out, ConfigParams parameters)
+    throws ManifoldCFException
+  {
+    // Default to Active Directory, for backwards compatibility
+    String authorityType = parameters.getParameter(SharePointConfig.PARAM_AUTHORITYTYPE);
+    if (authorityType == null)
+      authorityType = "ActiveDirectory";
+    velocityContext.put("AUTHORITYTYPE", authorityType);
+  }
   
   protected static void fillInServerTab(Map<String,Object> velocityContext, IHTTPOutput
out, ConfigParams parameters)
     throws ManifoldCFException
   {
-    String serverVersion = parameters.getParameter("serverVersion");
+    String serverVersion = parameters.getParameter(SharePointConfig.PARAM_SERVERVERSION);
     if (serverVersion == null)
       serverVersion = "2.0";
 
-    String serverProtocol = parameters.getParameter("serverProtocol");
+    String serverProtocol = parameters.getParameter(SharePointConfig.PARAM_SERVERPROTOCOL);
     if (serverProtocol == null)
       serverProtocol = "http";
 
-    String serverName = parameters.getParameter("serverName");
+    String serverName = parameters.getParameter(SharePointConfig.PARAM_SERVERNAME);
     if (serverName == null)
       serverName = "localhost";
 
-    String serverPort = parameters.getParameter("serverPort");
+    String serverPort = parameters.getParameter(SharePointConfig.PARAM_SERVERPORT);
     if (serverPort == null)
       serverPort = "";
 
-    String serverLocation = parameters.getParameter("serverLocation");
+    String serverLocation = parameters.getParameter(SharePointConfig.PARAM_SERVERLOCATION);
     if (serverLocation == null)
       serverLocation = "";
       
-    String userName = parameters.getParameter("userName");
+    String userName = parameters.getParameter(SharePointConfig.PARAM_SERVERUSERNAME);
     if (userName == null)
       userName = "";
 
-    String password = parameters.getObfuscatedParameter("password");
+    String password = parameters.getObfuscatedParameter(SharePointConfig.PARAM_SERVERPASSWORD);
     if (password == null)
       password = "";
     else
       password = out.mapPasswordToKey(password);
 
-    String keystore = parameters.getParameter("keystore");
+    String keystore = parameters.getParameter(SharePointConfig.PARAM_SERVERKEYSTORE);
     IKeystoreManager localKeystore;
     if (keystore == null)
       localKeystore = KeystoreManagerFactory.make("");

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties
(original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties
Wed Nov 20 11:02:03 2013
@@ -13,6 +13,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+SharePointRepository.AuthorityTypeColon=Authority type:
+SharePointRepository.SharePoint=SharePoint
+SharePointRepository.ActiveDirectory=Active Directory
+
 SharePointRepository.List=List
 SharePointRepository.AddList=Add List
 SharePointRepository.SelectList=Select list
@@ -26,6 +30,7 @@ SharePointRepository.AddPathMapping=Add 
 SharePointRepository.NoAccessTokensPresent=No access tokens present
 SharePointRepository.NoAccessTokensSpecified=No access tokens specified
 SharePointRepository.Server=Server
+SharePointRepository.AuthorityType=Authority type
 SharePointRepository.Paths=Paths
 SharePointRepository.Security=Security
 SharePointRepository.Metadata=Metadata

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties
(original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties
Wed Nov 20 11:02:03 2013
@@ -13,6 +13,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+SharePointRepository.AuthorityTypeColon=Authority type:
+SharePointRepository.SharePoint=SharePoint
+SharePointRepository.ActiveDirectory=Active Directory
+
 SharePointRepository.List=一覧表
 SharePointRepository.AddList=一覧を追加します
 SharePointRepository.SelectList=一覧を選択
@@ -26,6 +30,7 @@ SharePointRepository.AddPathMapping=Add 
 SharePointRepository.NoAccessTokensPresent=アクセストークンが存在しません
 SharePointRepository.NoAccessTokensSpecified=アクセストークンが未定義です
 SharePointRepository.Server=サーバ
+SharePointRepository.AuthorityType=Authority type
 SharePointRepository.Paths=パス
 SharePointRepository.Security=セキュリティ
 SharePointRepository.Metadata=メタデータ

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html
(original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html
Wed Nov 20 11:02:03 2013
@@ -22,6 +22,7 @@
 #if($TabName == $ResourceBundle.getString('SharePointRepository.Server'))
 
 <table class="displaytable">
+  <tr><td class="separator" colspan="2"><hr/></td></tr>
   <tr>
     <td class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ServerSharePointVersion'))</nobr></td>
     <td class="value">

Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html
(original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html
Wed Nov 20 11:02:03 2013
@@ -19,15 +19,15 @@
   <tr>
     <td class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ServerSharePointVersion'))</nobr></td>
     <td class="value">
-  #if($SERVERVERSION == '2.0')
+#if($SERVERVERSION == '2.0')
         SharePoint Services 2.0 (2003)
-  #elseif($SERVERVERSION == '3.0')
+#elseif($SERVERVERSION == '3.0')
         SharePoint Services 3.0 (2007)
-  #elseif($SERVERVERSION == '4.0')
+#elseif($SERVERVERSION == '4.0')
         SharePoint Services 4.0 (2010)
-  #else
+#else
         Unknown
-  #end
+#end
     </td>
   </tr>
   <tr>
@@ -70,18 +70,33 @@
     <td class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.SSLCertificateList'))</nobr></td>
     <td class="value">
       <table class="displaytable">
-  #if($CERTIFICATELIST.size() == 0)
+#if($CERTIFICATELIST.size() == 0)
         <tr><td class="message" colspan="1">$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.NoCertificatesPresent'))</td></tr>
-  #else
-    #foreach($certificate in $CERTIFICATELIST)
+#else
+  #foreach($certificate in $CERTIFICATELIST)
         <tr>
           <td class="value">
             $Encoder.bodyEscape($certificate.get('DESCRIPTION'))
           </td>
         </tr>
-    #end
   #end
+#end
       </table>
     </td>
   </tr>
+  
+  <tr><td class="separator" colspan="2"><hr/></td></tr>
+
+  <tr>
+    <td class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.AuthorityTypeColon'))</nobr></td>
+    <td class="value">
+#if($AUTHORITYTYPE == 'SharePoint')
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.SharePoint'))</nobr>
+#elseif($AUTHORITYTYPE == 'ActiveDirectory')
+      <nobr>$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ActiveDirectory'))</nobr>
+#else
+      Unknown
+#end
+    </td>
+  </tr>
 </table>

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorities/BaseAuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorities/BaseAuthorityConnector.java?rev=1543764&r1=1543763&r2=1543764&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorities/BaseAuthorityConnector.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authorities/BaseAuthorityConnector.java
Wed Nov 20 11:02:03 2013
@@ -34,6 +34,7 @@ public abstract class BaseAuthorityConne
 {
   public static final String _rcsid = "@(#)$Id: BaseAuthorityConnector.java 988245 2010-08-23
18:39:35Z kwright $";
 
+  // For repositories that have the ability to deny access based on a user's access tokens
   protected static final AuthorizationResponse RESPONSE_UNREACHABLE = new AuthorizationResponse(new
String[]{GLOBAL_DENY_TOKEN},
     AuthorizationResponse.RESPONSE_UNREACHABLE);
   protected static final AuthorizationResponse RESPONSE_USERNOTFOUND = new AuthorizationResponse(new
String[]{GLOBAL_DENY_TOKEN},
@@ -41,6 +42,14 @@ public abstract class BaseAuthorityConne
   protected static final AuthorizationResponse RESPONSE_USERUNAUTHORIZED = new AuthorizationResponse(new
String[]{GLOBAL_DENY_TOKEN},
     AuthorizationResponse.RESPONSE_USERUNAUTHORIZED);
 
+  // For repositories that DO NOT have the ability to deny access based on a user's access
tokens
+  protected static final AuthorizationResponse RESPONSE_UNREACHABLE_ADDITIVE = new AuthorizationResponse(new
String[0],
+    AuthorizationResponse.RESPONSE_UNREACHABLE);
+  protected static final AuthorizationResponse RESPONSE_USERNOTFOUND_ADDITIVE = new AuthorizationResponse(new
String[0],
+    AuthorizationResponse.RESPONSE_USERNOTFOUND);
+  protected static final AuthorizationResponse RESPONSE_USERUNAUTHORIZED_ADDITIVE = new AuthorizationResponse(new
String[0],
+    AuthorizationResponse.RESPONSE_USERUNAUTHORIZED);
+
   /** Obtain the access tokens for a given user name.
   *@param userName is the user name or identifier.
   *@return the response tokens (according to the current authority).



Mime
View raw message