diff --git a/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java b/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java index 4cfe410067..df67a2aba1 100644 --- a/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java +++ b/core/src/main/java/org/springframework/security/core/authority/AuthorityUtils.java @@ -66,13 +66,19 @@ public abstract class AuthorityUtils { return set; } - public static List createAuthorityList(String... roles) { - List 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 createAuthorityList(String... authorities) { + List 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; } }