org.springframework.security.oauth2.provider.token
Interface TokenStore

All Known Implementing Classes:
InMemoryTokenStore, JdbcTokenStore

public interface TokenStore

Persistence interface for OAuth2 tokens.


Method Summary
 Collection<OAuth2AccessToken> findTokensByClientId(String clientId)
           
 Collection<OAuth2AccessToken> findTokensByUserName(String userName)
           
 OAuth2AccessToken getAccessToken(OAuth2Authentication authentication)
          Retrieve an access token stored against the provided authentication key, if it exists.
 OAuth2AccessToken readAccessToken(String tokenValue)
          Read an access token from the store.
 OAuth2Authentication readAuthentication(OAuth2AccessToken token)
          Read the authentication stored under the specified token value.
 OAuth2Authentication readAuthentication(String token)
          Read the authentication stored under the specified token value.
 OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token)
           
 OAuth2RefreshToken readRefreshToken(String tokenValue)
          Read a refresh token from the store.
 void removeAccessToken(OAuth2AccessToken token)
          Remove an access token from the database.
 void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken)
          Remove an access token using a refresh token.
 void removeRefreshToken(OAuth2RefreshToken token)
          Remove a refresh token from the database.
 void storeAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication)
          Store an access token.
 void storeRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication)
          Store the specified refresh token in the database.
 

Method Detail

readAuthentication

OAuth2Authentication readAuthentication(OAuth2AccessToken token)
Read the authentication stored under the specified token value.

Parameters:
token - The token value under which the authentication is stored.
Returns:
The authentication, or null if none.

readAuthentication

OAuth2Authentication readAuthentication(String token)
Read the authentication stored under the specified token value.

Parameters:
token - The token value under which the authentication is stored.
Returns:
The authentication, or null if none.

storeAccessToken

void storeAccessToken(OAuth2AccessToken token,
                      OAuth2Authentication authentication)
Store an access token.

Parameters:
token - The token to store.
authentication - The authentication associated with the token.

readAccessToken

OAuth2AccessToken readAccessToken(String tokenValue)
Read an access token from the store.

Parameters:
tokenValue - The token value.
Returns:
The access token to read.

removeAccessToken

void removeAccessToken(OAuth2AccessToken token)
Remove an access token from the database.

Parameters:
token - The token to remove from the database.

storeRefreshToken

void storeRefreshToken(OAuth2RefreshToken refreshToken,
                       OAuth2Authentication authentication)
Store the specified refresh token in the database.

Parameters:
refreshToken - The refresh token to store.
authentication - The authentication associated with the refresh token.

readRefreshToken

OAuth2RefreshToken readRefreshToken(String tokenValue)
Read a refresh token from the store.

Parameters:
tokenValue - The value of the token to read.
Returns:
The token.

readAuthenticationForRefreshToken

OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token)
Parameters:
token - a refresh token
Returns:
the authentication originally used to grant the refresh token

removeRefreshToken

void removeRefreshToken(OAuth2RefreshToken token)
Remove a refresh token from the database.

Parameters:
token - The token to remove from the database.

removeAccessTokenUsingRefreshToken

void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken)
Remove an access token using a refresh token. This functionality is necessary so refresh tokens can't be used to create an unlimited number of access tokens.

Parameters:
refreshToken - The refresh token.

getAccessToken

OAuth2AccessToken getAccessToken(OAuth2Authentication authentication)
Retrieve an access token stored against the provided authentication key, if it exists.

Parameters:
authentication - the authentication key for the access token
Returns:
the access token or null if there was none

findTokensByUserName

Collection<OAuth2AccessToken> findTokensByUserName(String userName)
Parameters:
userName - the user name to search
Returns:
a collection of access tokens

findTokensByClientId

Collection<OAuth2AccessToken> findTokensByClientId(String clientId)
Parameters:
clientId - the client id
Returns:
a collection of access tokens


Copyright © 2012. All Rights Reserved.