use of org.apache.hadoop.io.DataInputByteBuffer in project hadoop by apache.
the class YarnServerSecurityUtils method parseCredentials.
/**
* Parses the container launch context and returns a Credential instance that
* contains all the tokens from the launch context.
* @param launchContext
* @return the credential instance
* @throws IOException
*/
public static Credentials parseCredentials(ContainerLaunchContext launchContext) throws IOException {
Credentials credentials = new Credentials();
ByteBuffer tokens = launchContext.getTokens();
if (tokens != null) {
DataInputByteBuffer buf = new DataInputByteBuffer();
tokens.rewind();
buf.reset(tokens);
credentials.readTokenStorageStream(buf);
if (LOG.isDebugEnabled()) {
for (Token<? extends TokenIdentifier> tk : credentials.getAllTokens()) {
LOG.debug(tk.getService() + " = " + tk.toString());
}
}
}
return credentials;
}
Aggregations