public class SAPOfflineTokenServicesCloud extends Object implements org.springframework.security.oauth2.provider.token.ResourceServerTokenServices, org.springframework.beans.factory.InitializingBean
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<scope>provided</scope>
</dependency>
By default it used Apache Rest Client for communicating with the OAuth2
Server.| Constructor and Description |
|---|
SAPOfflineTokenServicesCloud()
Constructs an instance which is preconfigured for XSUAA service configuration
from SAP CP Environment.
|
SAPOfflineTokenServicesCloud(OAuth2ServiceConfiguration serviceConfiguration)
Constructs an instance with custom configuration.
|
SAPOfflineTokenServicesCloud(OAuth2ServiceConfiguration serviceConfiguration,
org.springframework.web.client.RestOperations restOperations)
Constructs an instance with custom configuration and rest template.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
org.springframework.security.oauth2.provider.OAuth2Authentication |
loadAuthentication(String accessToken) |
org.springframework.security.oauth2.common.OAuth2AccessToken |
readAccessToken(String accessToken) |
SAPOfflineTokenServicesCloud |
setLocalScopeAsAuthorities(boolean extractLocalScopesOnly)
This method allows to overwrite the default behavior of the authorities
converter implementation.
|
public SAPOfflineTokenServicesCloud()
public SAPOfflineTokenServicesCloud(OAuth2ServiceConfiguration serviceConfiguration)
serviceConfiguration - the service configuration. You can use
Environments in order to
load service configuration from the binding information in your
environment.public SAPOfflineTokenServicesCloud(OAuth2ServiceConfiguration serviceConfiguration, org.springframework.web.client.RestOperations restOperations)
serviceConfiguration - the service configuration. You can use
Environments in order to
load service configuration from the binding information in your
environment.restOperations - the spring rest templatepublic org.springframework.security.oauth2.provider.OAuth2Authentication loadAuthentication(@Nonnull String accessToken) throws org.springframework.security.core.AuthenticationException, org.springframework.security.oauth2.common.exceptions.InvalidTokenException
loadAuthentication in interface org.springframework.security.oauth2.provider.token.ResourceServerTokenServicesorg.springframework.security.core.AuthenticationExceptionorg.springframework.security.oauth2.common.exceptions.InvalidTokenExceptionpublic void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic org.springframework.security.oauth2.common.OAuth2AccessToken readAccessToken(String accessToken)
readAccessToken in interface org.springframework.security.oauth2.provider.token.ResourceServerTokenServicespublic SAPOfflineTokenServicesCloud setLocalScopeAsAuthorities(boolean extractLocalScopesOnly)
extractLocalScopesOnly - true when only local scopes are extracted. Local scopes means that
non-application specific scopes are filtered out and scopes are
returned without appId prefix, e.g. "Display".Copyright © 2020. All rights reserved.