use of org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenSecretManager in project hadoop by apache.
the class DelegationTokenFetcher method printTokensToString.
@VisibleForTesting
static String printTokensToString(final Configuration conf, final Path tokenFile, final boolean verbose) throws IOException {
StringBuilder sbld = new StringBuilder();
final String nl = System.getProperty("line.separator");
DelegationTokenIdentifier id = new DelegationTokenSecretManager(0, 0, 0, 0, null).createIdentifier();
for (Token<?> token : readTokens(tokenFile, conf)) {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(token.getIdentifier()));
id.readFields(in);
String idStr = (verbose ? id.toString() : id.toStringStable());
sbld.append("Token (").append(idStr).append(") for ").append(token.getService()).append(nl);
}
return sbld.toString();
}
Aggregations