From 3f861f7f204bd2f7b13d28a90abc5c63b631bb04 Mon Sep 17 00:00:00 2001 From: Evgeniy Cheban Date: Tue, 10 May 2022 03:21:18 +0300 Subject: [PATCH] Polish gh-11188 --- .../authorization/AuthorityAuthorizationManager.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/core/src/main/java/org/springframework/security/authorization/AuthorityAuthorizationManager.java b/core/src/main/java/org/springframework/security/authorization/AuthorityAuthorizationManager.java index c3dbb4b40f..43af8a5cb8 100644 --- a/core/src/main/java/org/springframework/security/authorization/AuthorityAuthorizationManager.java +++ b/core/src/main/java/org/springframework/security/authorization/AuthorityAuthorizationManager.java @@ -16,7 +16,6 @@ package org.springframework.security.authorization; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.function.Supplier; @@ -133,7 +132,7 @@ public final class AuthorityAuthorizationManager implements AuthorizationMana } private boolean isAuthorized(Authentication authentication) { - Set authorities = getAuthoritySet(); + Set authorities = AuthorityUtils.authorityListToSet(this.authorities); for (GrantedAuthority grantedAuthority : authentication.getAuthorities()) { if (authorities.contains(grantedAuthority.getAuthority())) { return true; @@ -142,14 +141,6 @@ public final class AuthorityAuthorizationManager implements AuthorizationMana return false; } - private Set getAuthoritySet() { - Set result = new HashSet<>(); - for (GrantedAuthority grantedAuthority : this.authorities) { - result.add(grantedAuthority.getAuthority()); - } - return result; - } - @Override public String toString() { return "AuthorityAuthorizationManager[authorities=" + this.authorities + "]";