org.springframework.security.oauth2.client.token
Class JdbcClientTokenServices

java.lang.Object
  extended by org.springframework.security.oauth2.client.token.JdbcClientTokenServices
All Implemented Interfaces:
ClientTokenServices

public class JdbcClientTokenServices
extends Object
implements ClientTokenServices

Implementation of token services that stores tokens in a database for retrieval by client applications.

Author:
Dave Syer

Constructor Summary
JdbcClientTokenServices(DataSource dataSource)
           
 
Method Summary
 OAuth2AccessToken getAccessToken(OAuth2ProtectedResourceDetails resource, org.springframework.security.core.Authentication authentication)
          Retrieve the access token for a given resource and user authentication (my be null).
 void removeAccessToken(OAuth2ProtectedResourceDetails resource, org.springframework.security.core.Authentication authentication)
          Remove the token (if any) that is stored with the provided resource and authentication.
 void saveAccessToken(OAuth2ProtectedResourceDetails resource, org.springframework.security.core.Authentication authentication, OAuth2AccessToken accessToken)
          Save or update the access token for this resource and authentication (may be null).
 void setClientKeyGenerator(ClientKeyGenerator keyGenerator)
           
 void setDeleteAccessTokenSql(String deleteAccessTokenSql)
           
 void setInsertAccessTokenSql(String insertAccessTokenSql)
           
 void setSelectAccessTokenSql(String selectAccessTokenSql)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcClientTokenServices

public JdbcClientTokenServices(DataSource dataSource)
Method Detail

setClientKeyGenerator

public void setClientKeyGenerator(ClientKeyGenerator keyGenerator)

getAccessToken

public OAuth2AccessToken getAccessToken(OAuth2ProtectedResourceDetails resource,
                                        org.springframework.security.core.Authentication authentication)
Description copied from interface: ClientTokenServices
Retrieve the access token for a given resource and user authentication (my be null).

Specified by:
getAccessToken in interface ClientTokenServices
Parameters:
resource - the resource to be accessed
authentication - the current user authentication (or null if there is none)
Returns:
an access token if one has been stored, null otherwise

saveAccessToken

public void saveAccessToken(OAuth2ProtectedResourceDetails resource,
                            org.springframework.security.core.Authentication authentication,
                            OAuth2AccessToken accessToken)
Description copied from interface: ClientTokenServices
Save or update the access token for this resource and authentication (may be null).

Specified by:
saveAccessToken in interface ClientTokenServices
Parameters:
resource - the resource to be accessed
authentication - the current user authentication (or null if there is none)
accessToken - an access token to be stored

removeAccessToken

public void removeAccessToken(OAuth2ProtectedResourceDetails resource,
                              org.springframework.security.core.Authentication authentication)
Description copied from interface: ClientTokenServices
Remove the token (if any) that is stored with the provided resource and authentication. If there is no such token do nothing.

Specified by:
removeAccessToken in interface ClientTokenServices
Parameters:
resource - the resource to be accessed
authentication - the current user authentication (or null if there is none)

setInsertAccessTokenSql

public void setInsertAccessTokenSql(String insertAccessTokenSql)

setSelectAccessTokenSql

public void setSelectAccessTokenSql(String selectAccessTokenSql)

setDeleteAccessTokenSql

public void setDeleteAccessTokenSql(String deleteAccessTokenSql)


Copyright © 2012. All Rights Reserved.