Record Class JWT
java.lang.Object
java.lang.Record
smartrics.iotics.identity.experimental.JWT
Represents a JSON Web Token (JWT) consisting of header, payload, and signature components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.header()Returns the value of theheaderrecord component.static JWTParses a JWT token string into a JWT object.payload()Returns the value of thepayloadrecord component.Returns the value of thesignaturerecord component.Returns a nicely formatted string representation of the JWT.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JWT
Creates an instance of aJWTrecord class.- Parameters:
header- the value for theheaderrecord componentpayload- the value for thepayloadrecord componentsignature- the value for thesignaturerecord component
-
-
Method Details
-
parse
Parses a JWT token string into a JWT object.- Parameters:
token- The JWT token string to parse.- Returns:
- The parsed JWT object.
- Throws:
IllegalArgumentException- If the token is invalid.
-
toNiceString
Returns a nicely formatted string representation of the JWT.- Returns:
- A string representation of the JWT with decoded timestamps.
- Throws:
RuntimeException- If the token is invalid or cannot be decoded.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
header
Returns the value of theheaderrecord component.- Returns:
- the value of the
headerrecord component
-
payload
Returns the value of thepayloadrecord component.- Returns:
- the value of the
payloadrecord component
-
signature
Returns the value of thesignaturerecord component.- Returns:
- the value of the
signaturerecord component
-