public class HashMapTokenMapStrategy extends Object implements TokenMapStrategy
TokenMapStrategy
, simply using a HashMap
.
TokenMapStrategy
.Modifier and Type | Field and Description |
---|---|
static Map<String,String> |
TEMPORARY_TOKEN_TOKEN_SECRET_MAP
The map which persistently maps temporary tokens to temporary token secrets.
|
Constructor and Description |
---|
HashMapTokenMapStrategy() |
Modifier and Type | Method and Description |
---|---|
String |
fetchTemporaryTokenSecretForTemporaryToken(String temporaryToken)
Uses
Map.get(Object) to obtain the temporary token secret mapped to the given temporary token. |
void |
mapTemporaryTokenToTemporaryTokenSecret(String temporaryToken,
String temporaryTokenSecret)
Uses
Map.put(Object, Object) to map the given temporary token to the given temporary token secret. |
public void mapTemporaryTokenToTemporaryTokenSecret(@Nonnull String temporaryToken, @Nonnull String temporaryTokenSecret) throws TokenMapException
Map.put(Object, Object)
to map the given temporary token to the given temporary token secret.mapTemporaryTokenToTemporaryTokenSecret
in interface TokenMapStrategy
temporaryToken
- The temporary token, i.e. the "key" of the mapping. In the future, we will fetch from the map this key, and return its corresponding temporary token secret.temporaryTokenSecret
- The temporary token secret, i.e. the "value" of the mapping. In the future, this value will be returned from the map after fetching its corresponding temporary token.TokenMapException
- If the mapping failed.@Nullable public String fetchTemporaryTokenSecretForTemporaryToken(@Nonnull String temporaryToken) throws TokenMapException
Map.get(Object)
to obtain the temporary token secret mapped to the given temporary token.fetchTemporaryTokenSecretForTemporaryToken
in interface TokenMapStrategy
temporaryToken
- The temporary token, i.e. the "key" which we would like to retrieve the value of in the map.TokenMapException
- If the lookup failed.Copyright © 2020. All rights reserved.