Class UserInfoTokenServices
- java.lang.Object
- org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices
- All Implemented Interfaces:
org.springframework.security.oauth2.provider.token.ResourceServerTokenServices
public class UserInfoTokenServices extends Object implements org.springframework.security.oauth2.provider.token.ResourceServerTokenServices
ResourceServerTokenServices
that uses a user info REST service.- Since:
- 1.3.0
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Log
logger
Constructor Summary
Constructors Constructor Description UserInfoTokenServices(String userInfoEndpointUrl, String clientId)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
getPrincipal(Map<String,Object> map)
Return the principal that should be used for the token.org.springframework.security.oauth2.provider.OAuth2Authentication
loadAuthentication(String accessToken)
org.springframework.security.oauth2.common.OAuth2AccessToken
readAccessToken(String accessToken)
void
setAuthoritiesExtractor(AuthoritiesExtractor authoritiesExtractor)
void
setPrincipalExtractor(PrincipalExtractor principalExtractor)
void
setRestTemplate(org.springframework.security.oauth2.client.OAuth2RestOperations restTemplate)
void
setTokenType(String tokenType)
Field Detail
logger
protected final org.apache.commons.logging.Log logger
Constructor Detail
UserInfoTokenServices
public UserInfoTokenServices(String userInfoEndpointUrl, String clientId)
Method Detail
setTokenType
public void setTokenType(String tokenType)
setRestTemplate
public void setRestTemplate(org.springframework.security.oauth2.client.OAuth2RestOperations restTemplate)
setAuthoritiesExtractor
public void setAuthoritiesExtractor(AuthoritiesExtractor authoritiesExtractor)
setPrincipalExtractor
public void setPrincipalExtractor(PrincipalExtractor principalExtractor)
loadAuthentication
public org.springframework.security.oauth2.provider.OAuth2Authentication loadAuthentication(String accessToken) throws org.springframework.security.core.AuthenticationException, org.springframework.security.oauth2.common.exceptions.InvalidTokenException
- Specified by:
loadAuthentication
in interfaceorg.springframework.security.oauth2.provider.token.ResourceServerTokenServices
- Throws:
org.springframework.security.core.AuthenticationException
org.springframework.security.oauth2.common.exceptions.InvalidTokenException
getPrincipal
protected Object getPrincipal(Map<String,Object> map)
Return the principal that should be used for the token. The default implementation delegates to thePrincipalExtractor
.- Parameters:
map
- the source map- Returns:
- the principal or "unknown"
readAccessToken
public org.springframework.security.oauth2.common.OAuth2AccessToken readAccessToken(String accessToken)
- Specified by:
readAccessToken
in interfaceorg.springframework.security.oauth2.provider.token.ResourceServerTokenServices