Example usage for org.apache.hadoop.security.token.delegation DelegationKey getKey

List of usage examples for org.apache.hadoop.security.token.delegation DelegationKey getKey

Introduction

In this page you can find the example usage for org.apache.hadoop.security.token.delegation DelegationKey getKey.

Prototype

public SecretKey getKey() 

Source Link

Usage

From source file:com.cloudera.impala.security.PersistedDelegationTokenSecretManager.java

License:Apache License

/**
 * Synchronize master key updates / sequence generation for multiple nodes.
 * NOTE: {@Link AbstractDelegationTokenSecretManager} keeps currentKey private, so we need
 * to utilize this "hook" to manipulate the key through the object reference.
 * This .20S workaround should cease to exist when Hadoop supports token store.
 *///  w  w w .  j a va  2  s  .c  o  m
@Override
protected void logUpdateMasterKey(DelegationKey key) throws IOException {
    int keySeq = this.tokenStore.addMasterKey(encodeWritable(key));
    // update key with assigned identifier
    DelegationKey keyWithSeq = new DelegationKey(keySeq, key.getExpiryDate(), key.getKey());
    String keyStr = encodeWritable(keyWithSeq);
    this.tokenStore.updateMasterKey(keySeq, keyStr);
    decodeWritable(key, keyStr);
    LOGGER.info("New master key with key id={}", key.getKeyId());
    super.logUpdateMasterKey(key);
}