Polish gh-11188
This commit is contained in:
parent
f34ea188e2
commit
2b4794475e
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.security.authorization;
|
package org.springframework.security.authorization;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -133,7 +132,7 @@ public final class AuthorityAuthorizationManager<T> implements AuthorizationMana
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAuthorized(Authentication authentication) {
|
private boolean isAuthorized(Authentication authentication) {
|
||||||
Set<String> authorities = getAuthoritySet();
|
Set<String> authorities = AuthorityUtils.authorityListToSet(this.authorities);
|
||||||
for (GrantedAuthority grantedAuthority : authentication.getAuthorities()) {
|
for (GrantedAuthority grantedAuthority : authentication.getAuthorities()) {
|
||||||
if (authorities.contains(grantedAuthority.getAuthority())) {
|
if (authorities.contains(grantedAuthority.getAuthority())) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -142,14 +141,6 @@ public final class AuthorityAuthorizationManager<T> implements AuthorizationMana
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> getAuthoritySet() {
|
|
||||||
Set<String> result = new HashSet<>();
|
|
||||||
for (GrantedAuthority grantedAuthority : this.authorities) {
|
|
||||||
result.add(grantedAuthority.getAuthority());
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AuthorityAuthorizationManager[authorities=" + this.authorities + "]";
|
return "AuthorityAuthorizationManager[authorities=" + this.authorities + "]";
|
||||||
|
|
Loading…
Reference in New Issue