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
  • Constructor Details

    • BlockPoolTokenSecretManager

      public BlockPoolTokenSecretManager()
  • Method Details

    • addBlockPool

      public void addBlockPool(String bpid, BlockTokenSecretManager secretMgr)
      Add a block pool Id and corresponding BlockTokenSecretManager to map
      Parameters:
      bpid - block pool Id
      secretMgr - BlockTokenSecretManager
    • get

      @VisibleForTesting public BlockTokenSecretManager get(String bpid)
    • isBlockPoolRegistered

      public boolean isBlockPoolRegistered(String bpid)
    • createIdentifier

      public org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier createIdentifier()
      Return an empty BlockTokenIdentifer
      Specified by:
      createIdentifier in class org.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:
      createPassword in class org.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:
      retrievePassword in class org.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
      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