/** * Renew this delegation token. * @return the new expiration time * @throws IOException * @throws InterruptedException */ public long renew(Configuration conf ) throws IOException, InterruptedException { return getRenewer().renew(this, conf); }
/** * Is this token managed so that it can be renewed or cancelled? * @return true, if it can be renewed and cancelled. */ public boolean isManaged() throws IOException { return getRenewer().isManaged(this); }
@Override public void execute() throws Exception { for (File tokenFile : tokenFiles) { DtFileOperations.printTokenFile(tokenFile, alias, getConf(), getOut()); } }
public static <T extends TokenIdentifier> T getIdentifier(String id, SecretManager<T> secretManager) throws InvalidToken { byte[] tokenId = SaslUtil.decodeIdentifier(id); T tokenIdentifier = secretManager.createIdentifier(); try { tokenIdentifier.readFields(new DataInputStream(new ByteArrayInputStream(tokenId))); } catch (IOException e) { throw (InvalidToken) new InvalidToken("Can't de-serialize tokenIdentifier").initCause(e); } return tokenIdentifier; }
/** * Decode the token identifier. The subclass can customize the way to decode * the token identifier. * * @param token the token where to extract the identifier * @return the delegation token identifier * @throws IOException */ public TokenIdent decodeTokenIdentifier(Token<TokenIdent> token) throws IOException { return token.decodeIdentifier(); }
/** * Construct a token given a token identifier and a secret manager for the * type of the token identifier. * @param id the token identifier * @param mgr the secret manager */ public Token(T id, SecretManager<T> mgr) { password = mgr.createPassword(id); identifier = id.getBytes(); kind = id.getKind(); service = new Text(); }
@Override public boolean equals(final Object that) { if (this == that) { return true; } else if (that == null || !(that instanceof RenewAction)) { return false; } return token.equals(((RenewAction<?>)that).token); }
/** * Convert the byte[] to a secret key * @param key the byte[] to create the secret key from * @return the secret key */ public static SecretKey createSecretKey(byte[] key) { return SecretManager.createSecretKey(key); }
@Override public String getCommandUsage() { return String.format( "%n%s%n %s%n %s%n %s%n %s%n %s%n %s%n %s%n%n", DT_USAGE, (new Print()).getUsage(), (new Get()).getUsage(), (new Edit()).getUsage(), (new Append()).getUsage(), (new Remove(true)).getUsage(), (new Remove(false)).getUsage(), (new Renew()).getUsage()); }
/** * Cancel this delegation token. * @throws IOException * @throws InterruptedException */ public void cancel(Configuration conf ) throws IOException, InterruptedException { getRenewer().cancel(this, conf); }
@Override public int hashCode() { return token.hashCode(); }
/** * Create a private clone of a public token. * @param newService the new service name * @return a private token */ public Token<T> privateClone(Text newService) { return new PrivateToken<>(this, newService); }
/** * Decode the given url safe string into this token. * @param newValue the encoded string * @throws IOException */ public void decodeFromUrlString(String newValue) throws IOException { decodeWritable(this, newValue); }
/** * Encode this token as a url safe string. * @return the encoded string * @throws IOException */ public String encodeToUrlString() throws IOException { return encodeWritable(this); }
@Override public void execute() throws Exception { DtFileOperations.getTokenFile( firstFile, format, alias, service, url, renewer, getConf()); }
@Override public void execute() throws Exception { for (File tokenFile : tokenFiles) { DtFileOperations.renewTokenFile(tokenFile, format, alias, getConf()); } }
@Override public void execute() throws Exception { for (File tokenFile : tokenFiles) { DtFileOperations.aliasTokenFile( tokenFile, format, alias, service, getConf()); } }
@Override public void execute() throws Exception { for (File tokenFile : tokenFiles) { DtFileOperations.removeTokenFromFile( cancel, tokenFile, format, alias, getConf()); } }
@Override public void execute() throws Exception { DtFileOperations.appendTokenFiles(tokenFiles, format, getConf()); }
public static SecretKey createSecretKey(byte[] raw) { return SecretManager.createSecretKey(raw); }