Package com.nimbusds.jose.proc
Class JOSEMatcher
- java.lang.Object
-
- com.nimbusds.jose.proc.JOSEMatcher
-
public class JOSEMatcher extends Object
JOSE object / header matcher. May be used to ensure a JOSE object / header matches a set of application-specific criteria.Supported matching criteria:
- Any, one or more JOSE classes (plain, JWS, JWE).
- Any, one or more algorithms (alg).
- Any, one or more encryption methods (enc).
- Any, one or more JWK URLs (jku).
- Any, one or more JWK IDs (kid).
Matching by X.509 certificate URL, thumbprint and chain is not supported.
- Version:
- 2022-01-24
- Author:
- Vladimir Dzhuvinov
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJOSEMatcher.BuilderBuilder for constructing JOSE matchers.
-
Constructor Summary
Constructors Constructor Description JOSEMatcher(Set<Class<? extends JOSEObject>> classes, Set<Algorithm> algs, Set<EncryptionMethod> encs, Set<URI> jkus, Set<String> kids)Creates a new JOSE matcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Algorithm>getAlgorithms()Returns the JOSE algorithms to match.Set<EncryptionMethod>getEncryptionMethods()Returns the JOSE encryption methods to match.Set<Class<? extends JOSEObject>>getJOSEClasses()Returns the JOSE classes to match.Set<URI>getJWKURLs()Returns the JWK URLs to match.Set<String>getKeyIDs()Returns the key IDs to match.booleanmatches(JOSEObject joseObject)Returnstrueif the specified JOSE object matches.
-
-
-
Constructor Detail
-
JOSEMatcher
public JOSEMatcher(Set<Class<? extends JOSEObject>> classes, Set<Algorithm> algs, Set<EncryptionMethod> encs, Set<URI> jkus, Set<String> kids)
Creates a new JOSE matcher.- Parameters:
classes- The JOSE classes to match,nullif not specified.algs- The JOSE algorithms to match,nullif not specified.encs- The JOSE encryption methods to match,nullif not specified.jkus- The JWK URLs to match,nullif not specified.kids- The key IDs to match,nullif not specified.
-
-
Method Detail
-
getJOSEClasses
public Set<Class<? extends JOSEObject>> getJOSEClasses()
Returns the JOSE classes to match.- Returns:
- The JOSE classes,
nullif not specified.
-
getAlgorithms
public Set<Algorithm> getAlgorithms()
Returns the JOSE algorithms to match.- Returns:
- The JOSE algorithms,
nullif not specified.
-
getEncryptionMethods
public Set<EncryptionMethod> getEncryptionMethods()
Returns the JOSE encryption methods to match.- Returns:
- The JOSE encryption methods,
nullif not specified.
-
getJWKURLs
public Set<URI> getJWKURLs()
Returns the JWK URLs to match.- Returns:
- The JWK URLs,
nullif not specified.
-
getKeyIDs
public Set<String> getKeyIDs()
Returns the key IDs to match.- Returns:
- The key IDs,
nullif not specified.
-
matches
public boolean matches(JOSEObject joseObject)
Returnstrueif the specified JOSE object matches.- Parameters:
joseObject- The JOSE object. Must not benull.- Returns:
trueif the JOSE object matches, elsefalse.
-
-