fr.cnes.sitools.security.challenge
Class ChallengeTokenContainer

java.lang.Object
  extended by fr.cnes.sitools.security.challenge.ChallengeTokenContainer
All Implemented Interfaces:
ChallengeToken

public class ChallengeTokenContainer
extends java.lang.Object
implements ChallengeToken

ChallengeToken implementation based on a Guava Cache

Author:
m.gond

Constructor Summary
ChallengeTokenContainer(long cacheLimitTime, long cacheMaxSize)
          Instantiates a new challenge token container.
 
Method Summary
 java.lang.String getToken(java.lang.String value)
          Gets a new valid Token.
 java.lang.String getTokenValue(java.lang.String token)
          Get the value associated to the given token. null if the token doesn't exists
 void invalidToken(java.lang.String token)
          Manually invalidate a token
 boolean isValid(java.lang.String token)
          Check if the given token is valid
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChallengeTokenContainer

public ChallengeTokenContainer(long cacheLimitTime,
                               long cacheMaxSize)
Instantiates a new challenge token container.

Parameters:
cacheLimitTime - the cache limit time
cacheMaxSize - the cache max size
Method Detail

getToken

public java.lang.String getToken(java.lang.String value)
Description copied from interface: ChallengeToken
Gets a new valid Token. Stores the given value associated to that token

Specified by:
getToken in interface ChallengeToken
Parameters:
value - the value to associate
Returns:
the token String

getTokenValue

public java.lang.String getTokenValue(java.lang.String token)
Description copied from interface: ChallengeToken
Get the value associated to the given token. null if the token doesn't exists

Specified by:
getTokenValue in interface ChallengeToken
Parameters:
token - the token
Returns:
the value associated to the given token or null if the token doesn't exists

isValid

public boolean isValid(java.lang.String token)
Description copied from interface: ChallengeToken
Check if the given token is valid

Specified by:
isValid in interface ChallengeToken
Parameters:
token - the token String to check
Returns:
true if the token is valid, false otherwise

invalidToken

public void invalidToken(java.lang.String token)
Description copied from interface: ChallengeToken
Manually invalidate a token

Specified by:
invalidToken in interface ChallengeToken
Parameters:
token - the token to invalidate


Copyright © 2010-2013 CNES. All Rights Reserved.