RFC 7515 — JSON Web Signature (JWS)

Implemented (via github.com/golang-jwt/jwt)

RFC 7515 — JSON Web Signature (JWS)

Status: Standards Track
Published: 2015-05
L-tier / T-tier: L1 · T5 (issue) + T7 (verify)
OneAuth coverage: Implemented (via github.com/golang-jwt/jwt)
JOSE family: JWS · JWE · JWK · JWA · JWT
See also: RFC_9068.md · LANDSCAPE.md

In one sentence

JWS is the JOSE format for signed JSON payloads — the header.payload.signature
three-dot string you’ve decoded at jwt.io a hundred times.

What problem does it solve?

Without JWS With JWS
Every API rolls its own signed-blob format (HMAC tags appended to URLs, OpenSSL CMS, ad-hoc envelope JSON) One JSON-native, URL-safe signing format that fits in headers and URLs
Verifiers need to know N parsing strategies for “is this token signed?” One spec; one parsing algorithm
Hard to evolve the signing algorithm — every consumer hardcodes one The header carries alg; key rotation and algorithm migration are spec-supported

JWS is the security primitive underneath JWT (RFC 7519). When people say “JWT
verification,” they almost always mean “JWS verification of a JWT payload.”

Relatable example

Every Bearer token from Google, GitHub, Microsoft, Auth0, Okta, or any modern
OAuth IdP is a JWS — specifically, JWS Compact Serialization of a JWT
payload:

eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjkzN2Y...
.
eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLC...
.
xQ7r2lYNbQ7VYwY8qJg-fxFyVxX5g9YpnRGXBA08wHCkRgGE...

Three base64url-encoded pieces separated by .:

  1. Header — {"alg":"RS256","typ":"JWT","kid":"937f..."} — what signed it, what kind of payload, which key
  2. Payload — the actual JSON claims
  3. Signature — the cryptographic signature over base64url(header) + "." + base64url(payload)

When you paste a token into jwt.io, the site is just doing JWS-Compact parsing.

Key concepts

  1. Compact serialization is the OAuth form. JWS also defines a JSON
    serialization (§7.2) that lets you attach multiple signatures or
    unprotected headers. OAuth never uses it.
  2. The alg in the header is the attack surface. “alg”:“none” was a
    famous footgun — libraries that honored it accepted unsigned tokens. The
    defense is to lock allowed algs at the verifier, not trust the header.
    See RFC_7518.md for the registry.
  3. kid (key ID) enables rotation. Header carries kid; verifier looks
    up the matching public key in a JWKS (see RFC_7517.md).
    Rotation is just “publish new kid, mint with new kid, retire old kid
    after grace period.”
  4. Detached payload (§A.6) is rarely used in OAuth. The full token
    travels together; payload-detached signatures are an HTTP Message
    Signatures (RFC 9421 / FAPI 2.0) thing.
  5. The signed input is base64url, not the raw JSON. This matters: bytes
    on the wire are signed; whitespace and key ordering in the original JSON
    don’t matter once base64url-encoded.

Wire example

A JWT (the payload) wrapped in JWS Compact Serialization (the envelope):

HEADER  (base64url decoded):  {"alg":"RS256","typ":"JWT","kid":"key-2025-01"}
PAYLOAD (base64url decoded):  {"iss":"https://as.example.com","sub":"user-42",
                               "aud":"https://api.example.com","exp":1750000000,
                               "iat":1749996400,"scope":"read write"}
SIGNATURE:                    RSA-PKCS1-v1_5-SHA256 over
                              base64url(HEADER) + "." + base64url(PAYLOAD)

On the wire it’s the dotted form:

eyJhbGciOi...kid":"key-2025-01"}
.
eyJpc3MiOi...scope":"read write"}
.
T8C2KFt9...rJZBg

Verifier reads kid=key-2025-01, fetches the matching JWK from JWKS,
verifies the RS256 signature over <header>.<payload>. If it matches, the
payload is authentic.

Where it lands on the OAuth abstraction

  • L1 token format. JWS is the security primitive; RFC 7519 JWT
    is the claim convention layered on it.
  • T5 (issue) and T7 (verify). AS signs at issuance; RS (or the AS for
    introspection) verifies.

OAuth 2.0 status

JOSE family was published in 2015 — three years after OAuth 2.0 (2012). So
JWS is not part of bare 2.0; 6749 §1.4 explicitly says access tokens are
opaque to clients. But every modern 2.0 deployment ships JWT-shaped access
tokens via JWS, because:

  • Self-contained tokens mean the RS can verify locally without an
    introspection round-trip
  • The header’s kid enables rotation; opaque tokens require shared state
  • Discovery via JWKS (RFC 7517) made it easy to consume

So under 2.0, JWS is the token format in practice — but the spec doesn’t
require it. Opaque-token deployments + introspection (RFC 7662) is a valid
alternative.

OAuth 2.1 status

Same — 2.1 doesn’t mandate JWS either. RFC 9068 (the JWT AT profile)
standardized “if you ship JWT access tokens, here’s the shape.” That’s
referenced by 2.1 but not required.

If 2.0 didn’t mandate JWS and 2.1 doesn’t either, why is every doc here
heavy on JWS? Because every IdP you’ll integrate with uses it. The
spec-level optionality and the deployed-reality mandate don’t align.

OneAuth status

7515 surface Status Where (grep-verified) Notes
JWS Compact Serialization (§3.1) Implemented (via github.com/golang-jwt/jwt/v5) apiauth/token_validator.go (jwtIssuer.CreateAccessToken), apiauth/asymmetric_jwt_test.go Standard library form; the only OAuth-relevant serialization
alg header parameter Implemented Library handles; OneAuth verifies algs allow-listed (utils.SigningMethodForAlg, DPoPConfig.AllowedAlgs, AuthenticateClientRequest.AllowedAssertionAlgs) Access tokens sign with HS256, RS256 or ES256. DPoP proofs accept ES256, EdDSA (Ed25519, since 0.1.43), RS256 and PS256 (since 0.1.41). Under OneAuthConfig.FAPI2 client assertions must be PS256, ES256 or EdDSA (0.1.54). An empty HMAC key never signs or verifies (0.1.45), and RSA keys under 2048 bits are refused at load (utils.CheckRSAKeySize, 0.1.47)
kid header for key rotation Implemented keys/kid.go, keys/jwks_handler.go Since 0.1.47 the validator finds a rotated key through OneAuthConfig.KidStore until its grace period ends. JWKSHandler publishes retired keys only from an in-memory *keys.KidStore, and the reference server passes none, so a remote verifier loses the old key at rotation (#421)
alg=none rejection Implemented (library default) golang-jwt rejects by default Explicit allowlist guards against accidental honor
Asymmetric verify via JWKS Implemented keys/jwks_keystore.go Remote JWKS fetch with caching + tracing
JWS JSON Serialization (§3.2) Not implemented — Out of scope for OAuth
  • RFC 7519 JWT — the claim envelope that almost always rides inside JWS
  • RFC 7517 JWK / JWKS — how the verifier finds the public key
  • RFC 7518 JWA — the registry of alg values JWS headers carry
  • RFC 9068 — JWT Access Token profile; the OAuth-specific claims layered on JWT
  • RFC 7516 JWE — sibling spec for encrypted (rather than signed) payloads