T - the token typeK - the token key typepublic abstract class AbstractTokenService<T extends Token,K> extends Object implements org.picocontainer.Startable, TokenStore
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CLEANUP_PERIOD_TIME |
static int |
DEFAULT_TOKEN_BYTE_LENGTH
See
tokenByteLength. |
protected int |
delay_time |
protected org.gatein.common.logging.Logger |
log |
protected String |
name |
protected static String |
SERVICE_CONFIG |
protected int |
tokenByteLength
The number of random bits generared by
nextRandom(). |
protected long |
validityMillis |
| Constructor and Description |
|---|
AbstractTokenService(org.exoplatform.container.xml.InitParams initParams) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
cleanExpiredTokens() |
protected abstract K |
decodeKey(String stringKey)
Decode a key from its string representation.
|
abstract T |
deleteToken(K id) |
static <T extends AbstractTokenService<?,?>> |
getInstance(Class<T> classType) |
String |
getName() |
long |
getPeriodTime() |
abstract T |
getToken(K id) |
long |
getValidityTime() |
protected String |
nextRandom() |
protected String |
nextTokenId() |
abstract long |
size() |
void |
start() |
void |
stop() |
org.gatein.wci.security.Credentials |
validateToken(String stringKey,
boolean remove)
Validates a token.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateTokenprotected final org.gatein.common.logging.Logger log
protected static final String SERVICE_CONFIG
protected static final String CLEANUP_PERIOD_TIME
public static final int DEFAULT_TOKEN_BYTE_LENGTH
tokenByteLength. 8 bytes (64 bits) would be enough, but we want to get padding-less Byte64 representation,
so we take the next greater number divisible by 3 which is 9. 9 bytes is equal to 72 bits.protected final int tokenByteLength
nextRandom(). Use values divisible by 3 to produce random strings
consisting only of 0-9, a-z, A-Z, - and _, i.e. URL safe Byte64 without padding.
If a value not divisible by 3 is used the random strings will contain * in addition to the named characters.protected String name
protected long validityMillis
protected int delay_time
public AbstractTokenService(org.exoplatform.container.xml.InitParams initParams)
throws TokenServiceInitializationException
public void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startablepublic static <T extends AbstractTokenService<?,?>> T getInstance(Class<T> classType)
public org.gatein.wci.security.Credentials validateToken(String stringKey, boolean remove)
TokenStorevalidateToken in interface TokenStorestringKey - the token keyremove - true if the token must be removed regardless its validitypublic abstract void cleanExpiredTokens()
public long getValidityTime()
public long getPeriodTime()
public String getName()
protected abstract K decodeKey(String stringKey)
stringKey - the key a s a stringpublic abstract long size()
protected String nextTokenId()
protected String nextRandom()
Copyright © 2018 JBoss by Red Hat. All Rights Reserved.