Author: vkumar
Date: Wed Dec 17 08:44:34 2008
New Revision: 727432

URL: http://svn.apache.org/viewvc?rev=727432&view=rev
Log:
Allowing users to configure there entry-prefix for users authentication

Modified:
    
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/LdapAuthenticationProvider.java
    
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ldap/LdapContextProxy.java
    
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml
    
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties

Modified: 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/LdapAuthenticationProvider.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/LdapAuthenticationProvider.java?rev=727432&r1=727431&r2=727432&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/LdapAuthenticationProvider.java
 (original)
+++ 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/LdapAuthenticationProvider.java
 Wed Dec 17 08:44:34 2008
@@ -181,11 +181,11 @@
         String query = "";
         if (StringUtils.isEmpty(getSearchSuffix()))
         {
-            query = "(" + getEntryPrefix() + "=" + 
(StringUtils.isEmpty(filter) ? "*" : filter) + ")";
+            query = "(" + context.getEntryPrefix() + "=" + 
(StringUtils.isEmpty(filter) ? "*" : filter) + ")";
         }
         else
         {
-            query = "(&(" + getEntryPrefix() + "=" + 
(StringUtils.isEmpty(filter) ? "*" : filter) + ")" + getSearchSuffix() + ")";
+            query = "(&(" + context.getEntryPrefix() + "=" + 
(StringUtils.isEmpty(filter) ? "*" : filter) + ")" + getSearchSuffix() + ")";
         }
         // logger.debug("searchByWildCardedUid = " + query);
         
cons.setSearchScope(Integer.parseInt(context.getMemberShipSearchScope()));
@@ -216,11 +216,6 @@
         return context.getUserFilter();
     }
 
-    private String getEntryPrefix()
-    {
-        return "cn";
-    }
-
     private String getSearchDomain()
     {
         StringBuffer searchDomain = new StringBuffer();

Modified: 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ldap/LdapContextProxy.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ldap/LdapContextProxy.java?rev=727432&r1=727431&r2=727432&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ldap/LdapContextProxy.java
 (original)
+++ 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/ldap/LdapContextProxy.java
 Wed Dec 17 08:44:34 2008
@@ -43,8 +43,9 @@
     private String userFilter;
     private String memberShipSearchScope;
     private String userSearchBase;
+    private String entryPrefix;
 
-    public LdapContextProxy(LdapContextSource context, String factory, String 
userFilter, String memberShipSearchScope,String userSearchBase)
+    public LdapContextProxy(LdapContextSource context, String factory, String 
userFilter, String memberShipSearchScope,String userSearchBase,String 
entryPrefix)
     {
         springContext = context;
         env = new Properties();
@@ -57,6 +58,7 @@
         this.userFilter = userFilter;
         this.memberShipSearchScope = memberShipSearchScope;
         this.userSearchBase = userSearchBase;
+        this.entryPrefix = entryPrefix;
     }
 
     public LdapContext getCtx() throws NamingException
@@ -165,4 +167,8 @@
     {
         return memberShipSearchScope;
     }
+    public String getEntryPrefix()
+    {
+       return entryPrefix;
+    }
 }

Modified: 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml?rev=727432&r1=727431&r2=727432&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml
 (original)
+++ 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/assembly/security-ldap.xml
 Wed Dec 17 08:44:34 2008
@@ -340,5 +340,8 @@
     <constructor-arg index="4">
                <value>${ldap.user.searchBase}</value>
     </constructor-arg>     
+    <constructor-arg index="5">
+               <value>${ldap.user.entryPrefix}</value>
+    </constructor-arg>     
   </bean>
 </beans>

Modified: 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties?rev=727432&r1=727431&r2=727432&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
 (original)
+++ 
portals/jetspeed-2/portal/branches/JETSPEED-2.2-PRE-PLUTO-2-SNAPSHOT/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
 Wed Dec 17 08:44:34 2008
@@ -298,6 +298,7 @@
 ldap.user.filter = (objectclass=person)
 ldap.search.scope = 2
 ldap.user.searchBase=
+ldap.user.entryPrefix=uid
 ldap.role.searchBase=ou=Roles,o=Jetspeed
 ldap.group.searchBase=ou=Groups,o=Jetspeed
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to