@Private public abstract class ZKDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier> extends AbstractDelegationTokenSecretManager<TokenIdent>
AbstractDelegationTokenSecretManager that
persists TokenIdentifiers and DelegationKeys in Zookeeper. This class can
be used by HA (Highly available) services that consists of multiple nodes.
This class ensures that Identifiers and Keys are replicated to all nodes of
the service.AbstractDelegationTokenSecretManager.DelegationTokenInformationSecretManager.InvalidTokenallKeys, currentId, currentTokens, delegationTokenSequenceNumber, noInterruptsLock, running, storeTokenTrackingId, tokenOwnerStats| Constructor | Description |
|---|---|
ZKDelegationTokenSecretManager(Configuration conf) |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
addOrUpdateToken(TokenIdent ident,
AbstractDelegationTokenSecretManager.DelegationTokenInformation info,
boolean isUpdate) |
|
TokenIdent |
cancelToken(Token<TokenIdent> token,
java.lang.String canceller) |
Cancel a token by removing it from cache.
|
protected static org.apache.curator.framework.CuratorFramework |
getCurator() |
|
protected int |
getCurrentKeyId() |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected DelegationKey |
getDelegationKey(int keyId) |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected int |
getDelegationTokenSeqNum() |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected AbstractDelegationTokenSecretManager.DelegationTokenInformation |
getTokenInfo(TokenIdent ident) |
For subclasses externalizing the storage, for example Zookeeper
based implementations
|
protected AbstractDelegationTokenSecretManager.DelegationTokenInformation |
getTokenInfoFromZK(java.lang.String nodePath,
boolean quiet) |
|
protected AbstractDelegationTokenSecretManager.DelegationTokenInformation |
getTokenInfoFromZK(TokenIdent ident) |
|
protected AbstractDelegationTokenSecretManager.DelegationTokenInformation |
getTokenInfoFromZK(TokenIdent ident,
boolean quiet) |
|
protected int |
incrementCurrentKeyId() |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected int |
incrementDelegationTokenSeqNum() |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
boolean |
isTokenWatcherEnabled() |
|
protected TokenIdent |
processTokenAddOrUpdate(byte[] data) |
|
protected void |
removeStoredMasterKey(DelegationKey key) |
|
protected void |
removeStoredToken(TokenIdent ident) |
|
protected void |
removeStoredToken(TokenIdent ident,
boolean checkAgainstZkBeforeDeletion) |
|
static void |
setCurator(org.apache.curator.framework.CuratorFramework curator) |
|
protected void |
setDelegationTokenSeqNum(int seqNum) |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
void |
startThreads() |
should be called before this object is used.
|
void |
stopThreads() |
|
protected void |
storeDelegationKey(DelegationKey key) |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected void |
storeToken(TokenIdent ident,
AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected void |
syncLocalCacheWithZk(TokenIdent ident) |
This method synchronizes the state of a delegation token information in
local cache with its actual value in Zookeeper.
|
protected void |
updateDelegationKey(DelegationKey key) |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
protected void |
updateToken(TokenIdent ident,
AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) |
For subclasses externalizing the storage, for example Zookeeper
based implementations.
|
addKey, addPersistedDelegationToken, addTokenForOwnerStats, checkToken, createPassword, createSecretKey, decodeTokenIdentifier, getAllKeys, getCandidateTokensForCleanup, getCurrentTokensSize, getMetrics, getTokenRenewInterval, getTokenTrackingId, getTopTokenRealOwners, getTrackingIdIfEnabled, isRunning, logExpireToken, logExpireTokens, logUpdateMasterKey, removeExpiredStoredToken, renewToken, reset, retrievePassword, rollMasterKey, setCurrentKeyId, storeNewMasterKey, storeNewToken, syncTokenOwnerStats, updateStoredToken, verifyTokencheckAvailableForRead, createIdentifier, createPassword, generateSecret, retriableRetrievePassword, updatepublic static final java.lang.String ZK_CONF_PREFIX
public static final java.lang.String ZK_DTSM_ZK_NUM_RETRIES
public static final java.lang.String ZK_DTSM_ZK_SESSION_TIMEOUT
public static final java.lang.String ZK_DTSM_ZK_CONNECTION_TIMEOUT
public static final java.lang.String ZK_DTSM_ZK_SHUTDOWN_TIMEOUT
public static final java.lang.String ZK_DTSM_ZNODE_WORKING_PATH
public static final java.lang.String ZK_DTSM_ZK_AUTH_TYPE
public static final java.lang.String ZK_DTSM_ZK_CONNECTION_STRING
public static final java.lang.String ZK_DTSM_ZK_KERBEROS_KEYTAB
public static final java.lang.String ZK_DTSM_ZK_KERBEROS_PRINCIPAL
public static final java.lang.String ZK_DTSM_ZK_KERBEROS_SERVER_PRINCIPAL
public static final java.lang.String ZK_DTSM_TOKEN_SEQNUM_BATCH_SIZE
public static final java.lang.String ZK_DTSM_TOKEN_WATCHER_ENABLED
public static final boolean ZK_DTSM_TOKEN_WATCHER_ENABLED_DEFAULT
public static final java.lang.String ZK_DTSM_ZK_SSL_ENABLED
public static final java.lang.String ZK_DTSM_ZK_SSL_KEYSTORE_LOCATION
public static final java.lang.String ZK_DTSM_ZK_SSL_KEYSTORE_PASSWORD
public static final java.lang.String ZK_DTSM_ZK_SSL_TRUSTSTORE_LOCATION
public static final java.lang.String ZK_DTSM_ZK_SSL_TRUSTSTORE_PASSWORD
public static final int ZK_DTSM_ZK_NUM_RETRIES_DEFAULT
public static final int ZK_DTSM_ZK_SESSION_TIMEOUT_DEFAULT
public static final int ZK_DTSM_ZK_CONNECTION_TIMEOUT_DEFAULT
public static final int ZK_DTSM_ZK_SHUTDOWN_TIMEOUT_DEFAULT
public static final java.lang.String ZK_DTSM_ZNODE_WORKING_PATH_DEAFULT
public static final int ZK_DTSM_TOKEN_SEQNUM_BATCH_SIZE_DEFAULT
protected static final java.lang.String ZK_DTSM_TOKENS_ROOT
protected final org.apache.curator.framework.CuratorFramework zkClient
public ZKDelegationTokenSecretManager(Configuration conf)
public static void setCurator(org.apache.curator.framework.CuratorFramework curator)
@VisibleForTesting protected static org.apache.curator.framework.CuratorFramework getCurator()
public void startThreads()
throws java.io.IOException
AbstractDelegationTokenSecretManagerstartThreads in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>java.io.IOException - raised on errors performing I/O.protected TokenIdent processTokenAddOrUpdate(byte[] data) throws java.io.IOException
java.io.IOExceptionpublic void stopThreads()
stopThreads in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected int getDelegationTokenSeqNum()
AbstractDelegationTokenSecretManagergetDelegationTokenSeqNum in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected int incrementDelegationTokenSeqNum()
AbstractDelegationTokenSecretManagerincrementDelegationTokenSeqNum in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected void setDelegationTokenSeqNum(int seqNum)
AbstractDelegationTokenSecretManagersetDelegationTokenSeqNum in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>seqNum - seqNum.protected int getCurrentKeyId()
AbstractDelegationTokenSecretManagergetCurrentKeyId in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected int incrementCurrentKeyId()
AbstractDelegationTokenSecretManagerincrementCurrentKeyId in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected DelegationKey getDelegationKey(int keyId)
AbstractDelegationTokenSecretManagergetDelegationKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>keyId - keyId.protected AbstractDelegationTokenSecretManager.DelegationTokenInformation getTokenInfo(TokenIdent ident)
AbstractDelegationTokenSecretManagergetTokenInfo in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>ident - ident.protected void syncLocalCacheWithZk(TokenIdent ident)
ident - Identifier of the tokenprotected AbstractDelegationTokenSecretManager.DelegationTokenInformation getTokenInfoFromZK(TokenIdent ident) throws java.io.IOException
java.io.IOExceptionprotected AbstractDelegationTokenSecretManager.DelegationTokenInformation getTokenInfoFromZK(TokenIdent ident, boolean quiet) throws java.io.IOException
java.io.IOExceptionprotected AbstractDelegationTokenSecretManager.DelegationTokenInformation getTokenInfoFromZK(java.lang.String nodePath, boolean quiet) throws java.io.IOException
java.io.IOExceptionprotected void storeDelegationKey(DelegationKey key) throws java.io.IOException
AbstractDelegationTokenSecretManagerstoreDelegationKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>key - DelegationKey.java.io.IOException - raised on errors performing I/O.protected void updateDelegationKey(DelegationKey key) throws java.io.IOException
AbstractDelegationTokenSecretManagerupdateDelegationKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>key - DelegationKey.java.io.IOException - raised on errors performing I/O.protected void removeStoredMasterKey(DelegationKey key)
removeStoredMasterKey in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>protected void storeToken(TokenIdent ident, AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) throws java.io.IOException
AbstractDelegationTokenSecretManagerstoreToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>ident - ident.tokenInfo - tokenInfo.java.io.IOException - raised on errors performing I/O.protected void updateToken(TokenIdent ident, AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) throws java.io.IOException
AbstractDelegationTokenSecretManagerupdateToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>ident - ident.tokenInfo - tokenInfo.java.io.IOException - raised on errors performing I/O.protected void removeStoredToken(TokenIdent ident) throws java.io.IOException
removeStoredToken in class AbstractDelegationTokenSecretManager<TokenIdent extends AbstractDelegationTokenIdentifier>java.io.IOExceptionprotected void removeStoredToken(TokenIdent ident, boolean checkAgainstZkBeforeDeletion) throws java.io.IOException
java.io.IOExceptionpublic TokenIdent cancelToken(Token<TokenIdent> token, java.lang.String canceller) throws java.io.IOException
AbstractDelegationTokenSecretManagercancelToken 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 void addOrUpdateToken(TokenIdent ident, AbstractDelegationTokenSecretManager.DelegationTokenInformation info, boolean isUpdate) throws java.lang.Exception
java.lang.Exceptionpublic boolean isTokenWatcherEnabled()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.