Class JWKMatcher.Builder

  • Enclosing class:
    JWKMatcher

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

    Example usage:

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

      • Builder

        public Builder()
    • Method Detail

      • keyType

        public JWKMatcher.Builder keyType​(KeyType kty)
        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

        public JWKMatcher.Builder keyTypes​(java.util.Set<KeyType> types)
        Sets multiple key types to match.
        Parameters:
        types - The key types, null if not specified.
        Returns:
        This builder.
      • keyUse

        public JWKMatcher.Builder keyUse​(KeyUse use)
        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

        public JWKMatcher.Builder keyUses​(java.util.Set<KeyUse> uses)
        Sets multiple public key uses to match.
        Parameters:
        uses - The public key uses, null if not specified.
        Returns:
        This builder.
      • keyOperation

        public JWKMatcher.Builder keyOperation​(KeyOperation op)
        Sets a single key operation to match.
        Parameters:
        op - The key operation, null if not specified.
        Returns:
        This builder.
      • keyOperations

        public JWKMatcher.Builder keyOperations​(KeyOperation... ops)
        Sets multiple key operations to match.
        Parameters:
        ops - The key operations.
        Returns:
        This builder.
      • keyOperations

        public JWKMatcher.Builder keyOperations​(java.util.Set<KeyOperation> ops)
        Sets multiple key operations to match.
        Parameters:
        ops - The key operations, null if not specified.
        Returns:
        This builder.
      • algorithm

        public JWKMatcher.Builder algorithm​(Algorithm alg)
        Sets a single JOSE algorithm to match.
        Parameters:
        alg - The JOSE algorithm, null if not specified.
        Returns:
        This builder.
      • algorithms

        public JWKMatcher.Builder algorithms​(Algorithm... algs)
        Sets multiple JOSE algorithms to match.
        Parameters:
        algs - The JOSE algorithms.
        Returns:
        This builder.
      • algorithms

        public JWKMatcher.Builder algorithms​(java.util.Set<Algorithm> algs)
        Sets multiple JOSE algorithms to match.
        Parameters:
        algs - The JOSE algorithms, null if not specified.
        Returns:
        This builder.
      • keyID

        public JWKMatcher.Builder keyID​(java.lang.String id)
        Sets a single key ID to match.
        Parameters:
        id - The key ID, null if not specified.
        Returns:
        This builder.
      • keyIDs

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

        public JWKMatcher.Builder keyIDs​(java.util.Set<java.lang.String> ids)
        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​(java.util.Set<java.lang.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​(java.util.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

        public JWKMatcher.Builder x509CertSHA256Thumbprint​(Base64URL x5tS256)
        Sets a single X.509 certificate SHA-256 thumbprint to match.
        Parameters:
        x5tS256 - The thumbprint, null if not specified.
        Returns:
        This builder.
      • x509CertSHA256Thumbprints

        public JWKMatcher.Builder x509CertSHA256Thumbprints​(Base64URL... x5tS256s)
        Sets multiple X.509 certificate SHA-256 thumbprints to match.
        Parameters:
        x5tS256s - The thumbprints.
        Returns:
        This builder.
      • x509CertSHA256Thumbprints

        public JWKMatcher.Builder x509CertSHA256Thumbprints​(java.util.Set<Base64URL> x5tS256s)
        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.