]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/SimpleUserNatureMapper.java
Restructure security
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / ldap / SimpleUserNatureMapper.java
diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/SimpleUserNatureMapper.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/SimpleUserNatureMapper.java
deleted file mode 100644 (file)
index 2a21091..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.argeo.security.ldap;
-
-import org.argeo.security.UserNature;
-import org.argeo.security.nature.SimpleUserNature;
-import org.springframework.ldap.core.DirContextAdapter;
-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;
-       }
-
-       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());
-       }
-
-       public Boolean supports(UserNature userInfo) {
-               return userInfo instanceof SimpleUserNature;
-       }
-
-}