]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - security/runtime/org.argeo.security.ldap/src/main/java/org/argeo/security/ldap/jcr/JcrLdapSynchronizer.java
Improve Security
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.ldap / src / main / java / org / argeo / security / ldap / jcr / JcrLdapSynchronizer.java
index 3a644a6939209abb0213837c747fb72aedc04928..0f59f1ee528c11561e8d9a67b6d4a3c13bb4b1d0 100644 (file)
@@ -336,9 +336,12 @@ public class JcrLdapSynchronizer implements UserDetailsContextMapper,
                        Node userProfile = securitySession.getNode(
                                        jcrUserDetails.getHomePath()).getNode(ARGEO_PROFILE);
                        for (String jcrProperty : propertyToAttributes.keySet()) {
-                               ModificationItem mi = jcrToLdap(jcrProperty, userProfile
-                                               .getProperty(jcrProperty).getString());
-                               ctx.setAttribute(mi.getAttribute());
+                               if (userProfile.hasProperty(jcrProperty)) {
+                                       ModificationItem mi = jcrToLdap(jcrProperty, userProfile
+                                                       .getProperty(jcrProperty).getString());
+                                       if (mi != null)
+                                               ctx.setAttribute(mi.getAttribute());
+                               }
                        }
                        if (log.isTraceEnabled())
                                log.trace("Mapped " + userProfile + " to " + ctx.getDn());