OAuth 2.1 / OIDC Rules
You are working in the QAuth OAuth/OIDC implementation.
Spec References
- OAuth 2.1 (
draft-ietf-oauth-v2-1) — PKCE mandatory for all authorization code flows - OIDC Core 1.0 —
subis stable UUID,emailis optional and omitted when unverified - RFC 7662 — Token introspection (compliance feature, client auth required)
- RFC 7517 — JSON Web Key (JWKS)
- RFC 9700 — OAuth 2.0 Security Best Current Practice
Endpoints
| Endpoint | Description |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| POST /auth/register | Registration — creates user, credential, attribute, verification token; same 202 for an already registered address |
| POST /auth/login | Password login — looks up user_credentials by (realm_id, 'password', external_sub) where external_sub is the normalised email |
| GET /auth/verify | Email verification — marks credential_data.email_verified=true and user_attributes.verified=true |
| POST /auth/resend-verification | Resend verification email |
| GET /oauth/authorize | Authorization Code Flow initiation |
| POST /oauth/token | Token endpoint (authorization_code, refresh_token grants) |
| POST /oauth/introspect | RFC 7662 introspection (client auth required) |
| GET /oauth/userinfo | OIDC userinfo — reads sub from JWT, returns verified email from user_attributes; the token's aud must contain its client_id or the userinfo URL |
| GET /.well-known/jwks.json | JWKS endpoint |
| GET /.well-known/openid-configuration | OIDC discovery |
Introspection
POST /oauth/introspect is a compliance feature, not a primary usage path.
Modern applications validate JWT tokens locally via JWKS.
Client authentication is required on this endpoint — not optional.
This prevents token enumeration attacks. The endpoint must return {"active":false}
for any unauthenticated request rather than an error, per RFC 7662.
OIDC Discovery
/.well-known/openid-configuration must always reflect the current set of supported
grant types, response types, and signing algorithms.
Wallet federation (T4, Epic #231) is merged and flag-gated behind
WALLET_FEDERATION_ENABLED, which is off by default. Sign-in runs on the dedicated
/ui/wallet-login + /oid4vp/response seam in apps/auth-server, not through
WalletProvider.verify() — that method throws unconditionally by design and must keep
throwing (see AGENTS.md). Two discovery fields are still not advertised, and each is
gated on a distinct condition rather than on wallet federation shipping (checked
2026-08-31):
subject_types_supportedreads["public"]
(apps/auth-server/src/app/helpers/discovery.ts:151). Add "pairwise" only when QAuth
actually derives pairwise subject identifiers; there are no pairwise salts today, so
advertising it would be a false capability claim.
request_object_signing_alg_values_supported— required for JAR
([RFC 9101] signed requests), not SIOPv2. HAIP 1.0 §5.1 mandates signed
authorization requests via JAR with request_uri; SIOPv2 is not the mechanism
(see ADR-004 § Spec status (2026-07-20)).
HAIP 1.0 §7 requires ES256 at minimum, and QAuth supports ES256 — JwsAlgorithm
carries it (libs/core/crypto/src/lib/algorithms.ts:61, #298, closed 2026-07-26) and the
Status List Token verifier requires it (libs/server/federation/src/status/status-list-token.ts:104).
Note ES256 is deliberately absent from SignatureAlgorithm: it exists for the
wallet-federation seam only, and QAuth's own token signing stays EdDSA/hybrid per ADR-005.
Advertise this field when QAuth accepts signed request objects on its own authorization
endpoint — which is a separate capability from verifying a wallet's presentation.
Before advertising either field, confirm the capability against the tree rather than
against this list.
Email Claim Behaviour
The email claim in ID tokens, access tokens and userinfo responses:
- Released only when the
emailscope was granted — userinfo since #229,
ID tokens since #259, access tokens on every grant since 2026-10-19
(ANT-2026-2O0T72HY); without the scope the claims are omitted even for a
verified email. Every site calls resolveEmailClaimsForScopes
(apps/auth-server/src/app/helpers/email-claims.ts); the scope-less
/auth/login token carries none
- Present only when
user_attributeshas a verified email (verified=true) - Absent (not null) when no verified email exists
- Sourced from the highest-trust attribute source (
wallet > oidc_* > self_reported);
the schema and auth-engine skills own the claim-resolution trust order.
This is intentional and correct per OIDC Core 1.0. Applications that assume
email is always present in the userinfo response are not OIDC-compliant.
Profile Claim Behaviour
The name claim (OIDC Core §5.1) is released only when the profile scope was
granted, in the ID token (since #755) and at userinfo, and is omitted when the
user has no first or last name stored. Both sites call
resolveProfileClaimsForScopes
(apps/auth-server/src/app/helpers/profile-claims.ts), so they release the same
profile claims for the same grant. Access tokens carry no profile claim.
PKCE
PKCE is mandatory (S256 only; plain rejected) for all authorization code flows.
For the flow, verifier/challenge mechanics, and grant-type rules, see the
auth-oauth skill — this skill covers only OIDC-specific endpoint behaviour.
Token Security (QAuth specifics)
QAuth's token implementation (generic OAuth token-handling rules are in the
auth-oauth skill):
- Access tokens: JWT, signed with Ed25519 by default. Post-quantum hybrid
signing (ML-DSA-65 + Ed25519) is implemented and merged, gated behind
HYBRID_SIGNING_ENABLED which is off by default — it is not future work
(libs/core/crypto/src/lib/hybrid-signing.ts, ADR-005; checked 2026-08-31).
- Refresh tokens: opaque random tokens, SHA-256 hashed before storage
- Verification tokens: opaque random tokens, SHA-256 hashed before storage
- All token hashes stored as 64-character hex strings (SHA-256 output)
Related
- OAuth flows, PKCE, grant types:
auth-oauthskill - Claim resolution & identity model:
schema,auth-engineskills - Timing-safe / secrets / rate limiting:
securityskill