/** * 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); }
/** * 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(); }
/** * The same functionality with {@link #retrievePassword}, except that this * method can throw a {@link RetriableException} or a {@link StandbyException} * to indicate that client can retry/failover the same operation because of * temporary issue on the server side. * * @param identifier the identifier to validate * @return the password to use * @throws InvalidToken the token was invalid * @throws StandbyException the server is in standby state, the client can * try other servers * @throws RetriableException the token was invalid, and the server thinks * this may be a temporary issue and suggests the client to retry * @throws IOException to allow future exceptions to be added without breaking * compatibility */ public byte[] retriableRetrievePassword(T identifier) throws InvalidToken, StandbyException, RetriableException, IOException { return retrievePassword(identifier); }
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; }
private char[] getPassword(TokenIdentifier tokenid) throws InvalidToken, StandbyException, RetriableException, IOException { return encodePassword(secretManager.retriableRetrievePassword(tokenid)); }
public static <T extends TokenIdentifier> T getIdentifier(String id, SecretManager<T> secretManager) throws InvalidToken { byte[] tokenId = 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; }
private char[] getPassword(TokenIdentifier tokenid) throws InvalidToken, StandbyException, RetriableException, IOException { return encodePassword(secretManager.retriableRetrievePassword(tokenid)); }
public static SecretKey createSecretKey(byte[] raw) { return SecretManager.createSecretKey(raw); }
private char[] getPassword(TokenIdentifier tokenid) throws InvalidToken { return SaslUtil.encodePassword(secretManager.retrievePassword(tokenid)); }
/** * 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(); }
public static <T extends TokenIdentifier> T getIdentifier(String id, SecretManager<T> secretManager) throws InvalidToken { byte[] tokenId = 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; }
private char[] getPassword(TokenIdentifier tokenid) throws InvalidToken, StandbyException, RetriableException, IOException { return encodePassword(secretManager.retriableRetrievePassword(tokenid)); }
public static SecretKey createSecretKey(byte[] raw) { return SecretManager.createSecretKey(raw); } }
/** * Generate the password from the provided {@link SecretManager} and {@link TokenIdentifier}. * * @param secretManager * The server SecretManager * @param tokenid * The TokenIdentifier from the client * @see #encodePassword(byte[]) */ public <T extends TokenIdentifier> char[] getPassword(SecretManager<T> secretManager, T tokenid) throws InvalidToken { return encodePassword(secretManager.retrievePassword(tokenid)); }
/** * 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(); }
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; }
private char[] getPassword(TokenIdentifier tokenid) throws InvalidToken, StandbyException, RetriableException, IOException { return encodePassword(secretManager.retriableRetrievePassword(tokenid)); }
public ClientToAMTokenSecretManager( ApplicationAttemptId applicationAttemptID, byte[] key) { super(); if (key != null) { this.masterKey = SecretManager.createSecretKey(key); } else { this.masterKey = null; } }
/** * The same functionality with {@link #retrievePassword}, except that this * method can throw a {@link RetriableException} or a {@link StandbyException} * to indicate that client can retry/failover the same operation because of * temporary issue on the server side. * * @param identifier the identifier to validate * @return the password to use * @throws InvalidToken the token was invalid * @throws StandbyException the server is in standby state, the client can * try other servers * @throws RetriableException the token was invalid, and the server thinks * this may be a temporary issue and suggests the client to retry * @throws IOException to allow future exceptions to be added without breaking * compatibility */ public byte[] retriableRetrievePassword(T identifier) throws InvalidToken, StandbyException, RetriableException, IOException { return retrievePassword(identifier); }
/** * 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(); }