Package com.nimbusds.jose.jwk
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 Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JWKMatcher.Builderalgorithm(Algorithm alg)Sets a single JOSE algorithm to match.JWKMatcher.Builderalgorithms(Algorithm... algs)Sets multiple JOSE algorithms to match.JWKMatcher.Builderalgorithms(Set<Algorithm> algs)Sets multiple JOSE algorithms to match.JWKMatcherbuild()Builds a new JWK matcher.JWKMatcher.Buildercurve(Curve curve)Sets a single curve to match (for EC and OKP keys).JWKMatcher.Buildercurves(Curve... curves)Sets multiple curves to match (for EC and OKP keys).JWKMatcher.Buildercurves(Set<Curve> curves)Sets multiple curves to match (for EC and OKP keys).JWKMatcher.BuilderhasKeyID(boolean hasID)Sets key ID presence matching.JWKMatcher.BuilderhasKeyUse(boolean hasUse)Sets key use presence matching.JWKMatcher.BuilderhasX509CertChain(boolean hasX5C)Sets X.509 certificate chain presence matching.JWKMatcher.BuilderkeyID(String id)Sets a single key ID to match.JWKMatcher.BuilderkeyIDs(String... ids)Sets multiple key IDs to match.JWKMatcher.BuilderkeyIDs(Set<String> ids)Sets multiple key IDs to match.JWKMatcher.BuilderkeyOperation(KeyOperation op)Sets a single key operation to match.JWKMatcher.BuilderkeyOperations(KeyOperation... ops)Sets multiple key operations to match.JWKMatcher.BuilderkeyOperations(Set<KeyOperation> ops)Sets multiple key operations to match.JWKMatcher.BuilderkeySize(int keySizeBits)Sets the key size.JWKMatcher.BuilderkeySizes(int... keySizesBits)Sets the key sizes.JWKMatcher.BuilderkeySizes(Set<Integer> keySizesBits)Sets the key sizes.JWKMatcher.BuilderkeyType(KeyType kty)Sets a single key type to match.JWKMatcher.BuilderkeyTypes(KeyType... types)Sets multiple key types to match.JWKMatcher.BuilderkeyTypes(Set<KeyType> types)Sets multiple key types to match.JWKMatcher.BuilderkeyUse(KeyUse use)Sets a single public key use to match.JWKMatcher.BuilderkeyUses(KeyUse... uses)Sets multiple public key uses to match.JWKMatcher.BuilderkeyUses(Set<KeyUse> uses)Sets multiple public key uses to match.JWKMatcher.BuildermaxKeySize(int maxSizeBits)Sets the maximum key size.JWKMatcher.BuilderminKeySize(int minSizeBits)Sets the minimal key size.JWKMatcher.BuilderprivateOnly(boolean privateOnly)Sets the private key matching policy.JWKMatcher.BuilderpublicOnly(boolean publicOnly)Sets the public key matching policy.JWKMatcher.Builderx509CertSHA256Thumbprint(Base64URL x5tS256)Sets a single X.509 certificate SHA-256 thumbprint to match.JWKMatcher.Builderx509CertSHA256Thumbprints(Base64URL... x5tS256s)Sets multiple X.509 certificate SHA-256 thumbprints to match.JWKMatcher.Builderx509CertSHA256Thumbprints(Set<Base64URL> x5tS256s)Sets multiple X.509 certificate SHA-256 thumbprints to match.
-
-
-
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,nullif 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(Set<KeyType> types)
Sets multiple key types to match.- Parameters:
types- The key types,nullif 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,nullif 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(Set<KeyUse> uses)
Sets multiple public key uses to match.- Parameters:
uses- The public key uses,nullif not specified.- Returns:
- This builder.
-
keyOperation
public JWKMatcher.Builder keyOperation(KeyOperation op)
Sets a single key operation to match.- Parameters:
op- The key operation,nullif 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(Set<KeyOperation> ops)
Sets multiple key operations to match.- Parameters:
ops- The key operations,nullif not specified.- Returns:
- This builder.
-
algorithm
public JWKMatcher.Builder algorithm(Algorithm alg)
Sets a single JOSE algorithm to match.- Parameters:
alg- The JOSE algorithm,nullif 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(Set<Algorithm> algs)
Sets multiple JOSE algorithms to match.- Parameters:
algs- The JOSE algorithms,nullif not specified.- Returns:
- This builder.
-
keyID
public JWKMatcher.Builder keyID(String id)
Sets a single key ID to match.- Parameters:
id- The key ID,nullif 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
public JWKMatcher.Builder keyIDs(Set<String> ids)
Sets multiple key IDs to match.- Parameters:
ids- The key IDs,nullif not specified.- Returns:
- This builder.
-
hasKeyUse
public JWKMatcher.Builder hasKeyUse(boolean hasUse)
Sets key use presence matching.- Parameters:
hasUse-trueto match a key with a set use.- Returns:
- This builder.
-
hasKeyID
public JWKMatcher.Builder hasKeyID(boolean hasID)
Sets key ID presence matching.- Parameters:
hasID-trueto 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-trueto match a private key.- Returns:
- This builder.
-
publicOnly
public JWKMatcher.Builder publicOnly(boolean publicOnly)
Sets the public key matching policy.- Parameters:
publicOnly-trueto 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,nullif 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,nullif 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,nullif 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(Set<Base64URL> x5tS256s)
Sets multiple X.509 certificate SHA-256 thumbprints to match.- Parameters:
x5tS256s- The thumbprints,nullif not specified.- Returns:
- This builder.
-
hasX509CertChain
public JWKMatcher.Builder hasX509CertChain(boolean hasX5C)
Sets X.509 certificate chain presence matching.- Parameters:
hasX5C-trueto 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.
-
-