SEC-1418: Deprecate GrantedAuthorityImpl in favour of final SimpleGrantedAuthority.
It should be noted that equality checks or lookups with Strings or other authority types will now fail where they would have succeeded before.
This commit is contained in:
+3
-3
@@ -16,7 +16,7 @@
|
||||
package org.springframework.security.ldap.userdetails;
|
||||
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.ldap.SpringSecurityLdapTemplate;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
@@ -222,7 +222,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
|
||||
role = role.toUpperCase();
|
||||
}
|
||||
|
||||
authorities.add(new GrantedAuthorityImpl(rolePrefix + role));
|
||||
authorities.add(new SimpleGrantedAuthority(rolePrefix + role));
|
||||
}
|
||||
|
||||
return authorities;
|
||||
@@ -261,7 +261,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
|
||||
*/
|
||||
public void setDefaultRole(String defaultRole) {
|
||||
Assert.notNull(defaultRole, "The defaultRole property cannot be set to null");
|
||||
this.defaultRole = new GrantedAuthorityImpl(defaultRole);
|
||||
this.defaultRole = new SimpleGrantedAuthority(defaultRole);
|
||||
}
|
||||
|
||||
public void setGroupRoleAttribute(String groupRoleAttribute) {
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ import org.springframework.ldap.core.SearchExecutor;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
@@ -112,7 +112,7 @@ public class LdapUserDetailsManager implements UserDetailsManager {
|
||||
Object group = ne.next();
|
||||
String role = group.toString();
|
||||
|
||||
return new GrantedAuthorityImpl(rolePrefix + role.toUpperCase());
|
||||
return new SimpleGrantedAuthority(rolePrefix + role.toUpperCase());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.ldap.core.DirContextAdapter;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.ldap.ppolicy.PasswordPolicyControl;
|
||||
import org.springframework.security.ldap.ppolicy.PasswordPolicyResponseControl;
|
||||
@@ -138,7 +138,7 @@ public class LdapUserDetailsMapper implements UserDetailsContextMapper {
|
||||
if (convertToUpperCase) {
|
||||
role = ((String) role).toUpperCase();
|
||||
}
|
||||
return new GrantedAuthorityImpl(rolePrefix + role);
|
||||
return new SimpleGrantedAuthority(rolePrefix + role);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user