Class JwsSigner.Builder

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

@NotThreadSafe @CheckReturnValue public static final class JwsSigner.Builder extends Object
Configures one signing operation. Header and claims are immutable snapshots; the builder owns no credential. Each build() starts a fresh budget, serializes the claims and signs on the caller thread. A trusted JCA provider must cooperate with the budget; it cannot be forcibly interrupted. Callers enforcing an original deadline must also recheck it after the operation.
Since:
1.0.0
Author:
Mark Allen
  • Method Details

    • remainingBudget

      Sets the budget measured from entry to build(), including claims serialization and signing. Nonpositive values are exhausted and cause build() to fail without signing.
      Parameters:
      remainingBudget - the remaining operation allowance, or null to restore the two-second default
      Returns:
      this builder
      Since:
      1.0.0
    • build

      public @NonNull String build()
      Serializes the outbound claims, signs them and verifies the signature before returning the compact JWT. This is an explicit credential emission; it does not validate the application meaning of the claims.
      Returns:
      the verified compact JWT credential; keep it out of logs
      Throws:
      IllegalArgumentException - if the claims exceed the signing JSON profile or size limits
      JwsSigningException - if signing, pair verification or the operation budget fails
      Since:
      1.0.0
    • toString

      Returns a description without the header, claims, key or credential.
      Overrides:
      toString in class Object
      Returns:
      the redacted description
      Since:
      1.0.0