Class JwtSigningHeader.Builder

java.lang.Object
com.revetsec.jose.JwtSigningHeader.Builder
Enclosing class:
JwtSigningHeader

@NotThreadSafe @CheckReturnValue public static final class JwtSigningHeader.Builder extends Object
Configures an immutable JWT signing header without signing or I/O. Optional setters replace their previous value, and null clears the value. Each build() call takes an independent snapshot.
Since:
1.0.0
Author:
Mark Allen
  • Method Details

    • keyId

      Replaces the optional protected-header key identifier. Text must contain 1–256 UTF-16 code units and valid Unicode.
      Parameters:
      keyId - the key identifier, or null to clear it
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the supplied identifier is empty, too long or invalid Unicode
      Since:
      1.0.0
    • certificateSha256Thumbprint

      public @NonNull JwtSigningHeader.Builder certificateSha256Thumbprint(byte @Nullable [] certificateSha256Thumbprint)
      Replaces the optional SHA-256 digest of a DER certificate with a defensive copy.
      Parameters:
      certificateSha256Thumbprint - exactly 32 digest bytes, or null to clear it
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the supplied digest does not contain exactly 32 bytes
      Since:
      1.0.0
    • build

      Builds an immutable header snapshot without signing or I/O.
      Returns:
      the header
      Since:
      1.0.0
    • toString

      Returns a description without configured identifiers or certificate digests.
      Overrides:
      toString in class Object
      Returns:
      the redacted description
      Since:
      1.0.0