diff --git a/wise-webapp/src/main/java/com/wisemapping/security/ldap/LdapUserDetailsContextMapper.java b/wise-webapp/src/main/java/com/wisemapping/security/ldap/LdapUserDetailsContextMapper.java
index 8eb6dae6..3ca53c5c 100644
--- a/wise-webapp/src/main/java/com/wisemapping/security/ldap/LdapUserDetailsContextMapper.java
+++ b/wise-webapp/src/main/java/com/wisemapping/security/ldap/LdapUserDetailsContextMapper.java
@@ -19,6 +19,8 @@ public class LdapUserDetailsContextMapper implements UserDetailsContextMapper {
private UserService userService;
private String adminUser;
+ private String ldapAttributeFirstName;
+ private String ldapAttributeLastName;
public UserService getUserService() {
@@ -51,10 +53,10 @@ public class LdapUserDetailsContextMapper implements UserDetailsContextMapper {
user = new User();
user.setEmail(email);
- final String firstName = userData.getStringAttribute("givenName");
+ final String firstName = userData.getStringAttribute(ldapAttributeFirstName);
user.setFirstname(firstName);
- final String lastName = userData.getStringAttribute("sn");
+ final String lastName = userData.getStringAttribute(ldapAttributeLastName);
user.setLastname(lastName);
user.setPassword(email);
@@ -62,7 +64,7 @@ public class LdapUserDetailsContextMapper implements UserDetailsContextMapper {
user.setActivationDate(now);
try {
- userService.createUser(user, false,false);
+ userService.createUser(user, false, false);
} catch (WiseMappingException e) {
throw new IllegalStateException(e);
}
@@ -70,6 +72,22 @@ public class LdapUserDetailsContextMapper implements UserDetailsContextMapper {
return new UserDetails(user, isAdmin(email));
}
+ public String getLdapAttributeLastName() {
+ return ldapAttributeLastName;
+ }
+
+ public void setLdapAttributeLastName(String ldapAttributLastName) {
+ this.ldapAttributeLastName = ldapAttributLastName;
+ }
+
+ public String getLdapAttrbutFirstName() {
+ return ldapAttributeFirstName;
+ }
+
+ public void setLdapAttributeFirstName(String ldapAttributeFirstName) {
+ this.ldapAttributeFirstName = ldapAttributeFirstName;
+ }
+
@Override
public void mapUserToContext(org.springframework.security.core.userdetails.UserDetails userDetails, DirContextAdapter dirContextAdapter) {
// To be implemented ...
diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties
index a9af7e54..1677196b 100755
--- a/wise-webapp/src/main/webapp/WEB-INF/app.properties
+++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties
@@ -128,6 +128,10 @@ security.ldap.basedn=dc=wisemapping,dc=com
security.ldap.subDn=people
security.ldap.auth.attribute=mail
+security.ldap.lastName.attribute=sn
+security.ldap.firstName.attribute=givenName
+
+
diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml
index 21cff647..0085bf71 100644
--- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml
+++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security-ldap.xml
@@ -39,6 +39,8 @@
+
+