|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.security.authentication.util.SignerSecretProvider
org.apache.hadoop.security.authentication.util.RolloverSignerSecretProvider
@InterfaceStability.Unstable @InterfaceAudience.Private public abstract class RolloverSignerSecretProvider
An abstract SignerSecretProvider that can be use used as the base for a rolling secret. The secret will roll over at the same interval as the token validity, so there are only ever a maximum of two valid secrets at any given time. This class handles storing and returning the secrets, as well as the rolling over. At a minimum, subclasses simply need to implement the generateNewSecret() method. More advanced implementations can override other methods to provide more advanced behavior, but should be careful when doing so.
| Constructor Summary | |
|---|---|
RolloverSignerSecretProvider()
|
|
| Method Summary | |
|---|---|
void |
destroy()
Will be called on shutdown; subclasses should perform any cleanup here. |
protected abstract byte[] |
generateNewSecret()
Subclasses should implement this to return a new secret. |
byte[][] |
getAllSecrets()
Returns all secrets that a cookie could have been signed with and are still valid; this should include the secret returned by getCurrentSecret(). |
byte[] |
getCurrentSecret()
Returns the current secret to be used by the Signer for signing new cookies. |
void |
init(Properties config,
javax.servlet.ServletContext servletContext,
long tokenValidity)
Initialize the SignerSecretProvider. |
protected void |
initSecrets(byte[] currentSecret,
byte[] previousSecret)
Initializes the secrets array. |
protected void |
rollSecret()
Rolls the secret. |
protected void |
startScheduler(long initialDelay,
long period)
Starts the scheduler for the rollover to run at an interval. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RolloverSignerSecretProvider()
| Method Detail |
|---|
public void init(Properties config,
javax.servlet.ServletContext servletContext,
long tokenValidity)
throws Exception
init in class SignerSecretProviderconfig - configuration propertiesservletContext - servlet contexttokenValidity - The amount of time a token is valid for
Exception
protected void initSecrets(byte[] currentSecret,
byte[] previousSecret)
currentSecret - The current secretpreviousSecret - The previous secret
protected void startScheduler(long initialDelay,
long period)
initialDelay - The initial delay in the rollover in millisecondsperiod - The interval for the rollover in millisecondspublic void destroy()
SignerSecretProvider
destroy in class SignerSecretProviderprotected void rollSecret()
protected abstract byte[] generateNewSecret()
public byte[] getCurrentSecret()
SignerSecretProviderCallers should be careful not to modify the returned value.
getCurrentSecret in class SignerSecretProviderpublic byte[][] getAllSecrets()
SignerSecretProviderCallers should be careful not to modify the returned value.
getAllSecrets in class SignerSecretProvider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||