Application Security Engineer
Flask OIDC Authentication App
A reference Flask application that delegates authentication to an OIDC provider with PKCE, refresh tokens and role-based access.
Architecture
Overview
A teaching-grade reference app demonstrating the modern OIDC authorization code + PKCE flow against Keycloak. The repo includes a hardened nginx config, secure cookie strategy and a JWT validation layer.
Roles from the ID token claims are mapped to Flask decorators, so an endpoint protected by @role('admin') is enforced consistently across the application.
Security properties
- PKCE on the authorization code flow to defeat code interception.
- ID token signature and issuer verification on every request.
- Sessions are HttpOnly, SameSite=Lax, Secure, with a sliding inactivity timeout.
- Refresh tokens rotated and bound to the session identifier.