public class ClientScopeVoter extends Object implements org.springframework.security.access.AccessDecisionVoter<Object>
CLIENT_HAS_SCOPE
to security attributes.Constructor and Description |
---|
ClientScopeVoter() |
Modifier and Type | Method and Description |
---|---|
void |
setClientAuthoritiesAreScopes(boolean clientAuthoritiesAreScopes)
Flag to signal that when there is no user authentication client authorities are to be treated as scopes.
|
void |
setClientDetailsService(ClientDetailsService clientDetailsService)
ClientDetailsService for looking up clients by ID.
|
void |
setDenyAccess(String denyAccess)
The name of the config attribute that can be used to deny access to OAuth2 client.
|
void |
setThrowException(boolean throwException)
Flag to determine the behaviour on access denied.
|
boolean |
supports(Class<?> clazz)
This implementation supports any type of class, because it does not query the presented secure object.
|
boolean |
supports(org.springframework.security.access.ConfigAttribute attribute) |
int |
vote(org.springframework.security.core.Authentication authentication,
Object object,
Collection<org.springframework.security.access.ConfigAttribute> attributes) |
public void setClientDetailsService(ClientDetailsService clientDetailsService)
clientDetailsService
- the client details service (mandatory)public void setThrowException(boolean throwException)
InsufficientScopeException
instead of returning AccessDecisionVoter.ACCESS_DENIED
. This is unconventional for an access decision
voter because it vetos the other voters in the chain, but it enables us to pass a message to the caller with
information about the required scope.throwException
- the flag to set (default true)public void setClientAuthoritiesAreScopes(boolean clientAuthoritiesAreScopes)
clientAuthoritiesAreScopes
- the flag value (default true)public void setDenyAccess(String denyAccess)
DENY_OAUTH
.denyAccess
- the deny access attribute value to setpublic boolean supports(org.springframework.security.access.ConfigAttribute attribute)
supports
in interface org.springframework.security.access.AccessDecisionVoter<Object>
public boolean supports(Class<?> clazz)
supports
in interface org.springframework.security.access.AccessDecisionVoter<Object>
clazz
- the secure objecttrue
public int vote(org.springframework.security.core.Authentication authentication, Object object, Collection<org.springframework.security.access.ConfigAttribute> attributes)
vote
in interface org.springframework.security.access.AccessDecisionVoter<Object>
Copyright © 2019. All rights reserved.