mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-03-30 20:08:26 +00:00
Polish AuthorityUtils
Changed parameter name to authorities Added JavaDoc Fixes gh-4805 Co-authored-by: Everett Irwin <everettirwin77@gmail.com>
This commit is contained in:
parent
0387723334
commit
1081066d60
@ -66,13 +66,19 @@ public abstract class AuthorityUtils {
|
||||
return set;
|
||||
}
|
||||
|
||||
public static List<GrantedAuthority> createAuthorityList(String... roles) {
|
||||
List<GrantedAuthority> authorities = new ArrayList<>(roles.length);
|
||||
/**
|
||||
* Converts authorities into a List of GrantedAuthority objects.
|
||||
*
|
||||
* @param authorities the authorities to convert
|
||||
* @return a List of GrantedAuthority objects
|
||||
*/
|
||||
public static List<GrantedAuthority> createAuthorityList(String... authorities) {
|
||||
List<GrantedAuthority> grantedAuthorities = new ArrayList<>(authorities.length);
|
||||
|
||||
for (String role : roles) {
|
||||
authorities.add(new SimpleGrantedAuthority(role));
|
||||
for (String authority : authorities) {
|
||||
grantedAuthorities.add(new SimpleGrantedAuthority(authority));
|
||||
}
|
||||
|
||||
return authorities;
|
||||
return grantedAuthorities;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user