Java Code Examples for org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier#setIssueDate()

The following examples show how to use org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier#setIssueDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FSEditLogOp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public static DelegationTokenIdentifier delegationTokenFromXml(Stanza st)
    throws InvalidXmlException {
  String kind = st.getValue("KIND");
  if (!kind.equals(DelegationTokenIdentifier.
      HDFS_DELEGATION_KIND.toString())) {
    throw new InvalidXmlException("can't understand " +
      "DelegationTokenIdentifier KIND " + kind);
  }
  int seqNum = Integer.parseInt(st.getValue("SEQUENCE_NUMBER"));
  String owner = st.getValue("OWNER");
  String renewer = st.getValue("RENEWER");
  String realuser = st.getValue("REALUSER");
  long issueDate = Long.parseLong(st.getValue("ISSUE_DATE"));
  long maxDate = Long.parseLong(st.getValue("MAX_DATE"));
  int masterKeyId = Integer.parseInt(st.getValue("MASTER_KEY_ID"));
  DelegationTokenIdentifier token =
      new DelegationTokenIdentifier(new Text(owner),
          new Text(renewer), new Text(realuser));
  token.setSequenceNumber(seqNum);
  token.setIssueDate(issueDate);
  token.setMaxDate(maxDate);
  token.setMasterKeyId(masterKeyId);
  return token;
}
 
Example 2
Source File: FSEditLogOp.java    From big-c with Apache License 2.0 6 votes vote down vote up
public static DelegationTokenIdentifier delegationTokenFromXml(Stanza st)
    throws InvalidXmlException {
  String kind = st.getValue("KIND");
  if (!kind.equals(DelegationTokenIdentifier.
      HDFS_DELEGATION_KIND.toString())) {
    throw new InvalidXmlException("can't understand " +
      "DelegationTokenIdentifier KIND " + kind);
  }
  int seqNum = Integer.parseInt(st.getValue("SEQUENCE_NUMBER"));
  String owner = st.getValue("OWNER");
  String renewer = st.getValue("RENEWER");
  String realuser = st.getValue("REALUSER");
  long issueDate = Long.parseLong(st.getValue("ISSUE_DATE"));
  long maxDate = Long.parseLong(st.getValue("MAX_DATE"));
  int masterKeyId = Integer.parseInt(st.getValue("MASTER_KEY_ID"));
  DelegationTokenIdentifier token =
      new DelegationTokenIdentifier(new Text(owner),
          new Text(renewer), new Text(realuser));
  token.setSequenceNumber(seqNum);
  token.setIssueDate(issueDate);
  token.setMaxDate(maxDate);
  token.setMasterKeyId(masterKeyId);
  return token;
}