Example usage for org.apache.hadoop.hdfs.security.token.block BlockTokenIdentifier getExpiryDate

List of usage examples for org.apache.hadoop.hdfs.security.token.block BlockTokenIdentifier getExpiryDate

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.security.token.block BlockTokenIdentifier getExpiryDate.

Prototype

public long getExpiryDate() 

Source Link

Usage

From source file:io.hops.metadata.security.token.block.NameNodeBlockTokenSecretManager.java

License:Apache License

@Override
public byte[] retrievePassword(BlockTokenIdentifier identifier) throws InvalidToken {
    if (isExpired(identifier.getExpiryDate())) {
        throw new InvalidToken("Block token with " + identifier.toString() + " is expired.");
    }//from  ww  w.j av a2s  .co  m
    BlockKey key = null;
    try {
        key = getBlockKeyById(identifier.getKeyId());
    } catch (IOException ex) {
    }

    if (key == null) {
        throw new InvalidToken("Can't re-compute password for " + identifier.toString()
                + ", since the required block key (keyID=" + identifier.getKeyId() + ") doesn't exist.");
    }
    return createPassword(identifier.getBytes(), key.getKey());
}