org.springframework.security.oauth2.client.token
Interface AccessTokenProvider

All Known Implementing Classes:
AccessTokenProviderChain, AuthorizationCodeAccessTokenProvider, ClientCredentialsAccessTokenProvider, ImplicitAccessTokenProvider, ResourceOwnerPasswordAccessTokenProvider

public interface AccessTokenProvider

A manager for an , which knows how to obtain an access token for a specific resources.

Author:
Ryan Heaton, Dave Syer

Method Summary
 OAuth2AccessToken obtainAccessToken(OAuth2ProtectedResourceDetails details, AccessTokenRequest parameters)
          Obtain a new access token for the specified protected resource.
 OAuth2AccessToken refreshAccessToken(OAuth2ProtectedResourceDetails resource, OAuth2RefreshToken refreshToken, AccessTokenRequest request)
           
 boolean supportsRefresh(OAuth2ProtectedResourceDetails resource)
           
 boolean supportsResource(OAuth2ProtectedResourceDetails resource)
          Whether this provider supports the specified resource.
 

Method Detail

obtainAccessToken

OAuth2AccessToken obtainAccessToken(OAuth2ProtectedResourceDetails details,
                                    AccessTokenRequest parameters)
                                    throws UserRedirectRequiredException,
                                           UserApprovalRequiredException,
                                           org.springframework.security.access.AccessDeniedException
Obtain a new access token for the specified protected resource.

Parameters:
details - The protected resource for which this provider is to obtain an access token.
parameters - The parameters of the request giving context for the token details if any.
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.
UserApprovalRequiredException - If the provider is ready to issue a token but only if the user approves
org.springframework.security.access.AccessDeniedException - If the user denies access to the protected resource.

supportsResource

boolean supportsResource(OAuth2ProtectedResourceDetails resource)
Whether this provider supports the specified resource.

Parameters:
resource - The resource.
Returns:
Whether this provider supports the specified resource.

refreshAccessToken

OAuth2AccessToken refreshAccessToken(OAuth2ProtectedResourceDetails resource,
                                     OAuth2RefreshToken refreshToken,
                                     AccessTokenRequest request)
                                     throws UserRedirectRequiredException
Parameters:
resource - the resource for which a token refresh is required
refreshToken - the refresh token to send
Returns:
an access token
Throws:
UserRedirectRequiredException

supportsRefresh

boolean supportsRefresh(OAuth2ProtectedResourceDetails resource)
Parameters:
resource - The resource to check
Returns:
true if this provider can refresh an access token


Copyright © 2012. All Rights Reserved.