Fix various issues:
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / ldap / nature / SimpleUserNatureMapper.java
index 3bc4b51e11af15dd016e5a9635926a684b14f91c..9cad98d68b13b9e3baf1da4a99f7be68f2fa0372 100644 (file)
@@ -9,28 +9,25 @@ import org.springframework.ldap.core.DirContextOperations;
 public class SimpleUserNatureMapper implements UserNatureMapper {
 
        public UserNature mapUserInfoFromContext(DirContextOperations ctx) {
-               SimpleUserNature basicUserInfo = new SimpleUserNature();
-               basicUserInfo.setLastName(ctx.getStringAttribute("sn"));
-               basicUserInfo.setFirstName(ctx.getStringAttribute("givenName"));
-               basicUserInfo.setEmail(ctx.getStringAttribute("mail"));
-               basicUserInfo.setUuid(ctx.getStringAttribute("seeAlso"));
-               return basicUserInfo;
+               SimpleUserNature nature = new SimpleUserNature();
+               nature.setLastName(ctx.getStringAttribute("sn"));
+               nature.setFirstName(ctx.getStringAttribute("givenName"));
+               nature.setEmail(ctx.getStringAttribute("mail"));
+               return nature;
        }
 
        public void mapUserInfoToContext(UserNature userInfoArg,
                        DirContextAdapter ctx) {
-               SimpleUserNature userInfo = (SimpleUserNature) userInfoArg;
-               ctx.setAttributeValue("cn", userInfo.getFirstName() + " "
-                               + userInfo.getLastName());
-               ctx.setAttributeValue("sn", userInfo.getLastName());
-               ctx.setAttributeValue("givenName", userInfo.getFirstName());
-               ctx.setAttributeValue("mail", userInfo.getEmail());
-               // TODO: find a cleaner way?
-               ctx.setAttributeValue("seeAlso", userInfo.getUuid());
+               SimpleUserNature nature = (SimpleUserNature) userInfoArg;
+               ctx.setAttributeValue("cn", nature.getFirstName() + " "
+                               + nature.getLastName());
+               ctx.setAttributeValue("sn", nature.getLastName());
+               ctx.setAttributeValue("givenName", nature.getFirstName());
+               ctx.setAttributeValue("mail", nature.getEmail());
        }
 
-       public Boolean supports(UserNature userInfo) {
-               return userInfo instanceof SimpleUserNature;
+       public Boolean supports(UserNature userNature) {
+               return userNature instanceof SimpleUserNature;
        }
 
 }