Class SQLDelegationTokenSecretManagerImpl
java.lang.Object
org.apache.hadoop.security.token.SecretManager<TokenIdent>
org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<TokenIdent>
org.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>
org.apache.hadoop.hdfs.server.federation.router.security.token.SQLDelegationTokenSecretManagerImpl
public class SQLDelegationTokenSecretManagerImpl
extends org.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>
An implementation of
SQLDelegationTokenSecretManager that
persists TokenIdentifiers and DelegationKeys in a SQL database.
This implementation relies on the Datanucleus JDO PersistenceManager, which
can be configured with datanucleus.* configuration properties.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager
org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformationNested classes/interfaces inherited from class org.apache.hadoop.security.token.SecretManager
org.apache.hadoop.security.token.SecretManager.InvalidToken -
Field Summary
Fields inherited from class org.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager
DEFAULT_SEQ_NUM_BATCH_SIZE, SQL_DTSM_CONF_PREFIX, SQL_DTSM_TOKEN_LOADING_CACHE_EXPIRATION, SQL_DTSM_TOKEN_LOADING_CACHE_EXPIRATION_DEFAULT, SQL_DTSM_TOKEN_LOADING_CACHE_MAX_SIZE, SQL_DTSM_TOKEN_LOADING_CACHE_MAX_SIZE_DEFAULT, SQL_DTSM_TOKEN_MAX_CLEANUP_RESULTS, SQL_DTSM_TOKEN_MAX_CLEANUP_RESULTS_DEFAULTFields inherited from class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager
allKeys, currentId, currentTokens, delegationTokenSequenceNumber, noInterruptsLock, running, storeTokenTrackingId, tokenOwnerStats -
Constructor Summary
ConstructorsConstructorDescriptionSQLDelegationTokenSecretManagerImpl(org.apache.hadoop.conf.Configuration conf) SQLDelegationTokenSecretManagerImpl(org.apache.hadoop.conf.Configuration conf, SQLConnectionFactory connectionFactory, SQLSecretManagerRetriableHandler retryHandler) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifierprotected voiddeleteDelegationKey(int keyId) protected voiddeleteToken(int sequenceNum, byte[] tokenIdentifier) protected SQLConnectionFactoryprotected intincrementKeyId(int amount) protected intincrementSequenceNum(int amount) protected voidinsertDelegationKey(int keyId, byte[] delegationKey) protected voidinsertToken(int sequenceNum, byte[] tokenIdentifier, byte[] tokenInfo) protected byte[]selectDelegationKey(int keyId) protected intprotected intprotected Map<byte[],byte[]> selectStaleTokenInfos(long maxModifiedTime, int maxResults) protected byte[]selectTokenInfo(int sequenceNum, byte[] tokenIdentifier) voidprotected voidupdateDelegationKey(int keyId, byte[] delegationKey) protected voidupdateKeyId(int value) protected voidupdateSequenceNum(int value) protected voidupdateToken(int sequenceNum, byte[] tokenIdentifier, byte[] tokenInfo) Methods inherited from class org.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager
cancelToken, getCandidateTokensForCleanup, getCurrentKeyId, getDelegationKey, getDelegationTokenSeqNum, getTokenInfoFromSQL, incrementCurrentKeyId, incrementDelegationTokenSeqNum, removeExpiredStoredToken, removeStoredMasterKey, removeStoredToken, setCurrentKeyId, setDelegationTokenSeqNum, storeDelegationKey, storeToken, updateDelegationKey, updateTokenMethods inherited from class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager
addKey, addPersistedDelegationToken, addTokenForOwnerStats, checkToken, createPassword, createSecretKey, decodeTokenIdentifier, getAllKeys, getCurrentTokensSize, getMetrics, getTokenInfo, getTokenRenewInterval, getTokenTrackingId, getTopTokenRealOwners, getTrackingIdIfEnabled, isRunning, logExpireToken, logExpireTokens, logUpdateMasterKey, renewToken, reset, retrievePassword, rollMasterKey, startThreads, storeNewMasterKey, storeNewToken, syncTokenOwnerStats, updateStoredToken, verifyTokenMethods inherited from class org.apache.hadoop.security.token.SecretManager
checkAvailableForRead, createPassword, generateSecret, retriableRetrievePassword, update, validateSecretKeyLength
-
Constructor Details
-
SQLDelegationTokenSecretManagerImpl
public SQLDelegationTokenSecretManagerImpl(org.apache.hadoop.conf.Configuration conf) -
SQLDelegationTokenSecretManagerImpl
public SQLDelegationTokenSecretManagerImpl(org.apache.hadoop.conf.Configuration conf, SQLConnectionFactory connectionFactory, SQLSecretManagerRetriableHandler retryHandler)
-
-
Method Details
-
createIdentifier
public org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier createIdentifier()- Specified by:
createIdentifierin classorg.apache.hadoop.security.token.SecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>
-
stopThreads
public void stopThreads()- Overrides:
stopThreadsin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>
-
insertToken
protected void insertToken(int sequenceNum, byte[] tokenIdentifier, byte[] tokenInfo) throws SQLException - Specified by:
insertTokenin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
updateToken
protected void updateToken(int sequenceNum, byte[] tokenIdentifier, byte[] tokenInfo) throws SQLException - Specified by:
updateTokenin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
deleteToken
- Specified by:
deleteTokenin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
selectTokenInfo
- Specified by:
selectTokenInfoin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
selectStaleTokenInfos
protected Map<byte[],byte[]> selectStaleTokenInfos(long maxModifiedTime, int maxResults) throws SQLException - Specified by:
selectStaleTokenInfosin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
insertDelegationKey
- Specified by:
insertDelegationKeyin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
updateDelegationKey
- Specified by:
updateDelegationKeyin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
deleteDelegationKey
- Specified by:
deleteDelegationKeyin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
selectDelegationKey
- Specified by:
selectDelegationKeyin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
selectSequenceNum
- Specified by:
selectSequenceNumin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
updateSequenceNum
- Specified by:
updateSequenceNumin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
incrementSequenceNum
- Specified by:
incrementSequenceNumin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
selectKeyId
- Specified by:
selectKeyIdin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
updateKeyId
- Specified by:
updateKeyIdin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
incrementKeyId
- Specified by:
incrementKeyIdin classorg.apache.hadoop.security.token.delegation.SQLDelegationTokenSecretManager<org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier>- Throws:
SQLException
-
getConnectionFactory
-