Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8C02B10B9D for ; Sat, 12 Oct 2013 13:10:39 +0000 (UTC) Received: (qmail 25389 invoked by uid 500); 12 Oct 2013 13:10:39 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 25338 invoked by uid 500); 12 Oct 2013 13:10:37 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 25329 invoked by uid 99); 12 Oct 2013 13:10:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Oct 2013 13:10:36 +0000 X-ASF-Spam-Status: No, hits=-1999.6 required=5.0 tests=ALL_TRUSTED,FILL_THIS_FORM_FRAUD_PHISH,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Oct 2013 13:10:29 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E20EC238899C; Sat, 12 Oct 2013 13:10:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1531529 - in /manifoldcf/branches/CONNECTORS-754: ./ connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/ connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connec... Date: Sat, 12 Oct 2013 13:10:06 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131012131006.E20EC238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Sat Oct 12 13:10:05 2013 New Revision: 1531529 URL: http://svn.apache.org/r1531529 Log: More work on SharePoint authority. Added: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java (with props) manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html (with props) Modified: manifoldcf/branches/CONNECTORS-754/build.xml manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointAuthority.java manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointConfig.java manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/sharepoint/editConfiguration_Server.html manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html Modified: manifoldcf/branches/CONNECTORS-754/build.xml URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/build.xml?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/build.xml (original) +++ manifoldcf/branches/CONNECTORS-754/build.xml Sat Oct 12 13:10:05 2013 @@ -2412,6 +2412,11 @@ + + + + + Modified: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointAuthority.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointAuthority.java?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointAuthority.java (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointAuthority.java Sat Oct 12 13:10:05 2013 @@ -102,38 +102,21 @@ public class SharePointAuthority extends // Set up the DC param set, and the rules dCRules = new ArrayList(); dCConnectionParameters = new HashMap(); - // For backwards compatibility, look at old-style parameters - String domainControllerName = params.getParameter(SharePointConfig.PARAM_DOMAINCONTROLLER); - String userName = params.getParameter(SharePointConfig.PARAM_USERNAME); - String password = params.getObfuscatedParameter(SharePointConfig.PARAM_PASSWORD); - String authentication = params.getParameter(SharePointConfig.PARAM_AUTHENTICATION); - String userACLsUsername = params.getParameter(SharePointConfig.PARAM_USERACLsUSERNAME); - if (domainControllerName != null) - { - // Map the old-style parameters into the new-style structures. - dCConnectionParameters.put(domainControllerName,new DCConnectionParameters(userName,password,authentication,userACLsUsername)); - // Create a single rule, too - dCRules.add(new DCRule("",domainControllerName)); - } - else + // Read DC info from the config parameters + for (int i = 0; i < params.getChildCount(); i++) { - // New-style parameters. Read from the config info. - int i = 0; - while (i < params.getChildCount()) + ConfigNode cn = params.getChild(i); + if (cn.getType().equals(SharePointConfig.NODE_DOMAINCONTROLLER)) { - ConfigNode cn = params.getChild(i++); - if (cn.getType().equals(SharePointConfig.NODE_DOMAINCONTROLLER)) - { - // Domain controller name is the actual key... - String dcName = cn.getAttributeValue(SharePointConfig.ATTR_DOMAINCONTROLLER); - // Set up the parameters for the domain controller - dCConnectionParameters.put(dcName,new DCConnectionParameters(cn.getAttributeValue(SharePointConfig.ATTR_USERNAME), - deobfuscate(cn.getAttributeValue(SharePointConfig.ATTR_PASSWORD)), - cn.getAttributeValue(SharePointConfig.ATTR_AUTHENTICATION), - cn.getAttributeValue(SharePointConfig.ATTR_USERACLsUSERNAME))); - // Order-based rule, as well - dCRules.add(new DCRule(cn.getAttributeValue(SharePointConfig.ATTR_SUFFIX),dcName)); - } + // Domain controller name is the actual key... + String dcName = cn.getAttributeValue(SharePointConfig.ATTR_DOMAINCONTROLLER); + // Set up the parameters for the domain controller + dCConnectionParameters.put(dcName,new DCConnectionParameters(cn.getAttributeValue(SharePointConfig.ATTR_USERNAME), + deobfuscate(cn.getAttributeValue(SharePointConfig.ATTR_PASSWORD)), + cn.getAttributeValue(SharePointConfig.ATTR_AUTHENTICATION), + cn.getAttributeValue(SharePointConfig.ATTR_USERACLsUSERNAME))); + // Order-based rule, as well + dCRules.add(new DCRule(cn.getAttributeValue(SharePointConfig.ATTR_SUFFIX),dcName)); } } @@ -461,6 +444,7 @@ public class SharePointAuthority extends throws ManifoldCFException, IOException { tabsArray.add(Messages.getString(locale,"SharePointAuthority.DomainController")); + tabsArray.add(Messages.getString(locale,"SharePointAuthority.Server")); tabsArray.add(Messages.getString(locale,"SharePointAuthority.Cache")); Messages.outputResourceWithVelocity(out,locale,"editConfiguration.js",null); } @@ -482,42 +466,98 @@ public class SharePointAuthority extends velocityContext.put("TabName",tabName); fillInDomainControllerTab(velocityContext,out,parameters); fillInCacheTab(velocityContext,out,parameters); + fillInServerTab(velocityContext,out,parameters); Messages.outputResourceWithVelocity(out,locale,"editConfiguration_DomainController.html",velocityContext); Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Cache.html",velocityContext); + Messages.outputResourceWithVelocity(out,locale,"editConfiguration_Server.html",velocityContext); } + protected static void fillInServerTab(Map velocityContext, IHTTPOutput out, ConfigParams parameters) + throws ManifoldCFException + { + String serverVersion = parameters.getParameter(SharePointConfig.PARAM_SERVERVERSION); + if (serverVersion == null) + serverVersion = "2.0"; + + String serverProtocol = parameters.getParameter(SharePointConfig.PARAM_SERVERPROTOCOL); + if (serverProtocol == null) + serverProtocol = "http"; + + String serverName = parameters.getParameter(SharePointConfig.PARAM_SERVERNAME); + if (serverName == null) + serverName = "localhost"; + + String serverPort = parameters.getParameter(SharePointConfig.PARAM_SERVERPORT); + if (serverPort == null) + serverPort = ""; + + String serverLocation = parameters.getParameter(SharePointConfig.PARAM_SERVERLOCATION); + if (serverLocation == null) + serverLocation = ""; + + String userName = parameters.getParameter(SharePointConfig.PARAM_SERVERUSERNAME); + if (userName == null) + userName = ""; + + String password = parameters.getObfuscatedParameter(SharePointConfig.PARAM_SERVERPASSWORD); + if (password == null) + password = ""; + else + password = out.mapPasswordToKey(password); + + String keystore = parameters.getParameter(SharePointConfig.PARAM_SERVERKEYSTORE); + IKeystoreManager localKeystore; + if (keystore == null) + localKeystore = KeystoreManagerFactory.make(""); + else + localKeystore = KeystoreManagerFactory.make("",keystore); + + List> certificates = new ArrayList>(); + + String[] contents = localKeystore.getContents(); + for (String alias : contents) + { + String description = localKeystore.getDescription(alias); + if (description.length() > 128) + description = description.substring(0,125) + "..."; + Map certificate = new HashMap(); + certificate.put("ALIAS", alias); + certificate.put("DESCRIPTION", description); + certificates.add(certificate); + } + + // Fill in context + velocityContext.put("SERVERVERSION", serverVersion); + velocityContext.put("SERVERPROTOCOL", serverProtocol); + velocityContext.put("SERVERNAME", serverName); + velocityContext.put("SERVERPORT", serverPort); + velocityContext.put("SERVERLOCATION", serverLocation); + velocityContext.put("USERNAME", userName); + velocityContext.put("PASSWORD", password); + if (keystore != null) + velocityContext.put("KEYSTORE", keystore); + velocityContext.put("CERTIFICATELIST", certificates); + + } + protected static void fillInDomainControllerTab(Map velocityContext, IPasswordMapperActivity mapper, ConfigParams parameters) { - String domainControllerName = parameters.getParameter(SharePointConfig.PARAM_DOMAINCONTROLLER); - String userName = parameters.getParameter(SharePointConfig.PARAM_USERNAME); - String password = parameters.getObfuscatedParameter(SharePointConfig.PARAM_PASSWORD); - String authentication = parameters.getParameter(SharePointConfig.PARAM_AUTHENTICATION); - String userACLsUsername = parameters.getParameter(SharePointConfig.PARAM_USERACLsUSERNAME); List> domainControllers = new ArrayList>(); - // Backwards compatibility: if domain controller parameter is set, create an entry in the map. - if (domainControllerName != null) + // Go through nodes looking for DC nodes + for (int i = 0; i < parameters.getChildCount(); i++) { - domainControllers.add(createDomainControllerMap(mapper,"",domainControllerName,userName,password,authentication,userACLsUsername)); - } - else - { - // Go through nodes looking for DC nodes - int i = 0; - while (i < parameters.getChildCount()) + ConfigNode cn = parameters.getChild(i); + if (cn.getType().equals(SharePointConfig.NODE_DOMAINCONTROLLER)) { - ConfigNode cn = parameters.getChild(i++); - if (cn.getType().equals(SharePointConfig.NODE_DOMAINCONTROLLER)) - { - // Grab the info - String dcSuffix = cn.getAttributeValue(SharePointConfig.ATTR_SUFFIX); - String dcDomainController = cn.getAttributeValue(SharePointConfig.ATTR_DOMAINCONTROLLER); - String dcUserName = cn.getAttributeValue(SharePointConfig.ATTR_USERNAME); - String dcPassword = deobfuscate(cn.getAttributeValue(SharePointConfig.ATTR_PASSWORD)); - String dcAuthentication = cn.getAttributeValue(SharePointConfig.ATTR_AUTHENTICATION); - String dcUserACLsUsername = cn.getAttributeValue(SharePointConfig.ATTR_USERACLsUSERNAME); - domainControllers.add(createDomainControllerMap(mapper,dcSuffix,dcDomainController,dcUserName,dcPassword,dcAuthentication,dcUserACLsUsername)); - } + // Grab the info + String dcSuffix = cn.getAttributeValue(SharePointConfig.ATTR_SUFFIX); + String dcDomainController = cn.getAttributeValue(SharePointConfig.ATTR_DOMAINCONTROLLER); + String dcUserName = cn.getAttributeValue(SharePointConfig.ATTR_USERNAME); + String dcPassword = deobfuscate(cn.getAttributeValue(SharePointConfig.ATTR_PASSWORD)); + String dcAuthentication = cn.getAttributeValue(SharePointConfig.ATTR_AUTHENTICATION); + String dcUserACLsUsername = cn.getAttributeValue(SharePointConfig.ATTR_USERACLsUSERNAME); + domainControllers.add(createDomainControllerMap(mapper,dcSuffix,dcDomainController,dcUserName,dcPassword,dcAuthentication,dcUserACLsUsername)); } } velocityContext.put("DOMAINCONTROLLERS",domainControllers); @@ -570,12 +610,6 @@ public class SharePointAuthority extends String x = variableContext.getParameter("dcrecord_count"); if (x != null) { - // Delete old stuff - parameters.setParameter(SharePointConfig.PARAM_DOMAINCONTROLLER,null); - parameters.setParameter(SharePointConfig.PARAM_USERNAME,null); - parameters.setParameter(SharePointConfig.PARAM_PASSWORD,null); - parameters.setParameter(SharePointConfig.PARAM_AUTHENTICATION,null); - parameters.setParameter(SharePointConfig.PARAM_USERACLsUSERNAME,null); // Delete old nodes int i = 0; while (i < parameters.getChildCount()) @@ -633,6 +667,8 @@ public class SharePointAuthority extends variableContext.getParameter("dcrecord_userACLsUsername")); } } + + // Cache parameters String cacheLifetime = variableContext.getParameter("cachelifetime"); if (cacheLifetime != null) @@ -641,6 +677,96 @@ public class SharePointAuthority extends if (cacheLRUsize != null) parameters.setParameter(SharePointConfig.PARAM_CACHELRUSIZE,cacheLRUsize); + // SharePoint server parameters + + String serverVersion = variableContext.getParameter("serverVersion"); + if (serverVersion != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERVERSION,serverVersion); + + String serverProtocol = variableContext.getParameter("serverProtocol"); + if (serverProtocol != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERPROTOCOL,serverProtocol); + + String serverName = variableContext.getParameter("serverName"); + + if (serverName != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERNAME,serverName); + + String serverPort = variableContext.getParameter("serverPort"); + if (serverPort != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERPORT,serverPort); + + String serverLocation = variableContext.getParameter("serverLocation"); + if (serverLocation != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERLOCATION,serverLocation); + + String userName = variableContext.getParameter("userName"); + if (userName != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERUSERNAME,userName); + + String password = variableContext.getParameter("password"); + if (password != null) + parameters.setObfuscatedParameter(SharePointConfig.PARAM_SERVERPASSWORD,variableContext.mapKeyToPassword(password)); + + String keystoreValue = variableContext.getParameter("keystoredata"); + if (keystoreValue != null) + parameters.setParameter(SharePointConfig.PARAM_SERVERKEYSTORE,keystoreValue); + + String configOp = variableContext.getParameter("configop"); + if (configOp != null) + { + if (configOp.equals("Delete")) + { + String alias = variableContext.getParameter("shpkeystorealias"); + keystoreValue = parameters.getParameter(SharePointConfig.PARAM_SERVERKEYSTORE); + IKeystoreManager mgr; + if (keystoreValue != null) + mgr = KeystoreManagerFactory.make("",keystoreValue); + else + mgr = KeystoreManagerFactory.make(""); + mgr.remove(alias); + 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(SharePointConfig.PARAM_SERVERKEYSTORE); + IKeystoreManager mgr; + if (keystoreValue != null) + mgr = KeystoreManagerFactory.make("",keystoreValue); + else + mgr = KeystoreManagerFactory.make(""); + java.io.InputStream is = new java.io.ByteArrayInputStream(certificateValue); + String certError = null; + try + { + mgr.importCertificate(alias,is); + } + catch (Throwable e) + { + certError = e.getMessage(); + } + finally + { + try + { + is.close(); + } + catch (IOException e) + { + // Don't report anything + } + } + + if (certError != null) + { + // Redirect to error page + return "Illegal certificate: "+certError; + } + parameters.setParameter(SharePointConfig.PARAM_SERVERKEYSTORE,mgr.getString()); + } + } return null; } @@ -677,6 +803,7 @@ public class SharePointAuthority extends Map velocityContext = new HashMap(); fillInDomainControllerTab(velocityContext,out,parameters); fillInCacheTab(velocityContext,out,parameters); + fillInServerTab(velocityContext,out,parameters); Messages.outputResourceWithVelocity(out,locale,"viewConfiguration.html",velocityContext); } Modified: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointConfig.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointConfig.java?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointConfig.java (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/sharepoint/SharePointConfig.java Sat Oct 12 13:10:05 2013 @@ -19,7 +19,7 @@ package org.apache.manifoldcf.authorities.authorities.sharepoint; -/** Parameters and output data for Active Directory authority. +/** Parameters and output data for SharePoint authority. */ public class SharePointConfig { @@ -27,21 +27,30 @@ public class SharePointConfig // Configuration parameters - /** Domain controller */ - public static final String PARAM_DOMAINCONTROLLER = "Domain controller"; - /** Administrative user name */ - public static final String PARAM_USERNAME = "User name"; - /** Administrative password */ - public static final String PARAM_PASSWORD = "Password"; - /** Authentication */ - public static final String PARAM_AUTHENTICATION = "Authentication"; - /** UserACLs username attribute */ - public static final String PARAM_USERACLsUSERNAME = "UserACLs username attribute"; /** Cache lifetime */ public static final String PARAM_CACHELIFETIME = "Cache lifetime"; /** Cache LRU size */ public static final String PARAM_CACHELRUSIZE = "Cache LRU size"; + /** SharePoint server version */ + public static final String PARAM_SERVERVERSION = "serverVersion"; + /** SharePoint server protocol */ + public static final String PARAM_SERVERPROTOCOL = "serverProtocol"; + /** SharePoint server name */ + public static final String PARAM_SERVERNAME = "serverName"; + /** SharePoint server port */ + public static final String PARAM_SERVERPORT = "serverPort"; + /** SharePoint server location */ + public static final String PARAM_SERVERLOCATION = "serverLocation"; + /** SharePoint server user name */ + public static final String PARAM_SERVERUSERNAME = "userName"; + /** SharePoint server password */ + public static final String PARAM_SERVERPASSWORD = "password"; + /** SharePoint server certificate store */ + public static final String PARAM_SERVERKEYSTORE = "keystore"; + + // Nodes + /** Domain controller node */ public static final String NODE_DOMAINCONTROLLER = "domaincontroller"; Added: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java?rev=1531529&view=auto ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java (added) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java Sat Oct 12 13:10:05 2013 @@ -0,0 +1,49 @@ +/* $Id$ */ + +/** +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.apache.manifoldcf.crawler.connectors.sharepoint; + + +/** Parameters and output data for SharePoint repository. +*/ +public class SharePointConfig +{ + public static final String _rcsid = "@(#)$Id$"; + + // Configuration parameters + + /** SharePoint server version */ + public static final String PARAM_SERVERVERSION = "serverVersion"; + /** SharePoint server protocol */ + public static final String PARAM_SERVERPROTOCOL = "serverProtocol"; + /** SharePoint server name */ + public static final String PARAM_SERVERNAME = "serverName"; + /** SharePoint server port */ + public static final String PARAM_SERVERPORT = "serverPort"; + /** SharePoint server location */ + public static final String PARAM_SERVERLOCATION = "serverLocation"; + /** SharePoint server user name */ + public static final String PARAM_SERVERUSERNAME = "userName"; + /** SharePoint server password */ + public static final String PARAM_SERVERPASSWORD = "password"; + /** SharePoint server certificate store */ + public static final String PARAM_SERVERKEYSTORE = "keystore"; + + /** Authority type */ + public static final String PARAM_AUTHORITYTYPE = "authorityType"; +} Propchange: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointConfig.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java Sat Oct 12 13:10:05 2013 @@ -144,19 +144,19 @@ 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"); - 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")) @@ -171,7 +171,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("/")) @@ -181,8 +181,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) { @@ -208,7 +208,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); @@ -2296,6 +2296,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); } @@ -2316,7 +2317,9 @@ public class SharePointRepository extend Map velocityContext = new HashMap(); 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); } @@ -2336,36 +2339,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) @@ -2373,20 +2376,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); @@ -2419,9 +2422,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; } @@ -2439,43 +2447,54 @@ public class SharePointRepository extend { Map velocityContext = new HashMap(); fillInServerTab(velocityContext,out,parameters); + fillInAuthorityTypeTab(velocityContext,out,parameters); Messages.outputResourceWithVelocity(out,locale,"viewConfiguration.html",velocityContext); } + + protected static void fillInAuthorityTypeTab(Map 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 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/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_en_US.properties Sat Oct 12 13:10:05 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/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/native2ascii/org/apache/manifoldcf/crawler/connectors/sharepoint/common_ja_JP.properties Sat Oct 12 13:10:05 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/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/sharepoint/editConfiguration_Server.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/sharepoint/editConfiguration_Server.html?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/sharepoint/editConfiguration_Server.html (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/authorities/authorities/sharepoint/editConfiguration_Server.html Sat Oct 12 13:10:05 2013 @@ -22,6 +22,7 @@ #if($TabName == $ResourceBundle.getString('SharePointAuthority.Server')) +

$Encoder.bodyEscape($ResourceBundle.getString('SharePointAuthority.ServerSharePointVersion')) Added: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html?rev=1531529&view=auto ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html (added) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html Sat Oct 12 13:10:05 2013 @@ -0,0 +1,43 @@ + + +#if($TabName == $ResourceBundle.getString('SharePointRepository.AuthorityType')) + + + + + + + +

$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.AuthorityTypeColon')) + #if($AUTHORITYTYPE == 'SharePoint') + $Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.SharePoint')) + #else + $Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.SharePoint')) + #end + #if($AUTHORITYTYPE == 'ActiveDirectory') + $Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ActiveDirectory')) + #else + $Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ActiveDirectory')) + #end +
+ +#else + + + +#end Propchange: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_AuthorityType.html ------------------------------------------------------------------------------ svn:keywords = Id Modified: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/editConfiguration_Server.html Sat Oct 12 13:10:05 2013 @@ -22,6 +22,7 @@ #if($TabName == $ResourceBundle.getString('SharePointRepository.Server')) + @@ -70,18 +70,33 @@ + + + + + + +

$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ServerSharePointVersion')) Modified: manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html?rev=1531529&r1=1531528&r2=1531529&view=diff ============================================================================== --- manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html (original) +++ manifoldcf/branches/CONNECTORS-754/connectors/sharepoint/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/sharepoint/viewConfiguration.html Sat Oct 12 13:10:05 2013 @@ -19,15 +19,15 @@
$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ServerSharePointVersion')) - #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
$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.SSLCertificateList')) - #if($CERTIFICATELIST.size() == 0) +#if($CERTIFICATELIST.size() == 0) - #else - #foreach($certificate in $CERTIFICATELIST) +#else + #foreach($certificate in $CERTIFICATELIST) - #end #end +#end
$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.NoCertificatesPresent'))
$Encoder.bodyEscape($certificate.get('DESCRIPTION'))

$Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.AuthorityTypeColon')) +#if($AUTHORITYTYPE == 'SharePoint') + $Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.SharePoint')) +#elseif($AUTHORITYTYPE == 'ActiveDirectory') + $Encoder.bodyEscape($ResourceBundle.getString('SharePointRepository.ActiveDirectory')) +#else + Unknown +#end +