Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

SEC-1347: GrantedAuthority should extends Comparable<GrantedAuthority> #1590

spring-issuemaster opened this Issue Dec 31, 2009 · 2 comments


None yet
1 participant

Manuel Dominguez Sarmiento (Migrated from SEC-1347) said:

GrantedAuthorityImpl has a compareTo() method which I guess is supposed to be the implementation of Comparable, however this interface is nowhere to be found in the class hierarchy.

We found out because UserDetails.getAuthorities() : Collection is supposed to return elements "sorted by natural key" and we thought about using a TreeSet in our implementation, but of course this would only work if the GrantedAuthorityImpl objects we put in it implement Comparable, which they don't. We use a LinkedHashSet instead as a workaround, pre-sorting elements before insertion.

BTW, what's the reasoning behind the "sorted by natural key" requirement for iterating through authorities?

Luke Taylor said:

Please see SEC-1304 and SEC-717. The compareTo() method has been left in by mistake and should be removed.

Luke Taylor said:

Removed the compareTo method as part of the original issue.

@spring-issuemaster spring-issuemaster added this to the 3.0.1 milestone Feb 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment