KemalIdentity::Testing::JWTForge
Mints JSON Web Tokens, including ones no honest issuer would produce.
The shard validates tokens and deliberately does not issue them, so this lives in
kemal_identity/testing rather than the production entry point. It exists to attack the
validator: every knob a forger would want — the algorithm, the kid, an unsigned token, a
header that lies about what the signature covers, arbitrary bytes in any segment — is
reachable from here, because a validator spec that can only produce well-formed tokens tests
nothing an attacker would ever send.
Constants
A key long enough for every HMAC variant this shard ships.
Class methods
A signed token. algorithm names the alg header and selects the digest, so
passing one the key was not meant for produces exactly the confusion attack.
A token whose header claims one algorithm while the signature was made with another.
An RS256/384/512 token signed by the fixed test key.
Replaces the claims of an already-signed token, leaving its signature untouched.
The alg: none token: a real header, real claims, and an empty signature segment.
Also produced with a non-empty junk signature, since some libraries only check that
the segment is present.