public class TokenManager
extends com.google.common.util.concurrent.AbstractIdleService
AccessTokens.| Modifier and Type | Field and Description |
|---|---|
protected KeyManager |
keyManager |
| Constructor and Description |
|---|
TokenManager(KeyManager keyManager,
Codec<AccessTokenIdentifier> identifierCodec) |
| Modifier and Type | Method and Description |
|---|---|
void |
shutDown() |
AccessToken |
signIdentifier(AccessTokenIdentifier identifier)
Generates a signature for the given token value, using the currently active secret key.
|
void |
startUp() |
void |
validateSecret(AccessToken token)
Given an
AccessToken instance, checks that the token has not yet expired and that the digest matches
the expected value. |
protected final KeyManager keyManager
@Inject public TokenManager(KeyManager keyManager, Codec<AccessTokenIdentifier> identifierCodec)
public void startUp()
startUp in class com.google.common.util.concurrent.AbstractIdleServicepublic void shutDown()
shutDown in class com.google.common.util.concurrent.AbstractIdleServicepublic AccessToken signIdentifier(AccessTokenIdentifier identifier)
identifier - Verified identity for which a token should be generated.public void validateSecret(AccessToken token) throws InvalidTokenException
AccessToken instance, checks that the token has not yet expired and that the digest matches
the expected value. To validate the token digest, we recompute the digest value, based on the asserted identity
and our own view of the secret keys.token - The token instance to validate.InvalidTokenException - If the provided token instance is expired or the digest does not match the
recomputed value.Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.