--- /dev/null
+package com.pentila.jackrabbit.auth;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+
+import org.springframework.ldap.core.AttributesMapper;
+
+public class LdapUserMapper implements AttributesMapper {
+
+
+ private String attrId;
+
+ private String attrLogin;
+
+ public LdapUserMapper(String attrId, String attrLogin){
+
+ this.attrId = attrId;
+ this.attrLogin = attrLogin;
+
+ }
+
+
+ public LdapUser mapFromAttributes(Attributes attrs) throws NamingException {
+
+ LdapUser u = new LdapUser();
+
+ u.setLogin((String)attrs.get(attrLogin).get());
+ u.setId((String)attrs.get(attrId).get());
+
+ return u;
+ }
+
+}