public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
private void processTokenAddOrUpdate(ChildData data) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(data.getData()); DataInputStream din = new DataInputStream(bin); TokenIdent ident = createIdentifier(); ident.readFields(din); long renewDate = din.readLong(); int pwdLen = din.readInt(); byte[] password = new byte[pwdLen]; int numRead = din.read(password, 0, pwdLen); if (numRead > -1) { DelegationTokenInformation tokenInfo = new DelegationTokenInformation(renewDate, password); synchronized (this) { currentTokens.put(ident, tokenInfo); // The cancel task might be waiting notifyAll(); } } }
@Override protected synchronized byte[] createPassword(TokenIdent identifier) { int sequenceNum; long now = Time.now(); sequenceNum = incrementDelegationTokenSeqNum(); identifier.setIssueDate(now); identifier.setMaxDate(now + tokenMaxLifetime); identifier.setMasterKeyId(currentKey.getKeyId()); identifier.setSequenceNumber(sequenceNum); LOG.info("Creating password for identifier: " + identifier + ", currentKey: " + currentKey.getKeyId()); byte[] password = createPassword(identifier.getBytes(), currentKey.getKey()); DelegationTokenInformation tokenInfo = new DelegationTokenInformation(now + tokenRenewInterval, password, getTrackingIdIfEnabled(identifier)); try { storeToken(identifier, tokenInfo); } catch (IOException ioe) { LOG.error("Could not store token !!", ioe); } return password; }
private void processTokenAddOrUpdate(ChildData data) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(data.getData()); DataInputStream din = new DataInputStream(bin); TokenIdent ident = createIdentifier(); ident.readFields(din); long renewDate = din.readLong(); int pwdLen = din.readInt(); byte[] password = new byte[pwdLen]; int numRead = din.read(password, 0, pwdLen); if (numRead > -1) { DelegationTokenInformation tokenInfo = new DelegationTokenInformation(renewDate, password); synchronized (this) { currentTokens.put(ident, tokenInfo); // The cancel task might be waiting notifyAll(); } } }
private void processTokenAddOrUpdate(ChildData data) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(data.getData()); DataInputStream din = new DataInputStream(bin); TokenIdent ident = createIdentifier(); ident.readFields(din); long renewDate = din.readLong(); int pwdLen = din.readInt(); byte[] password = new byte[pwdLen]; int numRead = din.read(password, 0, pwdLen); if (numRead > -1) { DelegationTokenInformation tokenInfo = new DelegationTokenInformation(renewDate, password); synchronized (this) { currentTokens.put(ident, tokenInfo); // The cancel task might be waiting notifyAll(); } } }
private void processTokenAddOrUpdate(ChildData data) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(data.getData()); DataInputStream din = new DataInputStream(bin); TokenIdent ident = createIdentifier(); ident.readFields(din); long renewDate = din.readLong(); int pwdLen = din.readInt(); byte[] password = new byte[pwdLen]; int numRead = din.read(password, 0, pwdLen); if (numRead > -1) { DelegationTokenInformation tokenInfo = new DelegationTokenInformation(renewDate, password); synchronized (this) { currentTokens.put(ident, tokenInfo); // The cancel task might be waiting notifyAll(); } } }
private void processTokenAddOrUpdate(ChildData data) throws IOException { ByteArrayInputStream bin = new ByteArrayInputStream(data.getData()); DataInputStream din = new DataInputStream(bin); TokenIdent ident = createIdentifier(); ident.readFields(din); long renewDate = din.readLong(); int pwdLen = din.readInt(); byte[] password = new byte[pwdLen]; int numRead = din.read(password, 0, pwdLen); if (numRead > -1) { DelegationTokenInformation tokenInfo = new DelegationTokenInformation(renewDate, password); synchronized (this) { currentTokens.put(ident, tokenInfo); // The cancel task might be waiting notifyAll(); } } }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
public static DelegationTokenInformation decodeDelegationTokenInformation(byte[] tokenBytes) throws IOException { DataInputStream in = new DataInputStream(new ByteArrayInputStream(tokenBytes)); DelegationTokenInformation token = new DelegationTokenInformation(0, null); int len = WritableUtils.readVInt(in); token.password = new byte[len]; in.readFully(token.password); token.renewDate = in.readLong(); return token; }
currentTokens.put(identifier, new DelegationTokenInformation(expiryTime, password, getTrackingIdIfEnabled(identifier))); } else {
/** * Update the token cache with renewal record in edit logs. * * @param identifier DelegationTokenIdentifier of the renewed token * @param expiryTime expirty time in milliseconds * @throws IOException */ public synchronized void updatePersistedTokenRenewal( DelegationTokenIdentifier identifier, long expiryTime) throws IOException { if (running) { // a safety check throw new IOException( "Can't update persisted delegation token renewal to a running SecretManager."); } DelegationTokenInformation info = null; info = currentTokens.get(identifier); if (info != null) { int keyId = identifier.getMasterKeyId(); byte[] password = createPassword(identifier.getBytes(), allKeys .get(keyId).getKey()); currentTokens.put(identifier, new DelegationTokenInformation(expiryTime, password, getTrackingIdIfEnabled(identifier))); } }
DelegationTokenInformation info = new DelegationTokenInformation(renewTime, password, trackingId);
currentTokens.put(identifier, new DelegationTokenInformation(renewDate, password, getTrackingIdIfEnabled(identifier))); } else {
if (numRead > -1) { DelegationTokenInformation tokenInfo = new DelegationTokenInformation(renewDate, password); return tokenInfo;
@Override protected synchronized byte[] createPassword(TokenIdent identifier) { int sequenceNum; long now = Time.now(); sequenceNum = incrementDelegationTokenSeqNum(); identifier.setIssueDate(now); identifier.setMaxDate(now + tokenMaxLifetime); identifier.setMasterKeyId(currentKey.getKeyId()); identifier.setSequenceNumber(sequenceNum); LOG.info("Creating password for identifier: " + formatTokenId(identifier) + ", currentKey: " + currentKey.getKeyId()); byte[] password = createPassword(identifier.getBytes(), currentKey.getKey()); DelegationTokenInformation tokenInfo = new DelegationTokenInformation(now + tokenRenewInterval, password, getTrackingIdIfEnabled(identifier)); try { storeToken(identifier, tokenInfo); } catch (IOException ioe) { LOG.error("Could not store token " + formatTokenId(identifier) + "!!", ioe); } return password; }