org.springframework.security.oauth2.client.token
接口 AccessTokenProvider

所有已知实现类:
AccessTokenProviderChain, AuthorizationCodeAccessTokenProvider, ClientCredentialsAccessTokenProvider, ImplicitAccessTokenProvider, ResourceOwnerPasswordAccessTokenProvider

public interface AccessTokenProvider

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

作者:
Ryan Heaton, Dave Syer

方法摘要
 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.
 

方法详细信息

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.

参数:
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.
返回:
The access token for the specified protected resource. The return value may NOT be null.
抛出:
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.

参数:
resource - The resource.
返回:
Whether this provider supports the specified resource.

refreshAccessToken

OAuth2AccessToken refreshAccessToken(OAuth2ProtectedResourceDetails resource,
                                     OAuth2RefreshToken refreshToken,
                                     AccessTokenRequest request)
                                     throws UserRedirectRequiredException
参数:
resource - the resource for which a token refresh is required
refreshToken - the refresh token to send
返回:
an access token
抛出:
UserRedirectRequiredException

supportsRefresh

boolean supportsRefresh(OAuth2ProtectedResourceDetails resource)
参数:
resource - The resource to check
返回:
true if this provider can refresh an access token


Copyright © 2013. All rights reserved.