@Override
  public void readFields(DataInput in) throws IOException {
    int len = in.readInt();
    byte[] inBytes = new byte[len];
    in.readFully(inBytes);
    AuthenticationProtos.TokenIdentifier.Builder builder =
      AuthenticationProtos.TokenIdentifier.newBuilder();
    ProtobufUtil.mergeFrom(builder, inBytes);
    AuthenticationProtos.TokenIdentifier identifier = builder.build();
    // sanity check on type
    if (
      !identifier.hasKind()
        || identifier.getKind() != AuthenticationProtos.TokenIdentifier.Kind.HBASE_AUTH_TOKEN
    ) {
      throw new IOException("Invalid TokenIdentifier kind from input " + identifier.getKind());
    }

    // copy the field values
    if (identifier.hasUsername()) {
      username = identifier.getUsername().toStringUtf8();
    }
    if (identifier.hasKeyId()) {
      keyId = identifier.getKeyId();
    }
    if (identifier.hasIssueDate()) {
      issueDate = identifier.getIssueDate();
    }
    if (identifier.hasExpirationDate()) {
      expirationDate = identifier.getExpirationDate();
    }
    if (identifier.hasSequenceNumber()) {
      sequenceNumber = identifier.getSequenceNumber();
    }
  }
Represents the identity information stored in an HBase authentication token.
hbase-client/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenIdentifier.java