Class RouterDelegationTokenSecretManager
java.lang.Object
org.apache.hadoop.security.token.SecretManager<TokenIdent>
org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
org.apache.hadoop.yarn.server.router.security.RouterDelegationTokenSecretManager
public class RouterDelegationTokenSecretManager
extends org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
A Router specific delegation token secret manager.
The secret manager is responsible for generating and accepting the password
for each token.
-
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.AbstractDelegationTokenSecretManager
allKeys, currentId, currentTokens, delegationTokenSequenceNumber, noInterruptsLock, running, storeTokenTrackingId, tokenOwnerStats -
Constructor Summary
ConstructorsConstructorDescriptionRouterDelegationTokenSecretManager(long delegationKeyUpdateInterval, long delegationTokenMaxLifetime, long delegationTokenRenewInterval, long delegationTokenRemoverScanInterval, org.apache.hadoop.conf.Configuration conf) Create a Router Secret manager. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifierSet<org.apache.hadoop.security.token.delegation.DelegationKey>protected intprotected intintorg.apache.hadoop.security.token.delegation.DelegationKeygetMasterKeyByDelegationKey(org.apache.hadoop.security.token.delegation.DelegationKey key) The Router supports obtaining the DelegationKey stored in the Router StateStote according to the DelegationKey.longgetRenewDate(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier ident) org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifiergetTokenByRouterStoreToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier) Get RMDelegationTokenIdentifier according to RouterStoreToken.protected org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformationgetTokenInfo(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier ident) protected intprotected intvoidremoveStoredMasterKey(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey) The Router Supports Remove the master key.voidremoveStoredToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier) The Router Supports Remove Token.protected voidsetDelegationTokenSeqNum(int seqNum) voidsetFederationFacade(org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade federationFacade) voidstoreNewMasterKey(org.apache.hadoop.security.token.delegation.DelegationKey newKey) The Router Supports Store the New Master Key.voidstoreNewToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, long renewDate) The Router Supports Store new Token.voidstoreNewToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) The Router Supports Store new Token.protected voidstoreToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDelegationTokenIdentifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) voidupdateStoredToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier id, long renewDate) The Router Supports Update Token.voidupdateStoredToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) The Router Supports Update Token.protected voidupdateToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDelegationTokenIdentifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) Methods inherited from class org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager
addKey, addPersistedDelegationToken, addTokenForOwnerStats, cancelToken, checkToken, createPassword, createSecretKey, decodeTokenIdentifier, getAllKeys, getCandidateTokensForCleanup, getCurrentTokensSize, getDelegationKey, getMetrics, getTokenRenewInterval, getTokenTrackingId, getTopTokenRealOwners, getTrackingIdIfEnabled, isRunning, logExpireToken, logExpireTokens, logUpdateMasterKey, removeExpiredStoredToken, renewToken, reset, retrievePassword, rollMasterKey, setCurrentKeyId, startThreads, stopThreads, storeDelegationKey, syncTokenOwnerStats, updateDelegationKey, verifyTokenMethods inherited from class org.apache.hadoop.security.token.SecretManager
checkAvailableForRead, createPassword, generateSecret, retriableRetrievePassword, update, validateSecretKeyLength
-
Constructor Details
-
RouterDelegationTokenSecretManager
public RouterDelegationTokenSecretManager(long delegationKeyUpdateInterval, long delegationTokenMaxLifetime, long delegationTokenRenewInterval, long delegationTokenRemoverScanInterval, org.apache.hadoop.conf.Configuration conf) Create a Router Secret manager.- Parameters:
delegationKeyUpdateInterval- the number of milliseconds for rolling new secret keys.delegationTokenMaxLifetime- the maximum lifetime of the delegation tokens in millisecondsdelegationTokenRenewInterval- how often the tokens must be renewed in millisecondsdelegationTokenRemoverScanInterval- how often the tokens are scannedconf- Configuration.
-
-
Method Details
-
createIdentifier
public org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier createIdentifier()- Specified by:
createIdentifierin classorg.apache.hadoop.security.token.SecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-
storeNewMasterKey
public void storeNewMasterKey(org.apache.hadoop.security.token.delegation.DelegationKey newKey) The Router Supports Store the New Master Key. During this Process, Facade will call the specific StateStore to store the MasterKey.- Overrides:
storeNewMasterKeyin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Parameters:
newKey- DelegationKey
-
removeStoredMasterKey
public void removeStoredMasterKey(org.apache.hadoop.security.token.delegation.DelegationKey delegationKey) The Router Supports Remove the master key. During this Process, Facade will call the specific StateStore to remove the MasterKey.- Overrides:
removeStoredMasterKeyin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Parameters:
delegationKey- DelegationKey
-
storeNewToken
public void storeNewToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, long renewDate) throws IOException The Router Supports Store new Token.- Overrides:
storeNewTokenin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Parameters:
identifier- RMDelegationTokenrenewDate- renewDate- Throws:
IOException- IO exception occurred.
-
storeNewToken
public void storeNewToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) The Router Supports Store new Token.- Parameters:
identifier- RMDelegationToken.tokenInfo- DelegationTokenInformation.
-
updateStoredToken
public void updateStoredToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier id, long renewDate) throws IOException The Router Supports Update Token.- Overrides:
updateStoredTokenin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Parameters:
id- RMDelegationTokenrenewDate- renewDate- Throws:
IOException- IO exception occurred
-
updateStoredToken
public void updateStoredToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) The Router Supports Update Token.- Parameters:
identifier- RMDelegationToken.tokenInfo- DelegationTokenInformation.
-
removeStoredToken
public void removeStoredToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier) throws IOException The Router Supports Remove Token.- Overrides:
removeStoredTokenin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Parameters:
identifier- Delegation Token- Throws:
IOException- IO exception occurred.
-
getMasterKeyByDelegationKey
public org.apache.hadoop.security.token.delegation.DelegationKey getMasterKeyByDelegationKey(org.apache.hadoop.security.token.delegation.DelegationKey key) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException The Router supports obtaining the DelegationKey stored in the Router StateStote according to the DelegationKey.- Parameters:
key- Param DelegationKey- Returns:
- Delegation Token
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- An internal conversion error occurred when getting the TokenIOException- IO exception occurred
-
getTokenByRouterStoreToken
public org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier getTokenByRouterStoreToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier identifier) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Get RMDelegationTokenIdentifier according to RouterStoreToken.- Parameters:
identifier- RMDelegationTokenIdentifier- Returns:
- RMDelegationTokenIdentifier
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- An internal conversion error occurred when getting the TokenIOException- IO exception occurred
-
setFederationFacade
public void setFederationFacade(org.apache.hadoop.yarn.server.federation.utils.FederationStateStoreFacade federationFacade) -
getLatestDTSequenceNumber
@Public @VisibleForTesting public int getLatestDTSequenceNumber() -
getAllMasterKeys
@Public @VisibleForTesting public Set<org.apache.hadoop.security.token.delegation.DelegationKey> getAllMasterKeys() -
getAllTokens
-
getRenewDate
public long getRenewDate(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier ident) throws org.apache.hadoop.security.token.SecretManager.InvalidToken - Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
incrementDelegationTokenSeqNum
protected int incrementDelegationTokenSeqNum()- Overrides:
incrementDelegationTokenSeqNumin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-
storeToken
protected void storeToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDelegationTokenIdentifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) throws IOException - Overrides:
storeTokenin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Throws:
IOException
-
updateToken
protected void updateToken(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier rmDelegationTokenIdentifier, org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation tokenInfo) throws IOException - Overrides:
updateTokenin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>- Throws:
IOException
-
getTokenInfo
protected org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager.DelegationTokenInformation getTokenInfo(org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier ident) - Overrides:
getTokenInfoin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-
getDelegationTokenSeqNum
protected int getDelegationTokenSeqNum()- Overrides:
getDelegationTokenSeqNumin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-
setDelegationTokenSeqNum
protected void setDelegationTokenSeqNum(int seqNum) - Overrides:
setDelegationTokenSeqNumin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-
getCurrentKeyId
protected int getCurrentKeyId()- Overrides:
getCurrentKeyIdin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-
incrementCurrentKeyId
protected int incrementCurrentKeyId()- Overrides:
incrementCurrentKeyIdin classorg.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager<org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier>
-