001package com.nimbusds.oauth2.sdk.id; 002 003 004import net.jcip.annotations.Immutable; 005 006 007/** 008 * JSON Web Token (JWT) identifier. 009 */ 010@Immutable 011public final class JWTID extends Identifier { 012 013 014 /** 015 * Creates a new JWT identifier with the specified value. 016 * 017 * @param value The JWT identifier value. Must not be {@code null} or 018 * empty string. 019 */ 020 public JWTID(final String value) { 021 022 super(value); 023 } 024 025 026 /** 027 * Creates a new JWT identifier with a randomly generated value of the 028 * specified byte length, Base64URL-encoded. 029 * 030 * @param byteLength The byte length of the value to generate. Must be 031 * greater than one. 032 */ 033 public JWTID(final int byteLength) { 034 035 super(byteLength); 036 } 037 038 039 /** 040 * Creates a new JWT identifier with a randomly generated 256-bit 041 * (32-byte) value, Base64URL-encoded. 042 */ 043 public JWTID() { 044 045 super(); 046 } 047 048 049 @Override 050 public boolean equals(final Object object) { 051 052 return object instanceof JWTID && 053 this.toString().equals(object.toString()); 054 } 055}