Created
August 13, 2012 11:54
-
-
Save mh-github/3339960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class User implements Serializable, UserDetails { | |
// Spring Security props | |
private transient Collection<GrantedAuthority> authorities; | |
public void setUserAuthorities(Collection<Role> roles) { | |
List<GrantedAuthority> listOfAuthorities = new ArrayList<GrantedAuthority>(); | |
for (Role role : roles) { | |
listOfAuthorities.add(new GrantedAuthorityImpl(role.getRole())); | |
} | |
this.authorities = (Collection<GrantedAuthority>) listOfAuthorities; | |
} | |
..... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment