org.springframework.security.oauth.provider.token
Class InMemoryProviderTokenServices

java.lang.Object
  extended by org.springframework.security.oauth.provider.token.RandomValueProviderTokenServices
      extended by org.springframework.security.oauth.provider.token.InMemoryProviderTokenServices
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, OAuthProviderTokenServices

public class InMemoryProviderTokenServices
extends RandomValueProviderTokenServices
implements org.springframework.beans.factory.DisposableBean

Implementation of TokenServices that stores tokens in memory. The in-memory token services schedule a task to clean up any expired sessions.

Author:
Ryan Heaton

Field Summary
protected  java.util.concurrent.ConcurrentHashMap<java.lang.String,OAuthProviderTokenImpl> tokenStore
           
 
Constructor Summary
InMemoryProviderTokenServices()
           
 
Method Summary
 void afterPropertiesSet()
          Initialze these token services.
 void destroy()
           
 java.lang.Integer getCleanupIntervalSeconds()
          The interval at which to schedule cleanup.
protected  OAuthProviderTokenImpl readToken(java.lang.String token)
          Read a token from persistence.
protected  void removeToken(java.lang.String tokenValue)
          Remove a token from persistence.
 void setCleanupIntervalSeconds(java.lang.Integer cleanupIntervalSeconds)
          The interval at which to schedule cleanup.
protected  void storeToken(java.lang.String tokenValue, OAuthProviderTokenImpl token)
          Store a token from persistence.
 
Methods inherited from class org.springframework.security.oauth.provider.token.RandomValueProviderTokenServices
authorizeRequestToken, createAccessToken, createUnauthorizedRequestToken, getAccessTokenValiditySeconds, getRandom, getRequestTokenValiditySeconds, getToken, getTokenSecretLengthBytes, isExpired, setAccessTokenValiditySeconds, setRandom, setRequestTokenValiditySeconds, setTokenSecretLengthBytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenStore

protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,OAuthProviderTokenImpl> tokenStore
Constructor Detail

InMemoryProviderTokenServices

public InMemoryProviderTokenServices()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Description copied from class: RandomValueProviderTokenServices
Initialze these token services. If no random generator is set, one will be created.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class RandomValueProviderTokenServices
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
java.lang.Exception

readToken

protected OAuthProviderTokenImpl readToken(java.lang.String token)
Description copied from class: RandomValueProviderTokenServices
Read a token from persistence.

Specified by:
readToken in class RandomValueProviderTokenServices
Parameters:
token - The token to read.
Returns:
The token, or null if the token doesn't exist.

storeToken

protected void storeToken(java.lang.String tokenValue,
                          OAuthProviderTokenImpl token)
Description copied from class: RandomValueProviderTokenServices
Store a token from persistence.

Specified by:
storeToken in class RandomValueProviderTokenServices
Parameters:
tokenValue - The token value.
token - The token to store.

removeToken

protected void removeToken(java.lang.String tokenValue)
Description copied from class: RandomValueProviderTokenServices
Remove a token from persistence.

Specified by:
removeToken in class RandomValueProviderTokenServices
Parameters:
tokenValue - The token to remove.

getCleanupIntervalSeconds

public java.lang.Integer getCleanupIntervalSeconds()
The interval at which to schedule cleanup. (<= 0 for never).

Returns:
The interval at which to schedule cleanup.

setCleanupIntervalSeconds

public void setCleanupIntervalSeconds(java.lang.Integer cleanupIntervalSeconds)
The interval at which to schedule cleanup.

Parameters:
cleanupIntervalSeconds - The interval at which to schedule cleanup.


Copyright © 2008. All Rights Reserved.