Author: bdaw
Date: 2007-02-12 22:52:54 -0500 (Mon, 12 Feb 2007)
New Revision: 6242
Added:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
trunk/identity/src/resources/test/config/extuser/
trunk/identity/src/resources/test/config/extuser/opends-config.xml
trunk/test/src/etc/directories-extusermodule.xml
Modified:
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
Log:
- ext implementation of LDAP user module
- ext implementation of LDAP role module
- change ldap role impl to use DN as an id
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2007-02-13 03:37:46 UTC (rev 6241)
+++ trunk/identity/build.xml 2007-02-13 03:52:54 UTC (rev 6242)
@@ -394,6 +394,7 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
</x-test>
@@ -457,6 +458,7 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
</x-test>
<x-classpath>
<pathelement
location="${build.lib}/portal-identity-lib.jar"/>
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -70,9 +70,10 @@
public static final String USER_EMAIL_ATTRIBUTE_ID = "emailAttributeID";
- //TODO:
- public static final String USER_BASE_FILTER = "userBaseFilter";
+ public static final String USER_SEARCH_CTX_DN = "userSearchCtxDN";
+ public static final String USER_SEARCH_FILTER = "userSearchFilter";
+
public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
@@ -83,7 +84,7 @@
public static final String ROLE_RECURSION = "roleRecursion";
//TODO:
- public static final String ROLE_BASE_FILTER = "roleBaseFilter";
+ public static final String ROLE_SEARCH_FILTER = "roleSearchFilter";
//TODO:
public static final String ROLE_CONTEXT_DN = "rolesCtxDN";
@@ -93,10 +94,10 @@
public static final String MEMBERSHIP_ATTRIBUTE_IS_DN =
"membershipAttributeIsDN";
- //TODO:
+ //TODO: check if this is applied to every search in modules
public static final String SEARCH_TIME_LIMIT = "searchTimeLimit";
- //TODO:
+ //TODO: check if this is applied to role searches in role and membership modules
public static final String SEARCH_SCOPE = "searchScope";
Modified:
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -24,8 +24,18 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.Role;
+import org.jboss.portal.common.util.Tools;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.DirContext;
import java.util.Set;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.HashSet;
+import java.util.Iterator;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
@@ -33,25 +43,90 @@
*/
public class LDAPExtRoleModuleImpl extends LDAPRoleModuleImpl
{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPExtRoleModuleImpl.class);
public Role findRoleByName(String name) throws IdentityException,
IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ log.debug("findRoleByName(): name = " + name);
+
+ if (name == null)
+ {
+ throw new IdentityException("Role name canot be null");
+ }
+
+
+ String filter = getRoleSearchFilter();
+ log.debug("Search filter: " + filter);
+
+
+ Object[] filterArgs = {name};
+ NamingEnumeration results = searchRoles(filter, filterArgs);
+ List sr = Tools.toList(results);
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one role with id: " +
name + "" +
+ "Posible data inconsistency");
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ DirContext ctx = (DirContext)res.getObject();
+ return createRoleInstance(res.getAttributes(),ctx.getNameInNamespace());
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No role found with name: " + name, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ throw new IdentityException("No role found with name: " + name);
}
public Set findRolesByNames(String[] names) throws IdentityException,
IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
- }
+ if (names == null)
+ {
+ throw new IllegalArgumentException("null argument");
+ }
- public Role findRoleById(Object id) throws IdentityException,
IllegalArgumentException
- {
- throw new UnsupportedOperationException("Not yet implemented");
- }
+ Set roles = new HashSet();
- public Role findRoleById(String id) throws IdentityException,
IllegalArgumentException
- {
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ //construct a filter with all role names
+ StringBuffer filter = new StringBuffer("(| ");
+
+ String searchFilter = getRoleSearchFilter();
+
+ for (int i = 0; i < names.length; i++)
+ {
+ String name = names[i];
+
+ String namedFilter = searchFilter.replaceAll("\\{0\\}", name);
+ filter.append(namedFilter);
+ }
+ filter.append(")");
+
+ NamingEnumeration results = searchRoles(filter.toString(), null);
+ List sr = Tools.toList(results);
+ log.debug("Roles found: " + sr.size());
+ for (Iterator iterator = sr.iterator(); iterator.hasNext();)
+ {
+ SearchResult res = (SearchResult)iterator.next();
+ DirContext ctx = (DirContext)res.getObject();
+ roles.add(createRoleInstance(res.getAttributes(),ctx.getNameInNamespace()));
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Can't retreive roles", e);
+ }
+
+ return roles;
+
}
public Role createRole(String name, String displayName) throws IdentityException,
IllegalArgumentException
@@ -66,11 +141,93 @@
public int getRolesCount() throws IdentityException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ //search all entries
+ String filter = getRoleSearchFilter();
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ log.debug("Search filter: " + filter);
+
+ NamingEnumeration results = searchRoles(filter, null);
+ List sr = Tools.toList(results);
+
+ return sr.size();
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No roles found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ return 0;
}
public Set findRoles() throws IdentityException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ Set rf = new HashSet();
+ try
+ {
+ //search all entries
+ String filter = getRoleSearchFilter();
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ log.debug("Search filter: " + filter);
+
+ NamingEnumeration results = searchRoles(filter, null);
+ while (results.hasMoreElements())
+ {
+ SearchResult res = (SearchResult)results.nextElement();
+ DirContext ctx = (DirContext)res.getObject();
+ rf.add(createRoleInstance(res.getAttributes(),ctx.getNameInNamespace()));
+ }
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No roles found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ return rf;
}
+
+ /**
+ * This method should be used by over modules to perform searches. It will allow user
module
+ * implementation to apply proper filter and search scope from the configuration
+ *
+ * @param filter that will be concatenated with proper user search filter from the
module
+ * @return
+ */
+ public NamingEnumeration searchRoles(String filter, Object[] filterArgs) throws
NamingException, IdentityException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope(getSearchScope());
+ controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getSearchTimeLimit());
+
+ log.debug("Search filter: " + filter);
+ if (log.isDebugEnabled() && filterArgs != null)
+ {
+ for (int i = 0; i < filterArgs.length; i++)
+ {
+ Object filterArg = filterArgs[i];
+ log.debug("Search filterArg: {" + i + "}: " +
filterArg);
+ }
+ }
+ log.debug("Search ctx: " + getRoleCtxDN());
+
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getRoleCtxDN(),
filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getRoleCtxDN(),
filter, filterArgs, controls);
+ }
+ }
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -25,8 +25,18 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
+import org.jboss.portal.common.util.Tools;
+import javax.naming.NamingEnumeration;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.SearchResult;
+import javax.naming.directory.SearchControls;
import java.util.Set;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.HashSet;
+import java.util.Collections;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
@@ -34,20 +44,56 @@
*/
public class LDAPExtUserModuleImpl extends LDAPUserModuleImpl
{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPExtUserModuleImpl.class);
public User findUserByUserName(String userName) throws IdentityException,
IllegalArgumentException, NoSuchUserException
{
- throw new UnsupportedOperationException("Not yet implemented");
- }
+ try
+ {
+ log.debug("findUserByUserName(): username = " + userName);
- public User findUserById(Object id) throws IdentityException,
IllegalArgumentException, NoSuchUserException
- {
- throw new UnsupportedOperationException("Not yet implemented");
+ if (userName == null)
+ {
+ throw new IdentityException("User name canot be null");
+ }
+
+ String filter = getUserSearchFilter();
+ log.debug("Search filter: " + filter);
+
+ Object[] filterArgs = {userName};
+ NamingEnumeration results = searchUsers(filter, filterArgs);
+ List sr = Tools.toList(results);
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one user with id: " +
userName + "" +
+ "Posible data inconsistency");
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ Context ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ return createUserInstance(res.getAttributes(), dn);
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No user found with name: " + userName, e);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ throw new NoSuchUserException("No user found with name: " + userName);
}
- public User findUserById(String id) throws IdentityException,
IllegalArgumentException, NoSuchUserException
+ //findUserById(Object id) from super
+
+
+ //findUserById(String id) from super
+
+ public User createUser(String userName, String password) throws IdentityException,
IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ throw new UnsupportedOperationException("User management is not supported in
this implementation of UserModule");
}
public User createUser(String userName, String password, String realEmail) throws
IdentityException, IllegalArgumentException
@@ -60,18 +106,126 @@
throw new UnsupportedOperationException("User management is not supported in
this implementation of UserModule");
}
+
+ //TODO: offset limit
public Set findUsers(int offset, int limit) throws IdentityException,
IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ return findUsersFilteredByUserName("*", offset, limit);
}
public Set findUsersFilteredByUserName(String filter, int offset, int limit) throws
IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ Set uf = new HashSet();
+ try
+ {
+ log.debug("findUserFilteredByUserName(): filter = " + filter);
+
+ if (filter == null)
+ {
+ throw new IllegalArgumentException("Null user name filter");
+ }
+
+ log.info("Current implementation of findUsersFilteredByUserName returns all
users and is not \"offset\" and \"limit\" sensitive ");
+
+ if (filter.length() == 0)
+ {
+ filter = "*";
+ }
+ else if (!(filter.length() == 1 && filter.equals("*")))
+ {
+ filter = "*" + filter + "*";
+ }
+
+ String ldap_filter = getUserSearchFilter();
+
+ //* chars are escaped in filterArgs so we must replace it manually
+ ldap_filter = ldap_filter.replaceAll("\\{0\\}", filter);
+ log.debug("Search filter: " + ldap_filter);
+
+ //Object[] filterArgs = {filter};
+ NamingEnumeration results = searchUsers(ldap_filter, null);
+ while (results.hasMoreElements())
+ {
+ SearchResult res = (SearchResult)results.nextElement();
+ Context ctx = (Context)res.getObject();
+ String dn = ctx.getNameInNamespace();
+ uf.add(createUserInstance(res.getAttributes(), dn));
+ }
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No user found using filter: " + filter, e);
+
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ return uf;
}
public int getUserCount() throws IdentityException, IllegalArgumentException
{
- throw new UnsupportedOperationException("Not yet implemented");
+ try
+ {
+ //search all entries containing "uid" attribute
+ String filter = getUserSearchFilter();
+ log.debug("Search filter: " + filter);
+
+ //* chars are escaped in filterArgs so we must replace it manually
+ filter = filter.replaceAll("\\{0\\}", "*");
+ NamingEnumeration results = searchUsers(filter, null);
+ List sr = Tools.toList(results);
+
+ return sr.size();
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No users found", e);
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("User search failed.", e);
+ }
+ return 0;
}
+
+
+
+
+ /**
+ * This method should be used by over modules to perform searches. It will allow user
module
+ * implementation to apply proper filter and search scope from the configuration
+ *
+ * @param filter that will be concatenated with proper user search filter from the
module
+ * @return
+ */
+ public NamingEnumeration searchUsers(String filter, Object[] filterArgs) throws
NamingException, IdentityException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+ controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getSearchTimeLimit());
+
+ log.debug("Search filter: " + filter);
+ if (log.isDebugEnabled() && filterArgs != null)
+ {
+ for (int i = 0; i < filterArgs.length; i++)
+ {
+ Object filterArg = filterArgs[i];
+ log.debug("Search filterArg: {" + i + "}: " +
filterArg);
+ }
+ }
+ log.debug("Search ctx: " + getUserSearchCtxDN());
+
+ if (filterArgs == null)
+ {
+ return
getConnectionContext().createInitialContext().search(getUserSearchCtxDN(), filter,
controls);
+ }
+ else
+ {
+ return
getConnectionContext().createInitialContext().search(getUserSearchCtxDN(), filter,
filterArgs, controls);
+ }
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -38,6 +38,8 @@
private String dn;
+ private String name;
+
private String id;
private String displayName;
@@ -49,7 +51,7 @@
}
- protected LDAPRoleImpl(String dn, IdentityContext context, String id, String display)
+ protected LDAPRoleImpl(String dn, IdentityContext context, String id, String name,
String displayName)
{
if (dn == null)
{
@@ -67,20 +69,26 @@
throw new IllegalArgumentException("Id can't be null");
}
- if (display == null)
+ if (name == null)
{
- throw new IllegalArgumentException("displayName can't be null");
+ throw new IllegalArgumentException("Name can't be null");
}
+ if (displayName == null)
+ {
+ throw new IllegalArgumentException("DisplayName can't be null");
+ }
+
this.identityContext = context;
this.id = id;
- this.displayName = display;
+ this.name = name;
+ this.displayName = displayName;
this.dn = dn;
}
public String getName()
{
- return this.id;
+ return this.name;
}
public String getDisplayName()
@@ -88,6 +96,7 @@
return displayName;
}
+ //TODO: testcase this
public void setDisplayName(String name)
{
if (name == null)
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2007-02-13
03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -31,6 +31,7 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
import javax.naming.InitialContext;
@@ -103,7 +104,8 @@
{
throw new IdentityException("LDAP entry doesn't contain proper
attribute:" + getDisplayNameAttributeID());
}
- ldapr = new LDAPRoleImpl(dn, getIdentityContext(), uida.get().toString(),
display.get().toString());
+ ldapr = new LDAPRoleImpl(dn, getIdentityContext(), dn, uida.get().toString(),
display.get().toString());
+ //ldapr.setDisplayName(display.get().toString());
@@ -139,7 +141,7 @@
if (attrs == null)
{
- throw new IdentityException("Can't find user entry with DN: " +
dn);
+ throw new IdentityException("Can't find role entry with DN: " +
dn);
}
return createRoleInstance(attrs, dn);
@@ -147,11 +149,11 @@
}
catch (NoSuchElementException e)
{
- log.debug("No user found with dn: " + dn, e);
+ log.debug("No role found with dn: " + dn, e);
}
catch (NamingException e)
{
- throw new IdentityException("User search failed.", e);
+ throw new IdentityException("Role search failed.", e);
}
return null;
}
@@ -163,7 +165,7 @@
* @param filter that will be concatenated with proper role search filter from the
module
* @return
*/
- public abstract NamingEnumeration searchRoles(String filter) throws NamingException,
IdentityException;
+ public abstract NamingEnumeration searchRoles(String filter, Object[] filterArgs)
throws NamingException, IdentityException;
//**************************
//*** Getter and Setters
@@ -209,6 +211,80 @@
return display;
}
+ protected int getSearchTimeLimit() throws IdentityException
+ {
+ int searchTimeout = 10000;
+ String limit =
getIdentityConfiguration().getValue(IdentityConfiguration.SEARCH_TIME_LIMIT);
+ if (limit != null)
+ {
+ try
+ {
+ searchTimeout = Integer.parseInt(limit);
+ }
+ catch (NumberFormatException e)
+ {
+ log.info(IdentityConfiguration.SEARCH_TIME_LIMIT + "wrong value:" +
e);
+ }
+ }
+ return searchTimeout;
+ }
+
+ protected int getSearchScope() throws IdentityException
+ {
+ int searchScope = SearchControls.ONELEVEL_SCOPE;
+ String scope =
getIdentityConfiguration().getValue(IdentityConfiguration.SEARCH_SCOPE);
+ if (scope != null)
+ {
+ if ("OBJECT_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.OBJECT_SCOPE;
+ else if ("ONELEVEL_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.ONELEVEL_SCOPE;
+ else if ("SUBTREE_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.SUBTREE_SCOPE;
+ }
+ return searchScope;
+ }
+
+ protected String getRoleCtxDN() throws IdentityException
+ {
+ String roleCtx =
getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_CONTEXT_DN);
+ if (roleCtx == null)
+ {
+ throw new IdentityException("Configuration option missing: " +
IdentityConfiguration.ROLE_CONTEXT_DN);
+ }
+ return roleCtx;
+ }
+
+ protected String getRoleSearchFilter() throws IdentityException
+ {
+ String searchFilter =
getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_SEARCH_FILTER);
+ if (searchFilter == null)
+ {
+ throw new IdentityException(IdentityConfiguration.ROLE_SEARCH_FILTER + "
missing in configuration");
+ }
+ else
+ {
+ return searchFilter;
+ }
+ }
+
+ protected int getRoleRecurtion() throws IdentityException
+ {
+ int recurtion = 0;
+ String rr =
getIdentityConfiguration().getValue(IdentityConfiguration.ROLE_RECURSION);
+ if (rr != null)
+ {
+ try
+ {
+ recurtion = Integer.parseInt(rr);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn(IdentityConfiguration.ROLE_RECURSION + " wrong value -
disabling recurtion:" + e);
+ }
+ }
+ return recurtion;
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -71,7 +71,7 @@
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchRoles(filter);
+ NamingEnumeration results = searchRoles(filter, null);
List sr = Tools.toList(results);
if (sr.size() > 1)
{
@@ -117,8 +117,9 @@
}
filter.append(")");
- NamingEnumeration results = searchRoles(filter.toString());
+ NamingEnumeration results = searchRoles(filter.toString(), null);
List sr = Tools.toList(results);
+ log.debug("Roles found: " + sr.size());
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
{
SearchResult res = (SearchResult)iterator.next();
@@ -150,7 +151,7 @@
public Role findRoleById(String id) throws IdentityException,
IllegalArgumentException
{
- return findRoleByName(id);
+ return findRoleByDN(id);
}
public Role createRole(String name, String displayName) throws IdentityException,
IllegalArgumentException
@@ -247,7 +248,7 @@
String filter =
getRidAttributeID().concat("=").concat("*");
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchRoles(filter);
+ NamingEnumeration results = searchRoles(filter, null);
List sr = Tools.toList(results);
return sr.size();
@@ -273,7 +274,7 @@
String filter =
"(".concat(getRidAttributeID()).concat("=").concat("*").concat(")");
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchRoles(filter);
+ NamingEnumeration results = searchRoles(filter, null);
while (results.hasMoreElements())
{
SearchResult res = (SearchResult)results.nextElement();
@@ -299,7 +300,7 @@
* @param filter that will be concatenated with proper role search filter from the
module
* @return
*/
- public NamingEnumeration searchRoles(String filter) throws NamingException,
IdentityException
+ public NamingEnumeration searchRoles(String filter, Object[] filterArgs) throws
NamingException, IdentityException
{
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
@@ -308,7 +309,14 @@
//String filter = getUidAttributeID().concat("=").concat(userName);
log.debug("Search filter: " + filter);
- return getConnectionContext().createInitialContext().search(getContainerDN(),
filter, controls);
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(),
filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(),
filter, filterArgs, controls);
+ }
}
//TODO:remove this - it's only a fasade to make this implementation compatible
with old RoleModule interface
Modified:
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticGroupMembershipModuleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -91,7 +91,7 @@
String filter =
getMemberAttributeID().concat("=").concat(memberName);
log.debug("Search filter: " + filter);
- NamingEnumeration results = getRoleModule().searchRoles(filter);
+ NamingEnumeration results = getRoleModule().searchRoles(filter, null);
List sr = Tools.toList(results);
@@ -324,7 +324,7 @@
String filter =
getMemberAttributeID().concat("=").concat(memberName);
log.debug("Search filter: " + filter);
- NamingEnumeration results = getRoleModule().searchRoles(filter);
+ NamingEnumeration results = getRoleModule().searchRoles(filter, null);
List sr = Tools.toList(results);
//iterate over roles that contain a user
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
Modified:
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPStaticRoleMembershipModuleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -172,7 +172,7 @@
}
else
{
- memberOfName = ldapRole.getId().toString();
+ memberOfName = ldapRole.getName();
}
String filter =
getMemberAttributeID().concat("=").concat(memberOfName);
@@ -180,7 +180,7 @@
//NamingEnumeration results =
getConnectionContext().createInitialContext().search(getUserContainerDN(), filter,
controls);
- NamingEnumeration results = getUserModule().searchUsers(filter);
+ NamingEnumeration results = getUserModule().searchUsers(filter, null);
List sr = Tools.toList(results);
@@ -254,7 +254,7 @@
}
else
{
- memberOfName = ldapRole.getId().toString();
+ memberOfName = ldapRole.getName();
}
@@ -263,7 +263,7 @@
String filter =
getMemberAttributeID().concat("=").concat(memberOfName);
log.debug("Search filter: " + filter);
- NamingEnumeration results = getUserModule().searchUsers(filter);
+ NamingEnumeration results = getUserModule().searchUsers(filter, null);
List sr = Tools.toList(results);
//iterate over users that contain a role
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
@@ -360,7 +360,7 @@
}
else
{
- member.add(role.getId().toString());
+ member.add(role.getName());
}
}
catch (ClassCastException e)
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-13
03:37:46 UTC (rev 6241)
+++ trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -34,6 +34,7 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
import javax.naming.InitialContext;
@@ -209,9 +210,10 @@
* implementation to apply proper filter and search scope from the configuration
*
* @param filter that will be concatenated with proper user search filter from the
module
+ * @param filterArgs
* @return
*/
- public abstract NamingEnumeration searchUsers(String filter) throws NamingException,
IdentityException;
+ public abstract NamingEnumeration searchUsers(String filter, Object[] filterArgs)
throws NamingException, IdentityException;
//**************************
@@ -282,6 +284,70 @@
}
}
+ protected String getUserSearchFilter() throws IdentityException
+ {
+ String searchFilter =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_SEARCH_FILTER);
+ if (searchFilter == null)
+ {
+ throw new IdentityException(IdentityConfiguration.USER_SEARCH_FILTER + "
missing in configuration");
+ }
+ else
+ {
+ return searchFilter;
+ }
+ }
+
+ protected String getUserSearchCtxDN() throws IdentityException
+ {
+ String searchCtx =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_SEARCH_CTX_DN);
+ if (searchCtx == null)
+ {
+ throw new IdentityException(IdentityConfiguration.USER_SEARCH_CTX_DN + "
missing in configuration");
+ }
+ else
+ {
+ return searchCtx;
+ }
+ }
+
+ protected int getSearchTimeLimit() throws IdentityException
+ {
+ int searchTimeout = 10000;
+ String limit =
getIdentityConfiguration().getValue(IdentityConfiguration.SEARCH_TIME_LIMIT);
+ if (limit != null)
+ {
+ try
+ {
+ searchTimeout = Integer.parseInt(limit);
+ }
+ catch (NumberFormatException e)
+ {
+ log.warn(IdentityConfiguration.SEARCH_TIME_LIMIT + "wrong value falling
back to defaults:" + e);
+ }
+ }
+ return searchTimeout;
+ }
+
+ protected int getSearchScope() throws IdentityException
+ {
+ int searchScope = SearchControls.ONELEVEL_SCOPE;
+ String scope =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_SEARCH_CTX_DN);
+ if (scope != null)
+ {
+ if ("OBJECT_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.OBJECT_SCOPE;
+ else if ("ONELEVEL_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.ONELEVEL_SCOPE;
+ else if ("SUBTREE_SCOPE".equalsIgnoreCase(scope))
+ searchScope = SearchControls.SUBTREE_SCOPE;
+ }
+ return searchScope;
+ }
+
+
+
+
+
/*protected String getEmailAttributeId() throws IdentityException
{
String email =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_EMAIL_ATTRIBUTE_ID);
Modified: trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -73,7 +73,7 @@
String filter =
"(".concat(getUidAttributeID()).concat("=").concat(userName).concat(")");
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchUsers(filter);
+ NamingEnumeration results = searchUsers(filter, null);
List sr = Tools.toList(results);
if (sr.size() > 1)
{
@@ -259,7 +259,7 @@
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchUsers(ldap_filter);
+ NamingEnumeration results = searchUsers(ldap_filter, null);
while (results.hasMoreElements())
{
SearchResult res = (SearchResult)results.nextElement();
@@ -289,7 +289,7 @@
log.debug("Search filter: " + filter);
- NamingEnumeration results = searchUsers(filter);
+ NamingEnumeration results = searchUsers(filter, null);
List sr = Tools.toList(results);
return sr.size();
@@ -314,17 +314,23 @@
* @param filter that will be concatenated with proper user search filter from the
module
* @return
*/
- public NamingEnumeration searchUsers(String filter) throws NamingException,
IdentityException
+ public NamingEnumeration searchUsers(String filter, Object[] filterArgs) throws
NamingException, IdentityException
{
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
controls.setReturningObjFlag(true);
+ controls.setTimeLimit(getSearchTimeLimit());
- //String filter = getUidAttributeID().concat("=").concat(userName);
log.debug("Search filter: " + filter);
-
- return getConnectionContext().createInitialContext().search(getContainerDN(),
filter, controls);
+ if (filterArgs == null)
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(),
filter, controls);
+ }
+ else
+ {
+ return getConnectionContext().createInitialContext().search(getContainerDN(),
filter, filterArgs, controls);
+ }
}
}
Added:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
(rev 0)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -0,0 +1,132 @@
+package org.jboss.portal.test.identity.ldap;
+
+import junit.framework.TestSuite;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.IdentityServiceControllerImpl;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityConfiguration;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.ldap.LDAPUserImpl;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPExtUserModuleTestCase extends LDAPTestCase
+{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPExtUserModuleTestCase.class);
+
+ public static TestSuite suite() throws Exception
+ {
+ System.out.println("###");
+ return createTestSuite(LDAPExtUserModuleTestCase.class,
"directories-extusermodule.xml", "datasources.xml");
+ }
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
+ }
+
+ UserModule userModule;
+
+ RoleModule roleModule;
+
+ MembershipModule membershipModule;
+
+ UserProfileModule userProfileModule;
+
+
+
+ private String suffix;
+
+ private String userPrefix;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+ controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+ controller.setRegisterMBeans(false);
+ controller.start();
+ identityContext = controller.getIdentityContext();
+ userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
+ membershipModule =
(MembershipModule)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+ userProfileModule =
(UserProfileModule)identityContext.getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+
+ suffix = getDirectoryServerConfigParameter().getCleanUpDN();
+ userPrefix =
((IdentityConfiguration)controller.getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
+
+ populate();
+ }
+
+
+ public void testFirstSimple() throws Exception
+ {
+ log.info("test framework works ;]");
+ }
+
+ public void testFindUserByName() throws Exception
+ {
+ LDAPUserImpl ldapu =
(LDAPUserImpl)userModule.findUserByUserName("jduke");
+ assertEquals(ldapu.getDn().toLowerCase(), (userPrefix +
"=jduke,ou=People," + suffix).toLowerCase());
+ assertEquals(ldapu.getUserName(), "jduke");
+ }
+
+ public void testgetUserCount() throws Exception
+ {
+ LDAPUserImpl ldapu =
(LDAPUserImpl)userModule.findUserByUserName("jduke");
+ assertEquals(ldapu.getDn().toLowerCase(),(userPrefix +
"=jduke,ou=People," + suffix).toLowerCase());
+ assertEquals(ldapu.getUserName(), "jduke");
+
+ int count = userModule.getUserCount();
+ assertEquals(5, count);
+ }
+
+ //TODO: test findUsers
+
+ public void testFindUsersFilteredByName() throws Exception
+ {
+ userModule.findUsersFilteredByUserName("jduke",0,1);
+ //assertEquals(ldapu.getUserName(), "jduke");
+
+ }
+
+ public void testPassword() throws Exception
+ {
+ //userModule.createUser("testUser", "testPassword");
+ User u = userModule.findUserByUserName("jduke");
+ assertNotNull(u);
+ assertEquals("jduke", u.getUserName());
+ assertTrue(u.validatePassword("theduke"));
+
+ userProfileModule.setProperty(u, User.INFO_USER_EMAIL_REAL,
"testRealEmail");
+ assertTrue(u.validatePassword("theduke"));
+
+
+ assertTrue(!u.validatePassword("dodo"));
+ u.updatePassword("dodo");
+ assertTrue(u.validatePassword("dodo"));
+
+ }
+}
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -92,27 +92,27 @@
}
- public void testFirstSimple() throws Exception
+ /*public void testFirstSimple() throws Exception
{
log.info("test framework works ;]");
- }
+ }*/
public void testFindRoleByName() throws Exception
{
- LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
assertEquals(ldapr.getDn().toLowerCase(), ("cn=Echo,ou=Roles," +
suffix).toLowerCase());
assertEquals(ldapr.getName(), "Echo");
}
public void testRemoveRole() throws Exception
{
- LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
assertEquals(ldapr.getDn().toLowerCase(), ("cn=Echo,ou=Roles," +
suffix).toLowerCase());
assertEquals(ldapr.getName(), "Echo");
- roleModule.removeRole("Echo");
+ roleModule.removeRole(ldapr.getId());
try
{
- ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
fail();
}
catch (IdentityException e)
@@ -129,14 +129,14 @@
assertEquals("testRole", ldapr.getName());
//assertEquals("testDisplayName",ldapr.getDisplayName());
- ldapr = (LDAPRoleImpl)roleModule.findRoleById("testRole");
+ ldapr = (LDAPRoleImpl)roleModule.findRoleByName("testRole");
assertNotNull(ldapr);
- roleModule.removeRole("testRole");
+ roleModule.removeRole(ldapr.getId());
try
{
- roleModule.findRoleById("testRole");
+ roleModule.findRoleByName("testRole");
fail("shouldn reach this");
}
catch (Exception e)
@@ -149,7 +149,7 @@
public void testgetRoleCount() throws Exception
{
- LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleById("Echo");
+ LDAPRoleImpl ldapr = (LDAPRoleImpl)roleModule.findRoleByName("Echo");
assertEquals(ldapr.getDn().toLowerCase(), ("cn=Echo,ou=Roles," +
suffix).toLowerCase());
assertEquals(ldapr.getName(), "Echo");
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -174,9 +174,9 @@
assertTrue(u.validatePassword("testPassword"));
-// assertTrue(!u.validatePassword("1testPassword1"));
-// u.updatePassword("1testPassword1");
-// assertTrue(u.validatePassword("1testPassword1"));
+ assertTrue(!u.validatePassword("1testPassword1"));
+ u.updatePassword("1testPassword1");
+ assertTrue(u.validatePassword("1testPassword1"));
}
}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-02-13
03:37:46 UTC (rev 6241)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPTestCase.java 2007-02-13
03:52:54 UTC (rev 6242)
@@ -66,7 +66,7 @@
Appender appender = new ConsoleAppender(new SimpleLayout());
Logger.getRoot().addAppender(appender);
Logger.getRoot().setLevel(Level.INFO);
- Logger.getLogger("org.jboss.portal.identity").setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity").setLevel(Level.DEBUG);
}
public static TestSuite createTestSuite(Class clazz, String directories, String
datasources) throws Exception
Added: trunk/identity/src/resources/test/config/extuser/opends-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/extuser/opends-config.xml
(rev 0)
+++ trunk/identity/src/resources/test/config/extuser/opends-config.xml 2007-02-13 03:52:54
UTC (rev 6242)
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+ <!--<!DOCTYPE identity-configuration PUBLIC
+ "-//JBoss Portal//DTD JBoss Identity Configuration 1.0//EN"
+ "http://www.jboss.org/portal/dtd/identity-config_1_0.dtd">-->
+
+<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
+ <modules>
+ <module>
+ <!--type used to correctly map in IdentityContext registry-->
+ <type>User</type>
+ <implementation>LDAP</implementation>
+ <class>org.jboss.portal.identity.ldap.LDAPExtUserModuleImpl</class>
+ <config/>
+ </module>
+ <module>
+ <type>Role</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>Membership</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+
+ <module>
+ <type>UserProfile</type>
+ <implementation>DELEGATING</implementation>
+ <config>
+ <option>
+ <name>profileConfigFile</name>
+ <value>test/config/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ldapModuleJNDIName</name>
+ <value>java:/portal/LDAPUserProfileModule</value>
+ </option>
+ </config>
+ </module>
+ <module>
+ <type>DBDelegateUserProfile</type>
+ <implementation>DB</implementation>
+ <config/>
+ </module>
+ <module>
+ <type>LDAPDelegateUserProfile</type>
+ <implementation>LDAP</implementation>
+ <config/>
+ </module>
+ </modules>
+
+ <options>
+ <option-group>
+ <group-name>common</group-name>
+ <option>
+ <name>userSearchCtxDN</name>
+
<value>ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ <option>
+ <name>userSearchFilter</name>
+ <value>(uid={0})</value>
+ </option>
+ <option>
+ <name>roleContainerDN</name>
+
<value>ou=Roles,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ <option-group>
+ <group-name>roleCreateAttibutes</group-name>
+ <!--Schema requires those to have initial value-->
+ <option>
+ <name>cn</name>
+ <value>none</value>
+ </option>
+ <!--Some directory servers require this attribute to be valid DN-->
+ <!--For safety reasons point to the admin user here-->
+ <option>
+ <name>member</name>
+
<value>uid=admin,ou=People,dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</value>
+ </option>
+ </option-group>
+ </options>
+</identity-configuration>
\ No newline at end of file
Added: trunk/test/src/etc/directories-extusermodule.xml
===================================================================
--- trunk/test/src/etc/directories-extusermodule.xml (rev 0)
+++ trunk/test/src/etc/directories-extusermodule.xml 2007-02-13 03:52:54 UTC (rev 6242)
@@ -0,0 +1,98 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<directories>
+ <directory>
+ <directory-name>OpenDS</directory-name>
+ <description>OpenDS service deployed on JBoss AS as an mbean -
StaticRoleMembership config</description>
+ <config-file>test/config/extuser/opends-config.xml</config-file>
+ <host>localhost</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>password</admin-password>
+ <populate-ldif>ldap/ldif/initial-tests-qa.ldif</populate-ldif>
+
<cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <!--<directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access) -
StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/rhds-config.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+
<populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+
+
<cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+ <directory>
+ <directory-name>RedHatDS</directory-name>
+ <description>RedHat Directory in QA Labs (need vpn access) -
StaticRoleMembership config</description>
+
+
<config-file>test/config/identity/rhds-config-staticrole.xml</config-file>
+ <host>dev39.qa.atl.jboss.com</host>
+ <port>10389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Directory Manager</admin-dn>
+ <admin-password>qpq123qpq</admin-password>
+
+
<populate-ldif>ldap/ldif/initial-tests-notpopulated.ldif</populate-ldif>
+
+
<cleanup-dn>dc=testsuite,dc=portal,dc=qa,dc=atl,dc=jboss,dc=com</cleanup-dn>
+ </directory>
+
+ <directory>
+ <directory-name>OpenLDAP</directory-name>
+ <description>OpenLDAP Directory in QA Labs (need vpn access) -
StaticGroupMembership config</description>
+
+ <config-file>test/config/identity/openldap-config.xml</config-file>
+ <host>dev09.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>cn=Manager,dc=my-domain,dc=com</admin-dn>
+ <admin-password>jbossqa</admin-password>
+
+
<populate-ldif>ldap/ldif/initial-tests-notpopulated-openldap.ldif</populate-ldif>
+
+ <cleanup-dn>dc=testsuite,dc=portal,dc=my-domain,dc=com</cleanup-dn>
+ </directory>-->
+ <!--<directory>
+ <directory-name>MSAD</directory-name>
+ <description>Microsoft Active Directory in QA Labs (need vpn
access)</description>
+
+ <config-file>test/config/msad-config.xml</config-file>
+ <host>dev44.qa.atl.jboss.com</host>
+ <port>389</port>
+ <context-factory>com.sun.jndi.ldap.LdapCtxFactory</context-factory>
+ <admin-dn>JBOSS\jbossqa</admin-dn>
+ <admin-password>jboss42</admin-password>
+
+ <populate-ldif>ldap/ldif/initial-tests-qa-msad.ldif</populate-ldif>
+
+ <cleanup-dn>ou=testsuite,ou=portal,dc=jboss,dc=test</cleanup-dn>
+ </directory>-->
+</directories>