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;
|
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) {
|
for (String authority : authorities) {
|
||||||
authorities.add(new SimpleGrantedAuthority(role));
|
grantedAuthorities.add(new SimpleGrantedAuthority(authority));
|
||||||
}
|
}
|
||||||
|
|
||||||
return authorities;
|
return grantedAuthorities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue