Răsfoiți Sursa

Wrapper around the information returned apon a successful lookup of a user (who at that point has NOT been authenticated).

Robert Sanders 20 ani în urmă
părinte
comite
78f792a132

+ 100 - 0
sandbox/src/main/java/org/acegisecurity/providers/dao/ldap/UserSearchResults.java

@@ -0,0 +1,100 @@
+/**
+ * 
+ */
+package net.sf.acegisecurity.providers.dao.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchResult;
+
+/**
+ * Encapsulates the information returned by a successful UserSearchBean
+ *
+ */
+public class UserSearchResults {
+    
+    private Attributes attributes;
+    
+    /** The full DN of the user. */
+    private String ldapName;
+    
+    /** The name that should be used to log the user into the LDAP server (to test authentication). */
+    private String userLoginName;
+    
+    /** Internal state: the UserSearchBean which yeilded the results. */
+    private UserSearchBean userSearchBean;
+    
+    public UserSearchResults() {
+        super();
+    }
+    
+    public UserSearchResults(SearchResult searchResult) {
+        super();
+        setAttributes( searchResult.getAttributes() );
+    }
+    
+    public UserSearchResults(SearchResult searchResult, UserSearchBean userSearchBean) {
+        super();
+        this.userSearchBean = userSearchBean;
+        setAttributes( searchResult.getAttributes() );
+    }
+    
+    /**
+     * @return Returns the attributes.
+     */
+    public Attributes getAttributes() {
+        return attributes;
+    }
+
+    /**
+     * @param attributes The attributes to set.
+     */
+    public void setAttributes(Attributes attributes) {
+        this.attributes = attributes;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getLdapName() {
+        return ldapName;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setLdapName(String name) {
+        this.ldapName = name;
+    }
+
+    /**
+     * @return Returns the userLoginName.
+     */
+    public String getUserLoginName() {
+        return userLoginName;
+    }
+
+    /**
+     * @param userLoginName The userLoginName to set.
+     */
+    public void setUserLoginName(String userLoginName) {
+        this.userLoginName = userLoginName;
+    }
+
+    /**
+     * @return Returns the userSearchBean.
+     */
+    public UserSearchBean getUserSearchBean() {
+        return userSearchBean;
+    }
+
+    /**
+     * @param userSearchBean The userSearchBean to set.
+     */
+    public void setUserSearchBean(UserSearchBean userSearchBean) {
+        this.userSearchBean = userSearchBean;
+    }
+    
+}