Record Class JWSCompactSerialization

java.lang.Object
java.lang.Record
de.christofreichardt.json.websignature.JWSCompactSerialization
Record Components:
encodedHeader - the BASE64 URL encoded JOSE header.
encodedPayload - the BASE64 URL encoded payload.
encodedSignature - the BASE64 URL encoded signature.

public record JWSCompactSerialization(String encodedHeader, String encodedPayload, String encodedSignature) extends Record
A holder for the strings representing the compact serialization format as specified by RFC 7515 (JSON Web Signature).
Author:
Christof Reichardt
See Also:
  • Constructor Details

    • JWSCompactSerialization

      public JWSCompactSerialization(String encodedHeader, String encodedPayload, String encodedSignature)
      Creates an instance of a JWSCompactSerialization record class.
      Parameters:
      encodedHeader - the value for the encodedHeader record component
      encodedPayload - the value for the encodedPayload record component
      encodedSignature - the value for the encodedSignature record component
  • Method Details

    • of

      public static JWSCompactSerialization of(String compactSerialization)
      Factory method which expects an actual compact serialization format.
      Parameters:
      compactSerialization - an actual compact serialization format.
      Returns:
      a JWSCompactSerialization instance.
    • joseHeader

      public jakarta.json.JsonObject joseHeader()
      Decodes the BASE64 URL encoded JOSE header and constructs an appropriate JsonObject.
      Returns:
      the JOSE header as JsonObject.
    • payload

      public jakarta.json.JsonObject payload()
      Decodes the BASE64 URL encoded payload and constructs an appropriate JsonObject.
      Returns:
      the parsed JsonObject
    • strJoseHeader

      public String strJoseHeader()
      Returns the decoded (protected) JOSE header.
      Returns:
      the decoded JOSE header
    • strPayload

      public String strPayload()
      Returns the decoded payload.
      Returns:
      the decoded payload
    • toString

      public String toString()
      Returns the actual compact serialization format as string object.
      Specified by:
      toString in class Record
      Returns:
      the actual compact serialization format as string object.
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • encodedHeader

      public String encodedHeader()
      Returns the value of the encodedHeader record component.
      Returns:
      the value of the encodedHeader record component
    • encodedPayload

      public String encodedPayload()
      Returns the value of the encodedPayload record component.
      Returns:
      the value of the encodedPayload record component
    • encodedSignature

      public String encodedSignature()
      Returns the value of the encodedSignature record component.
      Returns:
      the value of the encodedSignature record component