T - The type of the token identifierAbstractDelegationTokenSecretManager@Public
@Evolving
public abstract class SecretManager<T extends TokenIdentifier>
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
SecretManager.InvalidToken |
The token was invalid and the message explains why.
|
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
SecretManager() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
checkAvailableForRead() |
No-op if the secret manager is available for reading tokens, throw a
StandbyException otherwise.
|
abstract T |
createIdentifier() |
Create an empty token identifier.
|
static byte[] |
createPassword(byte[] identifier,
javax.crypto.SecretKey key) |
Compute HMAC of the identifier using the secret key and return the
output as password
|
protected abstract byte[] |
createPassword(T identifier) |
Create the password for the given identifier.
|
protected static javax.crypto.SecretKey |
createSecretKey(byte[] key) |
Convert the byte[] to a secret key
|
protected javax.crypto.SecretKey |
generateSecret() |
Generate a new random secret key.
|
byte[] |
retriableRetrievePassword(T identifier) |
The same functionality with
retrievePassword(T), except that this
method can throw a RetriableException or a StandbyException
to indicate that client can retry/failover the same operation because of
temporary issue on the server side. |
abstract byte[] |
retrievePassword(T identifier) |
Retrieve the password for the given token identifier.
|
static void |
update(Configuration conf) |
Updates the selected cryptographic algorithm and key length using the provided
Hadoop
Configuration. |
public static void update(Configuration conf)
Configuration. This method reads the values for
HADOOP_SECURITY_SECRET_MANAGER_KEY_GENERATOR_ALGORITHM_KEY and
HADOOP_SECURITY_SECRET_MANAGER_KEY_LENGTH_KEY, or uses default values if not set.conf - the configuration object containing cryptographic settingsprotected abstract byte[] createPassword(T identifier)
identifier - the identifier to usepublic abstract byte[] retrievePassword(T identifier) throws SecretManager.InvalidToken
identifier - the identifier to validateSecretManager.InvalidToken - the token was invalidpublic byte[] retriableRetrievePassword(T identifier) throws SecretManager.InvalidToken, StandbyException, RetriableException, java.io.IOException
retrievePassword(T), except that this
method can throw a RetriableException or a StandbyException
to indicate that client can retry/failover the same operation because of
temporary issue on the server side.identifier - the identifier to validateSecretManager.InvalidToken - the token was invalidStandbyException - the server is in standby state, the client can
try other serversRetriableException - the token was invalid, and the server thinks
this may be a temporary issue and suggests the client to retryjava.io.IOException - to allow future exceptions to be added without breaking
compatibilitypublic abstract T createIdentifier()
public void checkAvailableForRead()
throws StandbyException
StandbyException - if the secret manager is not available to read
tokensprotected javax.crypto.SecretKey generateSecret()
public static byte[] createPassword(byte[] identifier,
javax.crypto.SecretKey key)
identifier - the bytes of the identifierkey - the secret keyprotected static javax.crypto.SecretKey createSecretKey(byte[] key)
key - the byte[] to create a secret key fromCopyright © 2008–2025 Apache Software Foundation. All rights reserved.