public byte[] toBytes() {
    AuthenticationProtos.TokenIdentifier.Builder builder =
      AuthenticationProtos.TokenIdentifier.newBuilder();
    builder.setKind(AuthenticationProtos.TokenIdentifier.Kind.HBASE_AUTH_TOKEN);
    if (username != null) {
      builder.setUsername(ByteString.copyFromUtf8(username));
    }
    builder.setIssueDate(issueDate).setExpirationDate(expirationDate).setKeyId(keyId)
      .setSequenceNumber(sequenceNumber);
    return builder.build().toByteArray();
  }
Represents the identity information stored in an HBase authentication token.
hbase-client/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenIdentifier.java