incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r930975 - in /incubator/lcf/trunk/modules: ./ connectors/activedirectory/ connectors/activedirectory/connector/ connectors/activedirectory/connector/org/ connectors/activedirectory/connector/org/apache/ connectors/activedirectory/connector/...
Date Mon, 05 Apr 2010 22:50:42 GMT
Author: kwright
Date: Mon Apr  5 22:50:41 2010
New Revision: 930975

URL: http://svn.apache.org/viewvc?rev=930975&view=rev
Log:
Add first cut of Active Directory authority.

Added:
    incubator/lcf/trunk/modules/connectors/activedirectory/
    incubator/lcf/trunk/modules/connectors/activedirectory/build.xml   (with props)
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java
  (with props)
    incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java
  (with props)
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp
  (with props)
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp
  (with props)
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp
  (with props)
    incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp
  (with props)
Modified:
    incubator/lcf/trunk/modules/build.xml

Modified: incubator/lcf/trunk/modules/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/build.xml?rev=930975&r1=930974&r2=930975&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/build.xml (original)
+++ incubator/lcf/trunk/modules/build.xml Mon Apr  5 22:50:41 2010
@@ -5,6 +5,9 @@
         <delete dir="dist"/>
         <ant dir="framework" target="clean"/>
         <delete dir="framework/lib"/>
+        <ant dir="connectors/activedirectory" target="clean"/>
+        <delete dir="connectors/activedirectory/lib"/>
+        <delete dir="connectors/activedirectory/war"/>
         <ant dir="connectors/documentum" target="clean"/>
         <delete dir="connectors/documentum/lib"/>
         <delete dir="connectors/documentum/war"/>
@@ -79,6 +82,21 @@
         <ant dir="framework"/>
     </target>
 
+    <target name="build-activedirectory-connector" depends="build-framework">
+        <mkdir dir="connectors/activedirectory/lib"/>
+        <mkdir dir="connectors/activedirectory/war"/>
+        <copy todir="connectors/activedirectory/lib">
+            <fileset dir="framework/lib"/>
+        </copy>
+        <copy todir="connectors/activedirectory/lib">
+            <fileset dir="framework/build/jar"/>
+        </copy>
+        <copy todir="connectors/activedirectory/war">
+            <fileset dir="framework/dist/web"/>
+        </copy>
+        <ant dir="connectors/activedirectory"/>
+    </target>
+    
     <target name="build-documentum-connector" depends="build-framework">
         <mkdir dir="connectors/documentum/lib"/>
         <mkdir dir="connectors/documentum/war"/>
@@ -322,7 +340,29 @@
         <mkdir dir="build/authority-service"/>
         <unwar src="framework/dist/web/lcf-authority-service.war" dest="build/authority-service"/>
     </target>
-    
+
+    <target name="calculate-activedirectory-condition" depends="build-activedirectory-connector">
+        <available file="connectors/activedirectory/dist" type="dir" property="activedirectory.exists"/>
+        <condition property="activedirectory.include">
+            <isset property="activedirectory.exists"/>
+        </condition>
+    </target>
+
+    <target name="deliver-activedirectory-connector" depends="calculate-activedirectory-condition"
if="activedirectory.include">
+        <mkdir dir="dist/processes"/>
+        <copy todir="dist/processes">
+            <fileset dir="connectors/activedirectory/dist/processes"/>
+        </copy>
+        <mkdir dir="dist/web"/>
+        <copy todir="dist/web">
+            <fileset dir="connectors/activedirectory/dist/web" excludes="*.iar"/>
+        </copy>
+        <mkdir dir="build/crawler-ui"/>
+        <unjar src="connectors/activedirectory/dist/web/lcf-activedirectoryconnector-crawler-ui.iar"
dest="build/crawler-ui"/>
+        <mkdir dir="build/authority-service"/>
+        <unjar src="connectors/activedirectory/dist/web/lcf-activedirectoryconnector-authority-service.iar"
dest="build/authority-service"/>
+    </target>
+
     <target name="calculate-documentum-condition" depends="build-documentum-connector">
         <available file="connectors/documentum/dist" type="dir" property="documentum.exists"/>
         <condition property="documentum.include">
@@ -635,13 +675,13 @@
         <unjar src="connectors/webcrawler/dist/web/lcf-webconnector-crawler-ui.iar" dest="build/crawler-ui"/>
     </target>
 
-    <target name="deliver-wars" depends="deliver-framework,deliver-documentum-connector,deliver-filenet-connector,deliver-filesystem-connector,deliver-gts-connector,deliver-livelink-connector,deliver-solr-connector,deliver-memex-connector,deliver-meridio-connector,deliver-nulloutput-connector,deliver-rss-connector,deliver-sharepoint-connector,deliver-webcrawler-connector">
+    <target name="deliver-wars" depends="deliver-framework,deliver-activedirectory-connector,deliver-documentum-connector,deliver-filenet-connector,deliver-filesystem-connector,deliver-gts-connector,deliver-livelink-connector,deliver-solr-connector,deliver-memex-connector,deliver-meridio-connector,deliver-nulloutput-connector,deliver-rss-connector,deliver-sharepoint-connector,deliver-webcrawler-connector">
         <mkdir dir="dist/web"/>
         <jar destfile="dist/web/lcf-crawler-ui.war" basedir="build/crawler-ui"/>
         <jar destfile="dist/web/lcf-authority-service.war" basedir="build/authority-service"/>
     </target>
 
-    <target name="deliver-open-connectors" depends="deliver-filesystem-connector,deliver-rss-connector,deliver-webcrawler-connector,deliver-jdbc-connector"/>
+    <target name="deliver-open-connectors" depends="deliver-activedirectory-connector,deliver-filesystem-connector,deliver-rss-connector,deliver-webcrawler-connector,deliver-jdbc-connector"/>
     
     <target name="deliver-output-connectors" depends="deliver-gts-connector,deliver-solr-connector,deliver-nulloutput-connector"/>
     

Added: incubator/lcf/trunk/modules/connectors/activedirectory/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/build.xml?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/build.xml (added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/build.xml Mon Apr  5 22:50:41 2010
@@ -0,0 +1,123 @@
+<project default="all">
+
+    <target name="clean">
+        <delete dir="build"/>
+        <delete dir="dist"/>
+        <delete dir="doc"/>
+    </target>
+
+    <target name="doc">
+        <mkdir dir="doc"/>
+        <javadoc destdir="doc" source="1.4">
+            <classpath>
+                <fileset dir="lib" includes="*.jar"/>
+            </classpath>
+            <fileset dir="connector" includes="**/*.java"/>
+        </javadoc>
+    </target>
+
+    <target name="compile-connector">
+        <mkdir dir="build/connector/classes"/>
+        <javac srcdir="connector" destdir="build/connector/classes" target="1.5" source="1.4">
+            <classpath>
+                <fileset dir="lib" includes="*.jar"/>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="compile-crawler-ui" depends="compile-connector">
+        <!-- Unpack the crawler war -->
+        <mkdir dir="build/crawler-ui-war"/>
+        <unwar src="war/lcf-crawler-ui.war" dest="build/crawler-ui-war"/>
+        <!-- Create a copy of everything in the proper environment -->
+        <mkdir dir="build/jsp-environment/WEB-INF/lib"/>
+        <mkdir dir="build/jsp-environment/WEB-INF/jsp"/>
+        <copy todir="build/jsp-environment/WEB-INF" file="build/crawler-ui-war/WEB-INF/web.xml"/>
+        <copy todir="build/jsp-environment" file="build/crawler-ui-war/adminHeaders.jsp"/>
+        <copy todir="build/jsp-environment" file="build/crawler-ui-war/adminDefaults.jsp"/>
+        <copy todir="build/jsp-environment" file="build/crawler-ui-war/error.jsp"/>
+        <copy todir="build/jsp-environment" file="build/crawler-ui-war/checkAdminLogin.jsp"/>
+
+        <copy todir="build/jsp-environment">
+            <fileset dir="crawler-ui" includes="**/*.jsp,**/*.css,**/*.png,**/*.html"/>
+        </copy>
+        <copy todir="build/jsp-environment/WEB-INF/lib">
+            <fileset dir="build/crawler-ui-war/WEB-INF/lib">
+                <include name="*.jar"/>
+            </fileset>
+        </copy>
+        <copy todir="build/jsp-environment/WEB-INF/jsp">
+            <fileset dir="build/crawler-ui-war/WEB-INF/jsp">
+                <include name="*.tld"/>
+            </fileset>
+        </copy>
+        <copy todir="build/jsp-environment/WEB-INF/classes">
+            <fileset dir="build/connector/classes"/>
+        </copy>
+        <!-- Compile to java, as a check -->
+        <mkdir dir="build/crawler-ui/java"/>
+        <!-- Define the jsp compilation task using web libraries -->
+        <taskdef classname="org.apache.jasper.JspC" name="jasper2" > 
+            <classpath id="jspc.classpath"> 
+                <pathelement location="${java.home}/../lib/tools.jar"/>
+                <fileset dir="lib"> 
+                    <include name="*.jar"/> 
+                </fileset> 
+                <pathelement location="build/crawler-ui-war/WEB-INF/lib/jstl.jar"/>
+                <pathelement location="build/crawler-ui-war/WEB-INF/lib/standard.jar"/>
+                <pathelement location="build/connector/classes"/>
+            </classpath> 
+        </taskdef> 
+        <jasper2 validateXml="false" uriroot="build/jsp-environment" webXmlFragment="build/jsp-environment/WEB-INF/web-generated.xml"
outputDir="build/crawler-ui/java" /> 
+        <!-- Compile java classes -->
+        <mkdir dir="build/crawler-ui/classes"/>
+        <javac srcdir="build/crawler-ui/java" destdir="build/crawler-ui/classes" target="1.5"
source="1.4">
+            <classpath id="classpath">
+                <pathelement location="${java.home}/../lib/tools.jar"/>
+                <fileset dir="lib"> 
+                    <include name="*.jar"/> 
+                </fileset>
+                <pathelement location="build/crawler-ui-war/WEB-INF/lib/jstl.jar"/>
+                <pathelement location="build/crawler-ui-war/WEB-INF/lib/standard.jar"/>
+                <pathelement location="build/connector/classes"/>
+            </classpath>
+        </javac>
+    </target>
+    
+    <target name="jar-connector" depends="compile-connector">
+        <mkdir dir="build/jar"/>
+        <jar destfile="build/jar/lcf-activedirectory-connector.jar" basedir="build/connector/classes"/>
+    </target>
+
+    <target name="webapp-crawler-ui" depends="compile-crawler-ui,jar-connector">
+        <mkdir dir="build/webapp/crawler-ui/WEB-INF/lib"/>
+        <copy todir="build/webapp/crawler-ui/WEB-INF/lib" file="build/jar/lcf-activedirectory-connector.jar"/>
+        <mkdir dir="build/webapp/crawler-ui"/>
+        <copy todir="build/webapp/crawler-ui">
+            <fileset dir="crawler-ui" includes="**/*.jsp,**/*.css,**/*.png,**/*.html"/>
+        </copy>
+    </target>
+
+    <target name="webapp-authority-service" depends="jar-connector">
+        <mkdir dir="build/webapp/authority-service/WEB-INF/lib"/>
+        <copy todir="build/webapp/authority-service/WEB-INF/lib" file="build/jar/lcf-activedirectory-connector.jar"/>
+    </target>
+
+    <target name="iar-crawler-ui" depends="webapp-crawler-ui">
+        <mkdir dir="dist/web"/>
+        <jar destfile="dist/web/lcf-activedirectoryconnector-crawler-ui.iar" basedir="build/webapp/crawler-ui"/>
+    </target>
+
+    <target name="iar-authority-service" depends="webapp-authority-service">
+        <mkdir dir="dist/web"/>
+        <jar destfile="dist/web/lcf-activedirectoryconnector-authority-service.iar" basedir="build/webapp/authority-service"/>
+    </target>
+
+    <target name="processes" depends="jar-connector">
+        <mkdir dir="dist/processes"/>
+        <copy todir="dist/processes" file="build/jar/lcf-activedirectory-connector.jar"/>
+    </target>
+
+    <target name="all" depends="processes,iar-crawler-ui,iar-authority-service,doc"/>
+    
+</project>

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/build.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java
(added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java
Mon Apr  5 22:50:41 2010
@@ -0,0 +1,322 @@
+/* $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.lcf.authorities.activedirectory;
+
+import org.apache.lcf.core.interfaces.*;
+import org.apache.lcf.agents.interfaces.*;
+import org.apache.lcf.authorities.interfaces.*;
+import org.apache.lcf.authorities.system.Logging;
+import org.apache.lcf.authorities.system.LCF;
+
+import java.io.*;
+import java.util.*;
+import javax.naming.*;
+import javax.naming.ldap.*;
+import javax.naming.directory.*;
+
+
+/** This is the Active Directory implementation of the IAuthorityConnector interface.
+* Access tokens for this connector are simple SIDs, except for the "global deny" token, which
+* is designed to allow the authority to shut off access to all authorized documents when
the
+* user is unrecognized or the domain controller does not respond.
+*/
+public class ActiveDirectoryAuthority extends org.apache.lcf.authorities.authorities.BaseAuthorityConnector
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  // Data from the parameters
+  private String domainControllerName = null;
+  private String userName = null;
+  private String password = null;
+
+  /** The initialized LDAP context (which functions as a session) */
+  private LdapContext ctx = null;
+  
+  /** This is the active directory global deny token.  This should be ingested with all documents.
*/
+  private static final String globalDenyToken = "DEAD_AUTHORITY";
+  
+  private static final AuthorizationResponse unreachableResponse = new AuthorizationResponse(new
String[]{globalDenyToken},
+    AuthorizationResponse.RESPONSE_UNREACHABLE);
+  private static final AuthorizationResponse userNotFoundResponse = new AuthorizationResponse(new
String[]{globalDenyToken},
+    AuthorizationResponse.RESPONSE_USERNOTFOUND);
+
+  /** Constructor.
+  */
+  public ActiveDirectoryAuthority()
+  {
+  }
+
+  /** Return the path for the UI interface JSP elements.
+  * These JSP's must be provided to allow the connector to be configured, and to
+  * permit it to present document filtering specification information in the UI.
+  * This method should return the name of the folder, under the <webapp>/connectors/
+  * area, where the appropriate JSP's can be found.  The name should NOT have a slash in
it.
+  *@return the folder part
+  */
+  public String getJSPFolder()
+  {
+    return "activedirectory";
+  }
+
+  /** Connect.  The configuration parameters are included.
+  *@param configParams are the configuration parameters for this connection.
+  */
+  public void connect(ConfigParams configParams)
+  {
+    super.connect(configParams);
+
+    // First, create server object (llServer)
+    domainControllerName = configParams.getParameter(ActiveDirectoryConfig.PARAM_DOMAINCONTROLLER);
+    userName = configParams.getParameter(ActiveDirectoryConfig.PARAM_USERNAME);
+    password = configParams.getObfuscatedParameter(ActiveDirectoryConfig.PARAM_PASSWORD);
+  }
+
+  // All methods below this line will ONLY be called if a connect() call succeeded
+  // on this instance!
+
+  /** Check connection for sanity.
+  */
+  public String check()
+    throws LCFException
+  {
+    String message = getSession();
+    if (message != null)
+      return "Domain controller unreachable: "+message;
+    return super.check();
+  }
+
+  /** Close the connection.  Call this before discarding the repository connector.
+  */
+  public void disconnect()
+    throws LCFException
+  {
+    try
+    {
+      ctx.close();
+    }
+    catch (NamingException e)
+    {
+      // Eat this error
+    }
+    ctx = null;
+    domainControllerName = null;
+    userName = null;
+    password = null;
+    super.disconnect();
+  }
+
+  /** 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).
+  * (Should throws an exception only when a condition cannot be properly described within
the authorization response object.)
+  */
+  public AuthorizationResponse getAuthorizationResponse(String userName)
+    throws LCFException
+  {
+    String message = getSession();
+    if (message != null)
+      return unreachableResponse;
+
+    //Create the search controls 		
+    SearchControls searchCtls = new SearchControls();
+
+    //Specify the search scope, must be base level search for tokenGroups
+    searchCtls.setSearchScope(SearchControls.OBJECT_SCOPE);
+ 
+    //specify the LDAP search filter
+    String searchFilter = "(objectClass=user)";
+		
+    //Specify the Base for the search
+    String searchBase = parseUser(userName);
+ 
+    //Specify the attributes to return
+    String returnedAtts[] = {"tokenGroups"};
+    searchCtls.setReturningAttributes(returnedAtts);
+
+    try
+    {
+      //Search for objects using the filter
+      NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
+
+      ArrayList theGroups = new ArrayList();
+
+      //Loop through the search results
+      while (answer.hasMoreElements())
+      {
+        SearchResult sr = (SearchResult)answer.next();
+ 
+        //the sr.GetName should be null, as it is relative to the base object
+        
+        Attributes attrs = sr.getAttributes();
+        if (attrs != null)
+        {
+          try
+          {
+            for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) 
+            {
+              Attribute attr = (Attribute)ae.next();
+              for (NamingEnumeration e = attr.getAll();e.hasMore();)
+              {
+                theGroups.add(sid2String((byte[])e.next()));
+              }
+            }
+ 
+          }	 
+          catch (NamingException e)
+          {
+            throw new LCFException(e.getMessage(),e);
+          }
+				
+        }
+      }
+      
+      String[] tokens = new String[theGroups.size()];
+      int k = 0;
+      while (k < tokens.length)
+      {
+        tokens[k] = (String)theGroups.get(k);
+        k++;
+      }
+      
+      return new AuthorizationResponse(tokens,AuthorizationResponse.RESPONSE_OK);
+
+    }
+    catch (NameNotFoundException e)
+    {
+      // This means that the user doesn't exist
+      return userNotFoundResponse;
+    }
+    catch (NamingException e)
+    {
+      // Unreachable
+      return unreachableResponse;
+    }
+  }
+
+  /** Obtain the default access tokens for a given user name.
+  *@param userName is the user name or identifier.
+  *@return the default response tokens, presuming that the connect method fails.
+  */
+  public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
+  {
+    // The default response if the getConnection method fails
+    return unreachableResponse;
+  }
+
+  // Protected methods
+  
+  protected String getSession()
+    throws LCFException
+  {
+    if (ctx == null)
+    {
+      // Calculate the ldap url first
+      String ldapURL = "ldap://" + domainControllerName + ":389";
+      
+      Hashtable env = new Hashtable();
+      env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
+      env.put(Context.SECURITY_AUTHENTICATION,"DIGEST-MD5 GSSAPI");
+      env.put(Context.SECURITY_PRINCIPAL,userName);
+      env.put(Context.SECURITY_CREDENTIALS,password);
+				
+      //connect to my domain controller
+      env.put(Context.PROVIDER_URL,ldapURL);
+		
+      //specify attributes to be returned in binary format
+      env.put("java.naming.ldap.attributes.binary","tokenGroups");
+ 
+      // Now, try the connection...
+      try
+      {
+        ctx = new InitialLdapContext(env,null);
+      }
+      catch (AuthenticationException e)
+      {
+        // This means we couldn't authenticate!
+        throw new LCFException("Authentication problem authenticating admin user '"+userName+"':
"+e.getMessage(),e);
+      }
+      catch (NamingException e)
+      {
+        // This means we couldn't connect, most likely
+        return e.getMessage();
+      }
+    }
+    return null;
+  }
+  
+  /** Parse a user name into an ldap search base. */
+  protected static String parseUser(String userName)
+    throws LCFException
+  {
+    //String searchBase = "CN=Administrator,CN=Users,DC=qa-ad-76,DC=metacarta,DC=com";
+    int index = userName.indexOf("@");
+    if (index == -1)
+      throw new LCFException("Username is in unexpected form (no @): '"+userName+"'");
+    String userPart = userName.substring(0,index);
+    String domainPart = userName.substring(index+1);
+    // Start the search base assembly
+    StringBuffer sb = new StringBuffer();
+    sb.append("CN=").append(userPart).append(",CN=Users");
+    int j = 0;
+    while (true)
+    {
+      int k = domainPart.indexOf(".",j);
+      if (k == -1)
+      {
+        sb.append(",DC=").append(domainPart.substring(j));
+        break;
+      }
+      sb.append(",DC=").append(domainPart.substring(j,k));
+      j = k+1;
+    }
+    return sb.toString();
+  }
+
+  /** Convert a binary SID to a string */
+  protected static String sid2String(byte[] SID)
+  {
+    StringBuffer strSID = new StringBuffer("S");
+    long version = SID[0];
+    strSID.append("-").append(Long.toString(version));
+    long authority = SID[4];
+    for (int i = 0;i<4;i++)
+    {
+      authority <<= 8;
+      authority += SID[4+i] & 0xFF;
+    }
+    strSID.append("-").append(Long.toString(authority));
+    long count = SID[2];
+    count <<= 8;
+    count += SID[1] & 0xFF;
+    for (int j=0;j<count;j++)
+    {
+      long rid = SID[11 + (j*4)] & 0xFF;
+      for (int k=1;k<4;k++)
+      {
+        rid <<= 8;
+        rid += SID[11-k + (j*4)] & 0xFF;
+      }
+      strSID.append("-").append(Long.toString(rid));
+    }
+    return strSID.toString();
+  }
+
+}
+
+

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryAuthority.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java
(added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java
Mon Apr  5 22:50:41 2010
@@ -0,0 +1,38 @@
+/* $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.lcf.authorities.activedirectory;
+
+
+/** Parameters and output data for MetaCarta GTS output connector.
+*/
+public class ActiveDirectoryConfig
+{
+  public static final String _rcsid = "@(#)$Id$";
+
+  // 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";
+
+
+}

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/connector/org/apache/lcf/authorities/activedirectory/ActiveDirectoryConfig.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp
(added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp
Mon Apr  5 22:50:41 2010
@@ -0,0 +1,80 @@
+<%@ include file="../../adminDefaults.jsp" %>
+
+<%
+
+/* $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.
+*/
+%>
+
+<%
+	// This file is included by every place that the configuration information for the livelink
connector
+	// needs to be edited.  When it is called, the parameter Map object is placed in the thread
context
+	// under the name "Parameters".
+
+	// The coder can presume that this jsp is executed within a body section, and within a form.
+
+	ConfigParams parameters = (ConfigParams)threadContext.get("Parameters");
+	String tabName = (String)threadContext.get("TabName");
+
+	if (parameters == null)
+		out.println("No parameter map!!!");
+	if (tabName == null)
+		out.println("No tab name!");
+
+	String domainControllerName = parameters.getParameter(org.apache.lcf.authorities.activedirectory.ActiveDirectoryConfig.PARAM_DOMAINCONTROLLER);
+	if (domainControllerName == null)
+		domainControllerName = "";
+	String userName = parameters.getParameter(org.apache.lcf.authorities.activedirectory.ActiveDirectoryConfig.PARAM_USERNAME);
+	if (userName == null)
+		userName = "";
+	String password = parameters.getObfuscatedParameter(org.apache.lcf.authorities.activedirectory.ActiveDirectoryConfig.PARAM_PASSWORD);
+	if (password == null)
+		password = "";
+
+	// The "Domain Controller" tab
+	if (tabName.equals("Domain Controller"))
+	{
+%>
+<table class="displaytable">
+	<tr><td class="separator" colspan="2"><hr/></td></tr>
+	<tr>
+		<td class="description"><nobr>Domain controller name:</nobr></td>
+		<td class="value"><input type="text" size="64" name="domaincontrollername" value='<%=org.apache.lcf.ui.util.Encoder.attributeEscape(domainControllerName)%>'/></td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>Administrative user name:</nobr></td>
+		<td class="value"><input type="text" size="32" name="username" value='<%=org.apache.lcf.ui.util.Encoder.attributeEscape(userName)%>'/></td>
+	</tr>
+	<tr>
+		<td class="description"><nobr>Administrative password:</nobr></td>
+		<td class="value"><input type="password" size="32" name="password" value='<%=org.apache.lcf.ui.util.Encoder.attributeEscape(password)%>'/></td>
+	</tr>
+</table>
+<%
+	}
+	else
+	{
+		// Hiddens for Domain Controller tab
+%>
+<input type="hidden" name="domaincontrollername" value='<%=org.apache.lcf.ui.util.Encoder.attributeEscape(domainControllerName)%>'/>
+<input type="hidden" name="username" value='<%=org.apache.lcf.ui.util.Encoder.attributeEscape(userName)%>'/>
+<input type="hidden" name="password" value='<%=org.apache.lcf.ui.util.Encoder.attributeEscape(password)%>'/>
+<%
+	}
+%>

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/editconfig.jsp
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp
(added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp
Mon Apr  5 22:50:41 2010
@@ -0,0 +1,80 @@
+<%@ include file="../../adminDefaults.jsp" %>
+
+<%
+
+/* $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.
+*/
+%>
+
+<%
+	// This file is included in the head section by every place that the configuration information
for the file system connector
+	// needs to be edited.  When it is called, the parameter Map object is placed in the thread
context
+	// under the name "Parameters".
+
+	// The coder can presume that this jsp is executed within a head section.  The purpose would
be to provide javascript
+	// functions needed by the editconfig.jsp for this connector.
+	//
+	// The method checkConfigOnSave() is called prior to the form being submitted for save.
 It should return false if the
+	// form should not be submitted.
+
+	ConfigParams parameters = (ConfigParams)threadContext.get("Parameters");
+	ArrayList tabsArray = (ArrayList)threadContext.get("Tabs");
+	String tabName = (String)threadContext.get("TabName");
+%>
+
+<%
+	if (parameters == null)
+		out.println("No parameters!!!");
+	if (tabsArray == null)
+		out.println("No tabs array!");
+	if (tabName == null)
+		out.println("No tab name!");
+
+	tabsArray.add("Domain Controller");
+%>
+
+<script type="text/javascript">
+<!--
+	function checkConfig()
+	{
+		return true;
+	}
+
+	function checkConfigForSave()
+	{
+		if (editconnection.domaincontrollername.value == "")
+		{
+			alert("Enter a domain controller server name");
+			SelectTab("Domain Controller");
+			editconnection.domaincontrollername.focus();
+			return false;
+		}
+		if (editconnection.username.value == "")
+		{
+			alert("Administrative user name cannot be null");
+			SelectTab("Domain Controller");
+			editconnection.username.focus();
+			return false;
+		}
+		return true;
+	}
+
+//-->
+</script>
+

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/headerconfig.jsp
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp
(added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp
Mon Apr  5 22:50:41 2010
@@ -0,0 +1,48 @@
+<%@ include file="../../adminDefaults.jsp" %>
+
+<%
+
+/* $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.
+*/
+%>
+
+<%
+	// This file is included by every place that edited specification information for the livelink
connector
+	// is posted upon submit.  When it is called, the Map parameters object is placed in the
thread context
+	// under the name "Parameters".  This map should be edited by this code.
+
+	// The coder cannot presume that this jsp is executed within a body section.  Errors should
thus be
+	// forwarded to "error.jsp" using <jsp:forward>.
+	// Arguments from the original request object for the post page will remain available for
access.
+
+	ConfigParams parameters = (ConfigParams)threadContext.get("Parameters");
+
+	if (parameters == null)
+		System.out.println("No parameter map!!!");
+
+	String domainControllerName = variableContext.getParameter("domaincontrollername");
+	if (domainControllerName != null)
+		parameters.setParameter(org.apache.lcf.authorities.activedirectory.ActiveDirectoryConfig.PARAM_DOMAINCONTROLLER,domainControllerName);
+	String userName = variableContext.getParameter("username");
+	if (userName != null)
+		parameters.setParameter(org.apache.lcf.authorities.activedirectory.ActiveDirectoryConfig.PARAM_USERNAME,userName);
+	String password = variableContext.getParameter("password");
+	if (password != null)
+		parameters.setObfuscatedParameter(org.apache.lcf.authorities.activedirectory.ActiveDirectoryConfig.PARAM_PASSWORD,password);
+%>

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/postconfig.jsp
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp?rev=930975&view=auto
==============================================================================
--- incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp
(added)
+++ incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp
Mon Apr  5 22:50:41 2010
@@ -0,0 +1,73 @@
+<%@ include file="../../adminDefaults.jsp" %>
+
+<%
+
+/* $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.
+*/
+%>
+
+<%
+	// This file is included by every place that the configuration information for the connector
+	// needs to be viewed.  When it is called, the Parameters object is placed in the thread
context
+	// under the name "Parameters".
+
+	// The coder can presume that this jsp is executed within a body section.
+
+	ConfigParams parameters = (ConfigParams)threadContext.get("Parameters");
+%>
+
+<%
+	if (parameters == null)
+		out.println("Hey!  No parameters came in!!!");
+%>
+<table class="displaytable">
+	<tr>
+		<td class="description" colspan="1"><nobr>Parameters:</nobr></td>
+		<td class="value" colspan="3">
+<%
+		Iterator iter = parameters.listParameters();
+		while (iter.hasNext())
+		{
+			String param = (String)iter.next();
+			String value = parameters.getParameter(param);
+			if (param.length() >= "password".length() && param.substring(param.length()-"password".length()).equalsIgnoreCase("password"))
+			{
+%>
+			<nobr><%=org.apache.lcf.ui.util.Encoder.bodyEscape(param)+"=********"%></nobr><br/>
+<%
+			}
+			else if (param.length() >="keystore".length() && param.substring(param.length()-"keystore".length()).equalsIgnoreCase("keystore"))
+			{
+				IKeystoreManager kmanager = KeystoreManagerFactory.make("",value);
+%>
+			<nobr><%=org.apache.lcf.ui.util.Encoder.bodyEscape(param)+"=<"+Integer.toString(kmanager.getContents().length)+"
certificate(s)>"%></nobr><br/>
+<%
+			}
+			else
+			{
+%>
+			<nobr><%=org.apache.lcf.ui.util.Encoder.bodyEscape(param)+"="+org.apache.lcf.ui.util.Encoder.bodyEscape(value)%></nobr><br/>
+<%
+			}
+		}
+%>
+
+		</td>
+	</tr>
+</table>

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/modules/connectors/activedirectory/crawler-ui/authorities/activedirectory/viewconfig.jsp
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message