List of usage examples for org.apache.hadoop.crypto.key KeyProviderDelegationTokenExtension addDelegationTokens
default Token<?>[] addDelegationTokens(final String renewer, Credentials credentials) throws IOException
Credentials
object if it is not already present. From source file:co.cask.cdap.security.store.KMSSecureStore.java
License:Apache License
/** * Uses the KeyProviderDelegationTokenExtension to get the delegation token for KMS. * @param renewer User used to renew the delegation tokens * @param credentials Credentials in which to add new delegation tokens * @return credentials with KMS delegation token added if it was successfully retrieved. *//* www. j a v a 2 s. com*/ @Override public Credentials addDelegationTokens(String renewer, Credentials credentials) { KeyProviderDelegationTokenExtension tokenExtension = KeyProviderDelegationTokenExtension .createKeyProviderDelegationTokenExtension(provider); try { tokenExtension.addDelegationTokens(renewer, credentials); } catch (IOException e) { LOG.debug("KMS delegation token not updated."); } return credentials; }
From source file:com.mellanox.r4h.DistributedFileSystem.java
License:Apache License
@Override public Token<?>[] addDelegationTokens(final String renewer, Credentials credentials) throws IOException { Token<?>[] tokens = super.addDelegationTokens(renewer, credentials); if (dfs.isHDFSEncryptionEnabled()) { KeyProviderDelegationTokenExtension keyProviderDelegationTokenExtension = KeyProviderDelegationTokenExtension .createKeyProviderDelegationTokenExtension(dfs.getKeyProvider()); Token<?>[] kpTokens = keyProviderDelegationTokenExtension.addDelegationTokens(renewer, credentials); if (tokens != null && kpTokens != null) { Token<?>[] all = new Token<?>[tokens.length + kpTokens.length]; System.arraycopy(tokens, 0, all, 0, tokens.length); System.arraycopy(kpTokens, 0, all, tokens.length, kpTokens.length); tokens = all;//from ww w .j a v a 2s . c o m } else { tokens = (tokens != null) ? tokens : kpTokens; } } return tokens; }