Java Code Examples for org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier#readFields()

The following examples show how to use org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier#readFields() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataNode.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void checkBlockToken(ExtendedBlock block, Token<BlockTokenIdentifier> token,
    AccessMode accessMode) throws IOException {
  if (isBlockTokenEnabled) {
    BlockTokenIdentifier id = new BlockTokenIdentifier();
    ByteArrayInputStream buf = new ByteArrayInputStream(token.getIdentifier());
    DataInputStream in = new DataInputStream(buf);
    id.readFields(in);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Got: " + id.toString());
    }
    blockPoolTokenSecretManager.checkAccess(id, null, block, accessMode);
  }
}
 
Example 2
Source File: DataNode.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void checkBlockToken(ExtendedBlock block, Token<BlockTokenIdentifier> token,
    AccessMode accessMode) throws IOException {
  if (isBlockTokenEnabled) {
    BlockTokenIdentifier id = new BlockTokenIdentifier();
    ByteArrayInputStream buf = new ByteArrayInputStream(token.getIdentifier());
    DataInputStream in = new DataInputStream(buf);
    id.readFields(in);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Got: " + id.toString());
    }
    blockPoolTokenSecretManager.checkAccess(id, null, block, accessMode);
  }
}
 
Example 3
Source File: SaslDataTransferServer.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Deserializes a base64-encoded binary representation of a block access
 * token.
 *
 * @param str String to deserialize
 * @return BlockTokenIdentifier deserialized from str
 * @throws IOException if there is any I/O error
 */
private BlockTokenIdentifier deserializeIdentifier(String str)
    throws IOException {
  BlockTokenIdentifier identifier = new BlockTokenIdentifier();
  identifier.readFields(new DataInputStream(new ByteArrayInputStream(
    Base64.decodeBase64(str))));
  return identifier;
}
 
Example 4
Source File: SaslDataTransferServer.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Deserializes a base64-encoded binary representation of a block access
 * token.
 *
 * @param str String to deserialize
 * @return BlockTokenIdentifier deserialized from str
 * @throws IOException if there is any I/O error
 */
private BlockTokenIdentifier deserializeIdentifier(String str)
    throws IOException {
  BlockTokenIdentifier identifier = new BlockTokenIdentifier();
  identifier.readFields(new DataInputStream(new ByteArrayInputStream(
    Base64.decodeBase64(str))));
  return identifier;
}