Blog post: Spring Authorization Server: from zero to a working OIDC provider
Protocol surface
Verify discovery, authorization, token, JWKS, introspection, revocation, and UserInfo endpoints. Enable only the grant types and scopes each registered client needs.
Persistence
Back these contracts with durable storage:
RegisteredClientRepositoryOAuth2AuthorizationServiceOAuth2AuthorizationConsentServiceUserDetailsService
Manage schemas with migrations and refuse production startup when required secrets or database settings are absent.
Security checklist
- Persist RSA or EC signing keys and rotate them without dropping still-valid public keys.
- Map
subto an immutable UUID, not a username. - Keep browser login and consent routes session-based with CSRF protection.
- Keep token and administrative APIs stateless with explicit 401 responses.
- Prefer
client_secret_basic; avoidclient_secret_postlogging exposure. - Require PKCE for public clients.
- Rate-limit credential-bearing endpoints.
- Use separate development seed data and production configuration.
End-to-end verification
Complete a full authorization-code roundtrip, validate the ID token, call UserInfo, refresh where permitted, revoke the token, and confirm the revoked credential is rejected.