org.springframework.security.oauth2.client.code
Class AuthorizationCodeAccessTokenProvider

java.lang.Object
  extended by org.springframework.security.oauth2.client.provider.OAuth2AccessTokenSupport
      extended by org.springframework.security.oauth2.client.code.AuthorizationCodeAccessTokenProvider
All Implemented Interfaces:
InitializingBean, OAuth2AccessTokenProvider

public class AuthorizationCodeAccessTokenProvider
extends OAuth2AccessTokenSupport
implements OAuth2AccessTokenProvider

Provider for obtaining an oauth2 access token by using an authorization code.

Author:
Ryan Heaton, Dave Syer

Field Summary
 
Fields inherited from class org.springframework.security.oauth2.client.provider.OAuth2AccessTokenSupport
FORM_MEDIA_TYPE, JSON_MEDIA_TYPE, logger
 
Constructor Summary
AuthorizationCodeAccessTokenProvider()
           
 
Method Summary
 OAuth2AccessToken obtainNewAccessToken(OAuth2ProtectedResourceDetails details)
          Obtain a new access token for the specified protected resource.
 boolean supportsResource(OAuth2ProtectedResourceDetails resource)
          Whether this provider supports the specified resource.
 
Methods inherited from class org.springframework.security.oauth2.client.provider.OAuth2AccessTokenSupport
afterPropertiesSet, getAuthenticationHandler, getRestTemplate, getSerializationService, retrieveToken, setAuthenticationHandler, setSerializationService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizationCodeAccessTokenProvider

public AuthorizationCodeAccessTokenProvider()
Method Detail

supportsResource

public boolean supportsResource(OAuth2ProtectedResourceDetails resource)
Description copied from interface: OAuth2AccessTokenProvider
Whether this provider supports the specified resource.

Specified by:
supportsResource in interface OAuth2AccessTokenProvider
Parameters:
resource - The resource.
Returns:
Whether this provider supports the specified resource.

obtainNewAccessToken

public OAuth2AccessToken obtainNewAccessToken(OAuth2ProtectedResourceDetails details)
                                       throws UserRedirectRequiredException,
                                              org.springframework.security.access.AccessDeniedException
Description copied from interface: OAuth2AccessTokenProvider
Obtain a new access token for the specified protected resource.

Specified by:
obtainNewAccessToken in interface OAuth2AccessTokenProvider
Parameters:
details - The protected resource for which this provider is to obtain an access token.
Returns:
The access token for the specified protected resource. The return value may NOT be null.
Throws:
UserRedirectRequiredException - If the provider requires the current user to be redirected for authorization.
org.springframework.security.access.AccessDeniedException - If the user denies access to the protected resource.


Copyright © 2011. All Rights Reserved.