Class JwtMatcher

All Implemented Interfaces:
Matcher<String>

public class JwtMatcher extends ObjectWithReflectiveEqualsHashCodeToString implements Matcher<String>
Matches an expectation's 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