Class DelegationTokenIdentifier

java.lang.Object
org.apache.zookeeper.server.token.DelegationTokenIdentifier

public class DelegationTokenIdentifier extends Object
Identifier of a ZooKeeper delegation token.

The binary layout is byte-compatible with the Writable encoding of Hadoop's AbstractDelegationTokenIdentifier: Text owner, Text renewer, Text realUser, vlong issueDate, vlong maxDate, vint sequenceNumber, vint masterKeyId. This lets external tooling wrap the identifier into a Hadoop Token without re-encoding, while the ZooKeeper core stays free of hadoop-common dependencies.

  • Field Details

  • Constructor Details

    • DelegationTokenIdentifier

      public DelegationTokenIdentifier(String owner, String renewer, String realUser, long issueDate, long maxDate, int sequenceNumber, int masterKeyId)
  • Method Details

    • getOwner

      public String getOwner()
    • getRenewer

      public String getRenewer()
    • getRealUser

      public String getRealUser()
    • getIssueDate

      public long getIssueDate()
    • getMaxDate

      public long getMaxDate()
    • getSequenceNumber

      public int getSequenceNumber()
    • getMasterKeyId

      public int getMasterKeyId()
    • toBytes

      public byte[] toBytes()
      Serializes this identifier into the Hadoop-compatible Writable form.
    • fromBytes

      public static DelegationTokenIdentifier fromBytes(byte[] data) throws IOException
      Parses an identifier from its Writable form. The parse is strict: the whole buffer must be consumed and the owner must be non-empty, so arbitrary usernames do not accidentally decode into a valid identifier.
      Throws:
      IOException - if the buffer is not a well-formed identifier
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object