public byte[] retrieveDataEncryptionKey(int keyId, String blockPoolId, byte[] nonce) throws IOException { return get(blockPoolId).retrieveDataEncryptionKey(keyId, nonce); } }
@Override public byte[] retrievePassword(BlockTokenIdentifier identifier) throws InvalidToken { return get(identifier.getBlockPoolId()).retrievePassword(identifier); }
@Override public byte[] createPassword(BlockTokenIdentifier identifier) { return get(identifier.getBlockPoolId()).createPassword(identifier); }
/** * See {@link BlockTokenSecretManager#checkAccess(BlockTokenIdentifier, * String, ExtendedBlock, BlockTokenIdentifier.AccessMode, * StorageType[], String[])} */ public void checkAccess(BlockTokenIdentifier id, String userId, ExtendedBlock block, AccessMode mode, StorageType[] storageTypes, String[] storageIds) throws InvalidToken { get(block.getBlockPoolId()).checkAccess(id, userId, block, mode, storageTypes, storageIds); }
/** * See {@link BlockTokenSecretManager#generateToken(ExtendedBlock, EnumSet, * StorageType[], String[])}. */ public Token<BlockTokenIdentifier> generateToken(ExtendedBlock b, EnumSet<AccessMode> of, StorageType[] storageTypes, String[] storageIds) throws IOException { return get(b.getBlockPoolId()).generateToken(b, of, storageTypes, storageIds); }
public DataEncryptionKey generateDataEncryptionKey(String blockPoolId) { return get(blockPoolId).generateDataEncryptionKey(); }
/** Return an empty BlockTokenIdentifer */ @Override public BlockTokenIdentifier createIdentifier() { return new BlockTokenIdentifier(); }
/** * Update block keys if update time > update interval. * @return true if the keys are updated. */ public synchronized boolean updateKeys(final long updateTime) throws IOException { if (updateTime > keyUpdateInterval) { return updateKeys(); } return false; }
@Override public Writable newInstance() { return new ExportedBlockKeys(); } });
public ExportedBlockKeys(boolean isBlockTokenEnabled, long keyUpdateInterval, long tokenLifetime, BlockKey currentKey, BlockKey[] allKeys) { this.isBlockTokenEnabled = isBlockTokenEnabled; this.keyUpdateInterval = keyUpdateInterval; this.tokenLifetime = tokenLifetime; this.currentKey = currentKey == null ? new BlockKey() : currentKey; this.allKeys = allKeys == null ? new BlockKey[0] : allKeys; }
if (resp.getStatus() != Status.SUCCESS) { if (resp.getStatus() == Status.ERROR_ACCESS_TOKEN) { throw new InvalidBlockTokenException("Got access token error" + ", status message " + resp.getMessage() + ", " + logInfo); } else {
/*** * Use BlockTokenSecretManager to generate block token for current user. */ public Token<BlockTokenIdentifier> getBlockAccessToken(ExtendedBlock b, EnumSet<AccessMode> mode, StorageType[] storageTypes, String[] storageIds) throws IOException { Token<BlockTokenIdentifier> accessToken = BlockTokenSecretManager.DUMMY_TOKEN; if (isBlockTokenEnabled) { accessToken = blockPoolTokenSecretManager.generateToken(b, mode, storageTypes, storageIds); } return accessToken; }
@Override public DataEncryptionKey newDataEncryptionKey() { return dnConf.encryptDataTransfer ? blockPoolTokenSecretManager.generateDataEncryptionKey( block.getBlockPoolId()) : null; } };
public void setBlockPoolId(String blockPoolId) { this.blockPoolId = blockPoolId; if (isBlockTokenEnabled()) { blockTokenSecretManager.setBlockPoolId(blockPoolId); } }
public DataEncryptionKey generateDataEncryptionKey() { if (isBlockTokenEnabled() && encryptDataTransfer) { return blockTokenSecretManager.generateDataEncryptionKey(); } else { return null; } }
/** * See {@link BlockTokenSecretManager#checkAccess(Token, String, * ExtendedBlock, BlockTokenIdentifier.AccessMode, * StorageType[], String[])} */ public void checkAccess(Token<BlockTokenIdentifier> token, String userId, ExtendedBlock block, AccessMode mode, StorageType[] storageTypes, String[] storageIds) throws InvalidToken { get(block.getBlockPoolId()).checkAccess(token, userId, block, mode, storageTypes, storageIds); }
/** * Create an empty block token identifier * * @return a newly created empty block token identifier */ @Override public BlockTokenIdentifier createIdentifier() { return new BlockTokenIdentifier(); }
KeyUpdateCommand() { this(new ExportedBlockKeys()); }
public ExportedBlockKeys() { this(false, 0, 0, new BlockKey(), new BlockKey[0]); }