Selaa lähdekoodia

SEC-991: Removed deprecated getAttributes() method from LdapUserDetails interface

Luke Taylor 17 vuotta sitten
vanhempi
commit
b031124f61

+ 0 - 12
core/src/main/java/org/springframework/security/userdetails/ldap/LdapUserDetails.java

@@ -17,9 +17,6 @@ package org.springframework.security.userdetails.ldap;
 
 import org.springframework.security.userdetails.UserDetails;
 
-import javax.naming.directory.Attributes;
-
-
 /**
  * Captures the information for a user's LDAP entry.
  *
@@ -29,15 +26,6 @@ import javax.naming.directory.Attributes;
 public interface LdapUserDetails extends UserDetails {
     //~ Methods ========================================================================================================
 
-    /**
-     * The attributes for the user's entry in the directory (or a subset of them, depending on what was
-     * retrieved from the directory).
-     *
-     * @deprecated Map additional attributes to user properties in a custom object rather than accessing them here.
-     * @return the user's attributes, or an empty array if none were obtained, never null.
-     */
-    Attributes getAttributes();
-
     /**
      * The DN of the entry for this user's account.
      *

+ 1 - 11
core/src/main/java/org/springframework/security/userdetails/ldap/LdapUserDetailsImpl.java

@@ -47,7 +47,6 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
 
     //~ Instance fields ================================================================================================
 
-    private Attributes attributes = new BasicAttributes();
     private String dn;
     private String password;
     private String username;
@@ -63,10 +62,6 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
 
     //~ Methods ========================================================================================================
 
-    public Attributes getAttributes() {
-        return attributes;
-    }
-
     public GrantedAuthority[] getAuthorities() {
         return authorities;
     }
@@ -123,7 +118,7 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
             sb.append("Not granted any authorities");
         }
 
-        return sb.toString();        
+        return sb.toString();
     }
 
     //~ Inner Classes ==================================================================================================
@@ -143,7 +138,6 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
 
         public Essence(LdapUserDetails copyMe) {
             setDn(copyMe.getDn());
-            setAttributes(copyMe.getAttributes());
             setUsername(copyMe.getUsername());
             setPassword(copyMe.getPassword());
             setEnabled(copyMe.isEnabled());
@@ -202,10 +196,6 @@ public class LdapUserDetailsImpl implements LdapUserDetails {
             instance.accountNonLocked = accountNonLocked;
         }
 
-        public void setAttributes(Attributes attributes) {
-            instance.attributes = attributes;
-        }
-
         public void setAuthorities(GrantedAuthority[] authorities) {
             mutableAuthorities = new ArrayList(Arrays.asList(authorities));
         }