Class BlockPoolTokenSecretManager
java.lang.Object
org.apache.hadoop.security.token.SecretManager<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier>
org.apache.hadoop.hdfs.security.token.block.BlockPoolTokenSecretManager
public class BlockPoolTokenSecretManager
extends org.apache.hadoop.security.token.SecretManager<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier>
Manages a
BlockTokenSecretManager per block pool. Routes the requests
given a block pool Id to corresponding BlockTokenSecretManager-
Nested Class Summary
Nested 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.SecretManager
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlockPool(String bpid, BlockTokenSecretManager secretMgr) Add a block pool Id and correspondingBlockTokenSecretManagerto mapvoidaddKeys(String bpid, ExportedBlockKeys exportedKeys, boolean updateCurrentKey) voidcheckAccess(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier id, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode) voidcheckAccess(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier id, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode, org.apache.hadoop.fs.StorageType[] storageTypes) voidcheckAccess(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier id, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode, org.apache.hadoop.fs.StorageType[] storageTypes, String[] storageIds) voidcheckAccess(org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier> token, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode) voidcheckAccess(org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier> token, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode, org.apache.hadoop.fs.StorageType[] storageTypes, String[] storageIds) voidorg.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifierReturn an empty BlockTokenIdentiferbyte[]createPassword(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier identifier) org.apache.hadoop.hdfs.security.token.block.DataEncryptionKeygenerateDataEncryptionKey(String blockPoolId) org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier>generateToken(org.apache.hadoop.hdfs.protocol.ExtendedBlock b, EnumSet<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode> of, org.apache.hadoop.fs.StorageType[] storageTypes, String[] storageIds) booleanisBlockPoolRegistered(String bpid) byte[]retrieveDataEncryptionKey(int keyId, String blockPoolId, byte[] nonce) byte[]retrievePassword(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier identifier) Methods inherited from class org.apache.hadoop.security.token.SecretManager
checkAvailableForRead, createPassword, createSecretKey, generateSecret, retriableRetrievePassword, update, validateSecretKeyLength
-
Constructor Details
-
BlockPoolTokenSecretManager
public BlockPoolTokenSecretManager()
-
-
Method Details
-
addBlockPool
Add a block pool Id and correspondingBlockTokenSecretManagerto map- Parameters:
bpid- block pool IdsecretMgr-BlockTokenSecretManager
-
get
-
isBlockPoolRegistered
-
createIdentifier
public org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier createIdentifier()Return an empty BlockTokenIdentifer- Specified by:
createIdentifierin classorg.apache.hadoop.security.token.SecretManager<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier>
-
createPassword
public byte[] createPassword(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier identifier) - Specified by:
createPasswordin classorg.apache.hadoop.security.token.SecretManager<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier>
-
retrievePassword
public byte[] retrievePassword(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier identifier) throws org.apache.hadoop.security.token.SecretManager.InvalidToken - Specified by:
retrievePasswordin classorg.apache.hadoop.security.token.SecretManager<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier>- Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
checkAccess
public void checkAccess(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier id, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode, org.apache.hadoop.fs.StorageType[] storageTypes, String[] storageIds) throws org.apache.hadoop.security.token.SecretManager.InvalidToken - Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
checkAccess
public void checkAccess(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier id, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode, org.apache.hadoop.fs.StorageType[] storageTypes) throws org.apache.hadoop.security.token.SecretManager.InvalidToken - Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
checkAccess
public void checkAccess(org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier id, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode) throws org.apache.hadoop.security.token.SecretManager.InvalidToken - Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
checkAccess
public void checkAccess(org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier> token, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode) throws org.apache.hadoop.security.token.SecretManager.InvalidToken SeeBlockTokenSecretManager.checkAccess(Token, String, ExtendedBlock, BlockTokenIdentifier.AccessMode).- Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
checkAccess
public void checkAccess(org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier> token, String userId, org.apache.hadoop.hdfs.protocol.ExtendedBlock block, org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode mode, org.apache.hadoop.fs.StorageType[] storageTypes, String[] storageIds) throws org.apache.hadoop.security.token.SecretManager.InvalidToken - Throws:
org.apache.hadoop.security.token.SecretManager.InvalidToken
-
addKeys
public void addKeys(String bpid, ExportedBlockKeys exportedKeys, boolean updateCurrentKey) throws IOException - Throws:
IOException
-
generateToken
public org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier> generateToken(org.apache.hadoop.hdfs.protocol.ExtendedBlock b, EnumSet<org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier.AccessMode> of, org.apache.hadoop.fs.StorageType[] storageTypes, String[] storageIds) throws IOException - Throws:
IOException
-
clearAllKeysForTesting
@VisibleForTesting public void clearAllKeysForTesting() -
generateDataEncryptionKey
public org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey generateDataEncryptionKey(String blockPoolId) -
retrieveDataEncryptionKey
public byte[] retrieveDataEncryptionKey(int keyId, String blockPoolId, byte[] nonce) throws IOException - Throws:
IOException
-