Author: bdaw
Date: 2008-05-26 04:04:11 -0400 (Mon, 26 May 2008)
New Revision: 10818
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/event/UserProfileChangedEvent.java
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/User.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/boot/IdentityServiceLoader.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/service/UserProfileModuleService.java
Log:
Sync changes from 1.0 branch
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -134,6 +134,7 @@
log.debug("Delegating to DB module");
getDBModule().setProperty(user, name, propertyValue);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), name);
return;
}
throw new IdentityException("Cannot process property - incorrect profile or
module configuration");
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/IdentityConfiguration.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -71,6 +71,8 @@
public static final String USER_ALLOW_EMPTY_PASSWORDS =
"allowEmptyPasswords";
+ public static final String USER_USER_NAME_TO_LOWER_CASE =
"userNameToLowerCase";
+
//public static final String ROLE_CONTAINER_DN = "roleContainerDN";
public static final String ROLE_RID_ATTRIBUTE_ID = "ridAttributeID";
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/User.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/User.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/User.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -75,7 +75,7 @@
public String getUserName();
/** Set the password using proper encoding. */
- public void updatePassword(String password);
+ public void updatePassword(String password) throws IdentityException;
/** Return true if the password is valid. */
public boolean validatePassword(String password);
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/auth/IdentityLoginModule.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -50,7 +50,7 @@
/**
* A login module that uses the user module.
- *
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -59,7 +59,7 @@
*/
public class IdentityLoginModule extends UsernamePasswordLoginModule
{
-
+
protected String userModuleJNDIName;
protected String roleModuleJNDIName;
@@ -72,6 +72,10 @@
protected String havingRole;
+ protected String validateUserNameCase;
+
+ protected String userNameToLowerCase;
+
public void initialize(Subject subject, CallbackHandler callbackHandler, Map
sharedState, Map options)
{
super.initialize(subject, callbackHandler, sharedState, options);
@@ -85,6 +89,8 @@
.get("membershipModuleJNDIName");
additionalRole = (String) options.get("additionalRole");
havingRole = (String) options.get("havingRole");
+ validateUserNameCase = (String) options.get("validateUserNameCase");
+ userNameToLowerCase = (String) options.get("userNameToLowerCase");
// Some info
log.trace("userModuleJNDIName = " + userModuleJNDIName);
@@ -93,6 +99,8 @@
log.trace("membershipModuleJNDIName = " + membershipModuleJNDIName);
log.trace("additionalRole = " + additionalRole);
log.trace("havingRole = " + havingRole);
+ log.trace("validateUserNameCase = " + validateUserNameCase);
+ log.trace("userNameToLowerCase = " + userNameToLowerCase);
}
private UserModule userModule;
@@ -178,7 +186,7 @@
// Set the user Status in the request so that the login page can show an
error message accordingly
request.setAttribute("org.jboss.portal.userStatus",
userStatus);
-
+
if (userStatus == UserStatus.OK)
{
return true;
@@ -218,8 +226,16 @@
// exception...
if (user == null)
{
- throw new NoSuchUserException("UserModule returned null user
object");
+ throw new NoSuchUserException("UserModule returned null user
object");
}
+
+ //This is because LDAP binds can be non case sensitive
+ if (validateUserNameCase != null &&
validateUserNameCase.equalsIgnoreCase("true")
+ && !getUsername().equals(user.getUserName()))
+ {
+ return UserStatus.UNEXISTING;
+ }
+
boolean enabled = false;
try {
Object enabledS;
@@ -331,4 +347,28 @@
{
return new UserPrincipal(username);
}
+
+ protected String getUsername()
+ {
+ if (userNameToLowerCase != null &&
userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ return super.getUsername().toLowerCase();
+ }
+ return super.getUsername();
+ }
+
+ protected String[] getUsernameAndPassword() throws LoginException
+ {
+ String[] names = super.getUsernameAndPassword();
+
+ if (userNameToLowerCase != null &&
userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ if (names[0] != null)
+ {
+ names[0] = names[0].toLowerCase();
+ }
+ }
+ return names;
+
+ }
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/boot/IdentityServiceLoader.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/boot/IdentityServiceLoader.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/boot/IdentityServiceLoader.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -100,6 +100,8 @@
unregisterMBean(ds.getServiceName());
registerMBean(ds.getServiceName(), datasource);
}
+
+
}
}
@@ -111,7 +113,7 @@
ModuleServiceMetaData moduleService = (ModuleServiceMetaData)iterator.next();
ModuleMetaData module = moduleService.getModuleData();
-
+
String entryName = "portal:identity=Module,type=" + module.getType();
AbstractBeanMetaData moduleBMD = new AbstractBeanMetaData(entryName,
module.getClassName());
@@ -148,8 +150,10 @@
{
unregisterMBean(module.getServiceName());
registerMBean(module.getServiceName(), moduleServiceObject);
+
}
}
+
}
/**
@@ -157,7 +161,7 @@
* @param serviceName
* @param serviceObject
*/
- protected void registerMBean(String serviceName, Object serviceObject) throws
Exception
+ protected void unregisterMBean(String serviceName) throws Exception
{
//does nothing
}
@@ -167,7 +171,7 @@
* @param serviceName
* @param serviceObject
*/
- protected void unregisterMBean(String serviceName) throws Exception
+ protected void registerMBean(String serviceName, Object serviceObject) throws
Exception
{
//does nothing
}
@@ -178,7 +182,7 @@
*/
protected ServiceJNDIBinder getServiceJNDIBinder() throws Exception
{
- return null;
+ return null;
}
public IdentityContext getIdentityContext()
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -25,6 +25,7 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.p3p.P3PConstants;
import org.jboss.portal.identity.ProfileMap;
+import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.db.ProfileMapImpl;
import java.util.Map;
@@ -216,7 +217,7 @@
this.familyName = familyName;
}
- public void updatePassword(String password)
+ public void updatePassword(String password) throws IdentityException
{
this.password = Tools.md5AsHexString(password);
}
@@ -400,7 +401,7 @@
Object object = toObject((String)value);
field.set(instance, object);
-
+
}
else
{
@@ -550,7 +551,7 @@
catch (ParseException e)
{
throw new IllegalArgumentException("Can't convert the date in the
user profile. value=[" + value + "].", e);
- }
+ }
}
protected String toString(Object value)
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -162,6 +162,7 @@
{
dbUser.getProfileMap().remove(propertyName);
}
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
}
public Map getProperties(User user) throws IdentityException
Added:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/event/UserProfileChangedEvent.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/event/UserProfileChangedEvent.java
(rev 0)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/event/UserProfileChangedEvent.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * 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. *
+ ******************************************************************************/
+package org.jboss.portal.identity.event;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserProfileChangedEvent extends IdentityEvent
+{
+
+ /** . */
+ private final Object userId;
+
+ /** . */
+ private final String userName;
+
+ /** . */
+ private final String propertyName;
+
+ public UserProfileChangedEvent(Object userId, String userName, String propertyName)
+ {
+ if (userId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (userName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.userId = userId;
+ this.userName = userName;
+ this.propertyName = propertyName;
+ }
+
+ public Object getUserId()
+ {
+ return userId;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public String getPropertyName()
+ {
+ return propertyName;
+ }
+
+ public String toString()
+ {
+ return "UserProfileChangedEvent[userId=" + userId +
",userName=" + userName + ",propertyName=" + propertyName +
"]";
+ }
+}
\ No newline at end of file
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -110,27 +110,31 @@
env.put(CONNECTION_POOL, "true");
if (getPoolingDebug() != null)
{
- env.put(CONNECTION_POOL_DEBUG, getPoolingDebug());
+ System.setProperty(CONNECTION_POOL_DEBUG, getPoolingDebug());
}
if (getPoolingInitsize() != null)
{
- env.put(CONNECTION_POOL_INITSIZE, getPoolingInitsize());
+ System.setProperty(CONNECTION_POOL_INITSIZE, getPoolingInitsize());
}
if (getPoolingMaxsize() != null)
{
- env.put(CONNECTION_POOL_MAXSIZE, getPoolingMaxsize());
+ System.setProperty(CONNECTION_POOL_MAXSIZE, getPoolingMaxsize());
}
if (getPoolingPrefsize() != null)
{
- env.put(CONNECTION_POOL_PREFSIZE, getPoolingPrefsize());
+ System.setProperty(CONNECTION_POOL_PREFSIZE, getPoolingPrefsize());
}
if (getPoolingProtocol() != null)
{
- env.put(CONNECTION_POOL_PROTOCOL, getPoolingProtocol());
+ System.setProperty(CONNECTION_POOL_PROTOCOL, getPoolingProtocol());
}
+ else
+ {
+ System.setProperty(CONNECTION_POOL_PROTOCOL, "plain ssl");
+ }
if (getPoolingTimeout() != null)
{
- env.put(CONNECTION_POOL_TIMEOUT, getPoolingTimeout());
+ System.setProperty(CONNECTION_POOL_TIMEOUT, getPoolingTimeout());
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtRoleModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -28,6 +28,7 @@
import org.jboss.portal.identity.Role;
import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
@@ -210,6 +211,7 @@
{
LdapContext ldapContext = getConnectionContext().createInitialContext();
+ NamingEnumeration results = null;
try
{
@@ -236,7 +238,7 @@
if (roleCtxs.size() == 1)
{
- Enumeration results = null;
+
if (filterArgs == null)
{
results = ldapContext.search(getRoleCtxDN(), filter, controls);
@@ -256,7 +258,7 @@
for (Iterator iterator = roleCtxs.iterator(); iterator.hasNext();)
{
String roleCtx = (String)iterator.next();
- Enumeration results = null;
+
if (filterArgs == null)
{
results = ldapContext.search(roleCtx, filter, controls);
@@ -266,6 +268,7 @@
results = ldapContext.search(roleCtx, filter, filterArgs, controls);
}
merged.addAll(Tools.toList(results));
+ results.close();
}
return merged;
@@ -273,6 +276,10 @@
}
finally
{
+ if (results != null)
+ {
+ results.close();
+ }
ldapContext.close();
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPExtUserModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -30,6 +30,7 @@
import javax.naming.Context;
import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
@@ -104,7 +105,6 @@
throw new IdentityException("Failed to close LDAP connection", e);
}
}
-
throw new NoSuchUserException("No user found with name: " + userName);
}
@@ -156,8 +156,6 @@
filter = "*" + filter + "*";
}
- Enumeration results = null;
-
String ldap_filter = getUserSearchFilter();
//* chars are escaped in filterArgs so we must replace it manually
@@ -238,6 +236,7 @@
{
LdapContext ldapContext = getConnectionContext().createInitialContext();
+ NamingEnumeration results = null;
try
{
@@ -261,7 +260,6 @@
if (userCtxs.size() == 1)
{
- Enumeration results = null;
if (filterArgs == null)
{
results = ldapContext.search(getUserSearchCtxDN(), filter, controls);
@@ -281,7 +279,6 @@
for (Iterator iterator = userCtxs.iterator(); iterator.hasNext();)
{
String userCtx = (String)iterator.next();
- Enumeration results = null;
if (filterArgs == null)
{
results = ldapContext.search(userCtx, filter, controls);
@@ -291,6 +288,7 @@
results = ldapContext.search(userCtx, filter, filterArgs, controls);
}
merged.addAll(Tools.toList(results));
+ results.close();
}
return merged;
@@ -298,6 +296,10 @@
}
finally
{
+ if (results != null)
+ {
+ results.close();
+ }
ldapContext.close();
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -104,7 +104,7 @@
- protected LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws
IdentityException
+ public LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws
IdentityException
{
LDAPRoleImpl ldapr = null;
try
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -328,7 +328,7 @@
{
LdapContext ldapContext = getConnectionContext().createInitialContext();
-
+ NamingEnumeration results = null;
try
{
SearchControls controls = new SearchControls();
@@ -339,7 +339,7 @@
filter = filter.replaceAll("\\\\", "\\\\\\\\");
log.debug("Search filter: " + filter);
- Enumeration results = null;
+
if (filterArgs == null)
{
results = ldapContext.search(getContainerDN(), filter, controls);
@@ -352,6 +352,10 @@
}
finally
{
+ if (results != null)
+ {
+ results.close();
+ }
ldapContext.close();
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -100,7 +100,7 @@
this.identityContext = context;
//this.realEmail = email;
this.id = id;
-
+
}
public boolean equals(Object obj)
@@ -124,7 +124,7 @@
return id.hashCode()*13 + 5;
}
- public void updatePassword(String password)
+ public void updatePassword(String password) throws IdentityException
{
if (password == null)
{
@@ -137,6 +137,7 @@
catch (IdentityException e)
{
log.debug("Password update failure: " + e);
+ throw new IdentityException("Password update failure: " + e);
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModule.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -199,8 +199,16 @@
//make DN as user ID
ldapu = new LDAPUserImpl(dn,getIdentityContext(), dn);
- ldapu.setUserName(uida.get().toString());
+ if (isUserNameToLowerCase())
+ {
+ ldapu.setUserName(uida.get().toString().toLowerCase());
+ }
+ else
+ {
+ ldapu.setUserName(uida.get().toString());
+ }
+
log.debug("user uid: " + ldapu.getId());
log.debug("user dn: " + ldapu.getDn());
@@ -415,7 +423,16 @@
return Boolean.FALSE.booleanValue();
}
+ protected boolean isUserNameToLowerCase()
+ {
+ String userNameToLowerCase =
getIdentityConfiguration().getValue(IdentityConfiguration.USER_USER_NAME_TO_LOWER_CASE);
+ if (userNameToLowerCase != null &&
userNameToLowerCase.equalsIgnoreCase("true"))
+ {
+ return Boolean.TRUE.booleanValue();
+ }
+ return Boolean.FALSE.booleanValue();
+ }
/*protected String getEmailAttributeId() throws IdentityException
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -30,6 +30,7 @@
import javax.naming.NamingException;
import javax.naming.Context;
+import javax.naming.NamingEnumeration;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
@@ -394,10 +395,10 @@
log.debug("Search filter: " + filter);
LdapContext ldapContext = getConnectionContext().createInitialContext();
-
+ NamingEnumeration results = null;
try
{
- Enumeration results = null;
+
if (filterArgs == null)
{
results = ldapContext.search(getContainerDN(), filter, controls);
@@ -411,7 +412,15 @@
}
finally
{
- ldapContext.close();
+ if (results != null)
+ {
+ results.close();
+ }
+ if (ldapContext != null)
+ {
+ ldapContext.close();
+ }
+
}
}
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -214,6 +214,7 @@
attrs.put(attr);
ldapContext.modifyAttributes(ldapUser.getDn(),
DirContext.REPLACE_ATTRIBUTE,attrs);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
}
catch (NamingException e)
{
Modified:
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/service/UserProfileModuleService.java
===================================================================
---
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-05-26
07:24:48 UTC (rev 10817)
+++
modules/identity/trunk/identity/src/main/java/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-05-26
08:04:11 UTC (rev 10818)
@@ -23,6 +23,9 @@
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.event.IdentityEvent;
+import org.jboss.portal.identity.event.UserProfileChangedEvent;
import org.jboss.portal.identity.metadata.profile.info.ProfileInfoSupport;
import org.jboss.portal.identity.metadata.config.ConfigurationParser;
import org.jboss.portal.identity.info.ProfileInfo;
@@ -51,13 +54,13 @@
{
if (log.isDebugEnabled())
{
- log.debug("Processing profile configuration for the module....");
+ log.debug("Processing profile configuration for the module....");
}
profileInfo = new
ProfileInfoSupport(ConfigurationParser.parseProfileConfiguration(getProfileConfigFile()));
}
super.start();
-
+
}
// public ProfileInfo getProfileInfo() throws IdentityException
@@ -79,5 +82,12 @@
{
this.profileConfigFile = profileConfigFile;
}
+
+ protected void fireUserProfileChangedEvent(Object userId, String userName, String
propertyName) throws IdentityException
+ {
+ IdentityEvent event = new UserProfileChangedEvent(userId, userName, propertyName);
+ getIdentityEventBroadcaster().fireEvent(event);
+ }
+
}