Class JWKMatcher.Builder

java.lang.Object
com.nimbusds.jose.jwk.JWKMatcher.Builder
Enclosing class:
JWKMatcher

public static class JWKMatcher.Builder extends Object
Builder for constructing JWK matchers.

Example usage:

 JWKMatcher matcher = new JWKMatcher().keyID("123").build();
 
  • Constructor Details

  • Method Details

    • keyType

      Sets a single key type to match.
      Parameters:
      kty - The key type, null if not specified.
      Returns:
      This builder.
    • keyTypes

      public JWKMatcher.Builder keyTypes(KeyType... types)
      Sets multiple key types to match.
      Parameters:
      types - The key types.
      Returns:
      This builder.
    • keyTypes

      Sets multiple key types to match.
      Parameters:
      types - The key types, null if not specified.
      Returns:
      This builder.
    • keyUse

      Sets a single public key use to match.
      Parameters:
      use - The public key use, null if not specified.
      Returns:
      This builder.
    • keyUses

      public JWKMatcher.Builder keyUses(KeyUse... uses)
      Sets multiple public key uses to match.
      Parameters:
      uses - The public key uses.
      Returns:
      This builder.
    • keyUses

      Sets multiple public key uses to match.
      Parameters:
      uses - The public key uses, null if not specified.
      Returns:
      This builder.
    • keyOperation

      Sets a single key operation to match.
      Parameters:
      op - The key operation, null if not specified.
      Returns:
      This builder.
    • keyOperations

      Sets multiple key operations to match.
      Parameters:
      ops - The key operations.
      Returns:
      This builder.
    • keyOperations

      Sets multiple key operations to match.
      Parameters:
      ops - The key operations, null if not specified.
      Returns:
      This builder.
    • algorithm

      Sets a single JOSE algorithm to match.
      Parameters:
      alg - The JOSE algorithm, null if not specified.
      Returns:
      This builder.
    • algorithms

      Sets multiple JOSE algorithms to match.
      Parameters:
      algs - The JOSE algorithms.
      Returns:
      This builder.
    • algorithms

      Sets multiple JOSE algorithms to match.
      Parameters:
      algs - The JOSE algorithms, null if not specified.
      Returns:
      This builder.
    • keyID

      Sets a single key ID to match.
      Parameters:
      id - The key ID, null if not specified.
      Returns:
      This builder.
    • keyIDs

      public JWKMatcher.Builder keyIDs(String... ids)
      Sets multiple key IDs to match.
      Parameters:
      ids - The key IDs.
      Returns:
      This builder.
    • keyIDs

      Sets multiple key IDs to match.
      Parameters:
      ids - The key IDs, null if not specified.
      Returns:
      This builder.
    • hasKeyUse

      public JWKMatcher.Builder hasKeyUse(boolean hasUse)
      Sets key use presence matching.
      Parameters:
      hasUse - true to match a key with a set use.
      Returns:
      This builder.
    • hasKeyID

      public JWKMatcher.Builder hasKeyID(boolean hasID)
      Sets key ID presence matching.
      Parameters:
      hasID - true to match a key with a set ID.
      Returns:
      This builder.
    • privateOnly

      public JWKMatcher.Builder privateOnly(boolean privateOnly)
      Sets the private key matching policy.
      Parameters:
      privateOnly - true to match a private key.
      Returns:
      This builder.
    • publicOnly

      public JWKMatcher.Builder publicOnly(boolean publicOnly)
      Sets the public key matching policy.
      Parameters:
      publicOnly - true to match a public only key.
      Returns:
      This builder.
    • minKeySize

      public JWKMatcher.Builder minKeySize(int minSizeBits)
      Sets the minimal key size.
      Parameters:
      minSizeBits - The minimum key size in bits, zero implies no minimum key size limit.
      Returns:
      This builder.
    • maxKeySize

      public JWKMatcher.Builder maxKeySize(int maxSizeBits)
      Sets the maximum key size.
      Parameters:
      maxSizeBits - The maximum key size in bits, zero implies no maximum key size limit.
      Returns:
      This builder.
    • keySize

      public JWKMatcher.Builder keySize(int keySizeBits)
      Sets the key size.
      Parameters:
      keySizeBits - The key size in bits, zero if not specified.
      Returns:
      This builder.
    • keySizes

      public JWKMatcher.Builder keySizes(int... keySizesBits)
      Sets the key sizes.
      Parameters:
      keySizesBits - The key sizes in bits.
      Returns:
      This builder.
    • keySizes

      public JWKMatcher.Builder keySizes(Set<Integer> keySizesBits)
      Sets the key sizes.
      Parameters:
      keySizesBits - The key sizes in bits.
      Returns:
      This builder.
    • curve

      public JWKMatcher.Builder curve(Curve curve)
      Sets a single curve to match (for EC and OKP keys).
      Parameters:
      curve - The curve, null if not specified.
      Returns:
      This builder.
    • curves

      public JWKMatcher.Builder curves(Curve... curves)
      Sets multiple curves to match (for EC and OKP keys).
      Parameters:
      curves - The curves.
      Returns:
      This builder.
    • curves

      public JWKMatcher.Builder curves(Set<Curve> curves)
      Sets multiple curves to match (for EC and OKP keys).
      Parameters:
      curves - The curves, null if not specified.
      Returns:
      This builder.
    • x509CertSHA256Thumbprint

      Sets a single X.509 certificate SHA-256 thumbprint to match.
      Parameters:
      x5tS256 - The thumbprint, null if not specified.
      Returns:
      This builder.
    • x509CertSHA256Thumbprints

      Sets multiple X.509 certificate SHA-256 thumbprints to match.
      Parameters:
      x5tS256s - The thumbprints.
      Returns:
      This builder.
    • x509CertSHA256Thumbprints

      Sets multiple X.509 certificate SHA-256 thumbprints to match.
      Parameters:
      x5tS256s - The thumbprints, null if not specified.
      Returns:
      This builder.
    • hasX509CertChain

      public JWKMatcher.Builder hasX509CertChain(boolean hasX5C)
      Sets X.509 certificate chain presence matching.
      Parameters:
      hasX5C - true to match a key with a set X.509 certificate chain.
      Returns:
      This builder.
    • build

      public JWKMatcher build()
      Builds a new JWK matcher.
      Returns:
      The JWK matcher.