Class JwtMatcher
Jwt criteria against the JSON Web Token carried in a request
header.
The matcher reads the configured header from the request, strips the configured scheme prefix
(default Bearer, case-insensitive), splits the token into its header.payload.signature
segments and base64url-decodes the header and payload segments into JSON. Claim
criteria are matched against the payload; the algorithm convenience criterion is matched
against the JOSE header alg. See Jwt for the full description of the criteria and
their NottableString (regex / negation) semantics.
No signature verification is performed — this is request matching for test routing only. A blank criterion matches every request; a non-blank criterion never matches a request whose header is absent or whose token is malformed (a clean non-match, never an exception).
- Author:
- jamesdbloom
-
Method Summary
Modifier and TypeMethodDescriptionString[]The request header from which the JWT is read (defaultauthorization).booleanisBlank()booleanmatches(MatchDifference context, String headerValue) Methods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
equals, hashCode, toString
-
Method Details
-
getHeaderName
The request header from which the JWT is read (defaultauthorization). Exposed so the request matcher can extract the header value to match against. -
isBlank
public boolean isBlank() -
matches
-
fieldsExcludedFromEqualsAndHashCode
- Overrides:
fieldsExcludedFromEqualsAndHashCodein classObjectWithReflectiveEqualsHashCodeToString
-