diff --git a/core/src/main/java/org/springframework/security/core/GrantedAuthority.java b/core/src/main/java/org/springframework/security/core/GrantedAuthority.java
index f313345502..345805376f 100644
--- a/core/src/main/java/org/springframework/security/core/GrantedAuthority.java
+++ b/core/src/main/java/org/springframework/security/core/GrantedAuthority.java
@@ -18,7 +18,6 @@ package org.springframework.security.core;
import java.io.Serializable;
import org.springframework.security.access.AccessDecisionManager;
-import org.springframework.security.core.userdetails.UserDetails;
/**
* Represents an authority granted to an {@link Authentication} object.
@@ -27,10 +26,6 @@ import org.springframework.security.core.userdetails.UserDetails;
* A GrantedAuthority
must either represent itself as a
* String
or be specifically supported by an {@link
* AccessDecisionManager}.
- *
- * Implementations must implement {@link Comparable} in order to ensure that
- * array sorting logic guaranteed by {@link UserDetails#getAuthorities()} can
- * be reliably implemented.
*
* @author Ben Alex
* @version $Id$
@@ -41,11 +36,12 @@ public interface GrantedAuthority extends Serializable, Comparable If the
- *
+ * If the String
and that
* String
is sufficient in precision to be relied upon for an access control decision by an {@link
- * AccessDecisionManager} (or delegate), this method should return such a String
.GrantedAuthority
cannot be expressed with sufficient precision as a String
,
+ * AccessDecisionManager} (or delegate), this method should return such a String
.
+ * GrantedAuthority
cannot be expressed with sufficient precision as a String
,
* null
should be returned. Returning null
will require an
- * AccessDecisionManager
(or delegate) to specifically support the GrantedAuthority
- * implementation, so returning null
should be avoided unless actually required.AccessDecisionManager
(or delegate) to specifically support the GrantedAuthority
+ * implementation, so returning null
should be avoided unless actually required.
*
* @return a representation of the granted authority (or null
if the granted authority cannot be
* expressed as a String
with sufficient precision).
diff --git a/core/src/main/java/org/springframework/security/core/userdetails/User.java b/core/src/main/java/org/springframework/security/core/userdetails/User.java
index cf30ef95ea..c58e8aaacc 100644
--- a/core/src/main/java/org/springframework/security/core/userdetails/User.java
+++ b/core/src/main/java/org/springframework/security/core/userdetails/User.java
@@ -15,11 +15,11 @@
package org.springframework.security.core.userdetails;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.List;
+import java.util.Comparator;
+import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -40,7 +40,7 @@ public class User implements UserDetails {
//~ Instance fields ================================================================================================
private final String password;
private final String username;
- private final Listnull
value was passed
* either as a parameter or as an element in the
- * GrantedAuthority[]
array
+ * GrantedAuthority
collection
*/
public User(String username, String password, boolean enabled, boolean accountNonExpired,
boolean credentialsNonExpired, boolean accountNonLocked, Collection