Package org.apache.rahas
Class SimpleTokenStore
java.lang.Object
org.apache.rahas.SimpleTokenStore
- All Implemented Interfaces:
Serializable
,TokenStorage
In-memory implementation of the token storage
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Lock
protected final ReadWriteLock
We use a read write lock to improve concurrency while avoiding concurrent modification exceptions.protected Map
protected final Lock
Fields inherited from interface org.apache.rahas.TokenStorage
TOKEN_STORAGE_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given token to the list.Token[]
Return the list of CANCELLED tokensToken[]
Return the list ofEXPIRED
tokens.static String
getIdFromSTR
(org.apache.axiom.om.OMElement str) Token[]
Return the list of RENEWED tokens.Returns theToken
of the given idString[]
Return the list of all token identifiers.Token[]
Return the list of ISSUED and RENEWED tokens.protected void
processTokenExpiry
(Token token) void
removeToken
(String id) Removes the given token from token storage.void
Update an existing token.
-
Field Details
-
tokens
-
readWriteLock
We use a read write lock to improve concurrency while avoiding concurrent modification exceptions. We allow concurrent reads and avoid concurrent reads and modifications ReentrantReadWriteLock supports a maximum of 65535 recursive write locks and 65535 read locks -
readLock
-
writeLock
-
-
Constructor Details
-
SimpleTokenStore
public SimpleTokenStore()
-
-
Method Details
-
add
Description copied from interface:TokenStorage
Add the given token to the list.- Specified by:
add
in interfaceTokenStorage
- Parameters:
token
- The token to be added- Throws:
TrustException
-
update
Description copied from interface:TokenStorage
Update an existing token.- Specified by:
update
in interfaceTokenStorage
- Throws:
TrustException
-
getTokenIdentifiers
Description copied from interface:TokenStorage
Return the list of all token identifiers.- Specified by:
getTokenIdentifiers
in interfaceTokenStorage
- Returns:
- As array of token identifiers
- Throws:
TrustException
-
getValidTokens
Description copied from interface:TokenStorage
Return the list of ISSUED and RENEWED tokens.- Specified by:
getValidTokens
in interfaceTokenStorage
- Returns:
- An array of ISSUED and RENEWED
Tokens
. - Throws:
TrustException
-
getRenewedTokens
Description copied from interface:TokenStorage
Return the list of RENEWED tokens.- Specified by:
getRenewedTokens
in interfaceTokenStorage
- Returns:
- An array of RENEWED
Tokens
- Throws:
TrustException
-
getCancelledTokens
Description copied from interface:TokenStorage
Return the list of CANCELLED tokens- Specified by:
getCancelledTokens
in interfaceTokenStorage
- Returns:
- An array of CANCELLED
Tokens
- Throws:
TrustException
-
getExpiredTokens
Description copied from interface:TokenStorage
Return the list ofEXPIRED
tokens. If there are noEXPIRED
tokensnull
will be returned- Specified by:
getExpiredTokens
in interfaceTokenStorage
- Returns:
- An array of expired
Tokens
- Throws:
TrustException
-
getToken
Description copied from interface:TokenStorage
Returns theToken
of the given id- Specified by:
getToken
in interfaceTokenStorage
- Returns:
- The requested
Token
identified by the give id - Throws:
TrustException
-
removeToken
Description copied from interface:TokenStorage
Removes the given token from token storage.- Specified by:
removeToken
in interfaceTokenStorage
- Parameters:
id
- Token id to remove.
-
processTokenExpiry
- Throws:
TrustException
-
getIdFromSTR
-