public abstract class SQLDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier> extends AbstractDelegationTokenSecretManager<TokenIdent>
AbstractDelegationTokenSecretManager that
persists TokenIdentifiers and DelegationKeys in an existing SQL database.AbstractDelegationTokenSecretManager.DelegationTokenInformationSecretManager.InvalidToken| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_SEQ_NUM_BATCH_SIZE |
|
static java.lang.String |
SQL_DTSM_CONF_PREFIX |
|
static java.lang.String |
SQL_DTSM_TOKEN_LOADING_CACHE_EXPIRATION |
|
static long |
SQL_DTSM_TOKEN_LOADING_CACHE_EXPIRATION_DEFAULT |
|
static java.lang.String |
SQL_DTSM_TOKEN_LOADING_CACHE_MAX_SIZE |
|
static long |
SQL_DTSM_TOKEN_LOADING_CACHE_MAX_SIZE_DEFAULT |
|
static java.lang.String |
SQL_DTSM_TOKEN_MAX_CLEANUP_RESULTS |
|
static int |
SQL_DTSM_TOKEN_MAX_CLEANUP_RESULTS_DEFAULT |
allKeys, currentId, currentTokens, delegationTokenSequenceNumber, noInterruptsLock, running, storeTokenTrackingId, tokenOwnerStats| Constructor | Description |
|---|---|
SQLDelegationTokenSecretManager(Configuration conf) |
| Modifier and Type | Method | Description |
|---|---|---|
TokenIdent |
cancelToken(Token<TokenIdent> token,
java.lang.String canceller) |
Cancels a token by removing it from the SQL database.
|
protected abstract void |
deleteDelegationKey(int keyId) |
|
protected abstract void |
deleteToken(int sequenceNum,
byte[] tokenIdentifier) |
|
protected java.util.Map<TokenIdent,AbstractDelegationTokenSecretManager.DelegationTokenInformation> |
getCandidateTokensForCleanup() |
Obtain a list of tokens that will be considered for cleanup, based on the last
time the token was updated in SQL.
|
int |
getCurrentKeyId() |
Obtains the value of the last delegation key id.
|
protected DelegationKey |
getDelegationKey(int keyId) |
Obtains the DelegationKey from the SQL database.
|
int |
getDelegationTokenSeqNum() |
Obtains the value of the last reserved sequence number.
|
protected AbstractDelegationTokenSecretManager.DelegationTokenInformation |
getTokenInfoFromSQL(TokenIdent ident) |
Obtains the DelegationTokenInformation associated with the given
TokenIdentifier in the SQL database.
|
int |
incrementCurrentKeyId() |
Obtains the next available delegation key id that can be allocated to a DelegationKey.
|
int |
incrementDelegationTokenSeqNum() |
Obtains the next available sequence number that can be allocated to a Token.
|
protected abstract int |
incrementKeyId(int amount) |
|
protected abstract int |
incrementSequenceNum(int amount) |
|
protected abstract void |
insertDelegationKey(int keyId,
byte[] delegationKey) |
|
protected abstract void |
insertToken(int sequenceNum,
byte[] tokenIdentifier,
byte[] tokenInfo) |
|
protected void |
removeExpiredStoredToken(TokenIdent ident) |
|
protected void |
removeStoredMasterKey(DelegationKey key) |
Removes the existing DelegationKey from the SQL database to
invalidate it.
|
protected void |
removeStoredToken(TokenIdent ident) |
Removes the existing TokenInformation from the SQL database to
invalidate it.
|
protected abstract byte[] |
selectDelegationKey(int keyId) |
|
protected abstract int |
selectKeyId() |
|
protected abstract int |
selectSequenceNum() |
|
protected abstract java.util.Map<byte[],byte[]> |
selectStaleTokenInfos(long maxModifiedTime,
int maxResults) |
|
protected abstract byte[] |
selectTokenInfo(int sequenceNum,
byte[] tokenIdentifier) |
|
void |
setCurrentKeyId(int keyId) |
Updates the value of the last delegation key id.
|
void |
setDelegationTokenSeqNum(int seqNum) |
Updates the value of the last reserved sequence number.
|
protected void |
storeDelegationKey(DelegationKey key) |
Persists a DelegationKey into the SQL database.
|
protected void |
storeToken(TokenIdent ident,
AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) |
Persists a TokenIdentifier and its corresponding TokenInformation into
the SQL database.
|
protected abstract void |
updateDelegationKey(int keyId,
byte[] delegationKey) |
|
protected void |
updateDelegationKey(DelegationKey key) |
Updates an existing DelegationKey in the SQL database.
|
protected abstract void |
updateKeyId(int value) |
|
protected abstract void |
updateSequenceNum(int value) |
|
protected abstract void |
updateToken(int sequenceNum,
byte[] tokenIdentifier,
byte[] tokenInfo) |
|
protected void |
updateToken(TokenIdent ident,
AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) |
Updates the TokenInformation of an existing TokenIdentifier in
the SQL database.
|
addKey, addPersistedDelegationToken, addTokenForOwnerStats, checkToken, createPassword, createSecretKey, decodeTokenIdentifier, getAllKeys, getCurrentTokensSize, getMetrics, getTokenInfo, getTokenRenewInterval, getTokenTrackingId, getTopTokenRealOwners, getTrackingIdIfEnabled, isRunning, logExpireToken, logExpireTokens, logUpdateMasterKey, renewToken, reset, retrievePassword, rollMasterKey, startThreads, stopThreads, storeNewMasterKey, storeNewToken, syncTokenOwnerStats, updateStoredToken, verifyTokencheckAvailableForRead, createIdentifier, createPassword, generateSecret, retriableRetrievePasswordpublic static final java.lang.String SQL_DTSM_CONF_PREFIX
public static final int DEFAULT_SEQ_NUM_BATCH_SIZE
public static final java.lang.String SQL_DTSM_TOKEN_MAX_CLEANUP_RESULTS
public static final int SQL_DTSM_TOKEN_MAX_CLEANUP_RESULTS_DEFAULT
public static final java.lang.String SQL_DTSM_TOKEN_LOADING_CACHE_EXPIRATION
public static final long SQL_DTSM_TOKEN_LOADING_CACHE_EXPIRATION_DEFAULT
public static final java.lang.String SQL_DTSM_TOKEN_LOADING_CACHE_MAX_SIZE
public static final long SQL_DTSM_TOKEN_LOADING_CACHE_MAX_SIZE_DEFAULT
public SQLDelegationTokenSecretManager(Configuration conf)
protected void storeToken(TokenIdent ident, AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) throws java.io.IOException
storeToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>ident - TokenIdentifier to persist.tokenInfo - DelegationTokenInformation associated with the TokenIdentifier.java.io.IOException - raised on errors performing I/O.protected void updateToken(TokenIdent ident, AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) throws java.io.IOException
updateToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>ident - Existing TokenIdentifier in the SQL database.tokenInfo - Updated DelegationTokenInformation associated with the TokenIdentifier.java.io.IOException - raised on errors performing I/O.public TokenIdent cancelToken(Token<TokenIdent> token, java.lang.String canceller) throws java.io.IOException
AbstractDelegationTokenSecretManager
to perform validation and remove the token from the cache.cancelToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>token - token.canceller - canceller.SecretManager.InvalidToken - for invalid tokenAccessControlException - if the user isn't allowed to canceljava.io.IOExceptionprotected java.util.Map<TokenIdent,AbstractDelegationTokenSecretManager.DelegationTokenInformation> getCandidateTokensForCleanup()
getCandidateTokensForCleanup in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected void removeStoredToken(TokenIdent ident) throws java.io.IOException
removeStoredToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>ident - TokenInformation to remove from the SQL database.java.io.IOExceptionprotected void removeExpiredStoredToken(TokenIdent ident)
removeExpiredStoredToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>@VisibleForTesting protected AbstractDelegationTokenSecretManager.DelegationTokenInformation getTokenInfoFromSQL(TokenIdent ident)
ident - Existing TokenIdentifier in the SQL database.public int getDelegationTokenSeqNum()
getDelegationTokenSeqNum in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>public void setDelegationTokenSeqNum(int seqNum)
setDelegationTokenSeqNum in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>seqNum - Value to update the sequence number to.public int incrementDelegationTokenSeqNum()
incrementDelegationTokenSeqNum in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected void storeDelegationKey(DelegationKey key) throws java.io.IOException
storeDelegationKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>key - DelegationKey to persist into the SQL database.java.io.IOException - raised on errors performing I/O.protected void updateDelegationKey(DelegationKey key) throws java.io.IOException
updateDelegationKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>key - Updated DelegationKey.java.io.IOException - raised on errors performing I/O.protected void removeStoredMasterKey(DelegationKey key)
removeStoredMasterKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>key - DelegationKey to remove from the SQL database.protected DelegationKey getDelegationKey(int keyId)
getDelegationKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>keyId - KeyId of the DelegationKey to obtain.public int getCurrentKeyId()
getCurrentKeyId in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>public void setCurrentKeyId(int keyId)
setCurrentKeyId in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>keyId - Value to update the delegation key id to.public int incrementCurrentKeyId()
incrementCurrentKeyId in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected abstract byte[] selectTokenInfo(int sequenceNum,
byte[] tokenIdentifier)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract java.util.Map<byte[],byte[]> selectStaleTokenInfos(long maxModifiedTime,
int maxResults)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void insertToken(int sequenceNum,
byte[] tokenIdentifier,
byte[] tokenInfo)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void updateToken(int sequenceNum,
byte[] tokenIdentifier,
byte[] tokenInfo)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void deleteToken(int sequenceNum,
byte[] tokenIdentifier)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract byte[] selectDelegationKey(int keyId)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void insertDelegationKey(int keyId,
byte[] delegationKey)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void updateDelegationKey(int keyId,
byte[] delegationKey)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void deleteDelegationKey(int keyId)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract int selectSequenceNum()
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void updateSequenceNum(int value)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract int incrementSequenceNum(int amount)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract int selectKeyId()
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract void updateKeyId(int value)
throws java.sql.SQLException
java.sql.SQLExceptionprotected abstract int incrementKeyId(int amount)
throws java.sql.SQLException
java.sql.SQLExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.