[For auth/token. Don't merge]Add OIDC authentication and JWT token management#4
Draft
QAM wants to merge 1 commit intoLadybugDB:masterfrom
Draft
[For auth/token. Don't merge]Add OIDC authentication and JWT token management#4QAM wants to merge 1 commit intoLadybugDB:masterfrom
QAM wants to merge 1 commit intoLadybugDB:masterfrom
Conversation
This commit introduces a comprehensive authentication system with OpenID Connect (OIDC) integration and JWT token support. Features: - OIDC authentication with any OIDC-compliant provider (Keycloak, Auth0, Okta, etc.) - Session-based authentication with email stored in backend session - JWT token authentication as alternative to session-based auth - PKCE (Proof Key for Code Exchange) support for enhanced security - Middleware for protecting API routes with automatic redirect to login - HTML login page with error handling - Token generation and validation utilities New modules: - src/server/auth/: Complete OIDC authentication module - index.js: Main authentication initialization - oidc.js: OIDC strategy configuration with Passport - middleware.js: requireAuth and optionalAuth middleware - routes.js: Authentication routes (/auth/login, /auth/callback, /auth/logout) - utils.js: Authentication utility functions - README.md: Comprehensive documentation - src/server/token/: JWT token management - index.js: Token generation endpoint with HTML interface and JSON API Configuration: - Environment variables for OIDC configuration (OIDC_DISCOVERY_URL, OIDC_CLIENT_ID, etc.) - AUTH_ENABLED flag to enable/disable authentication - Session and JWT secret configuration - Automatic fallback when authentication is disabled Integration: - Updated src/server/index.js to initialize authentication module - Updated src/utils/AxiosWrapper.js to handle authentication errors - All /api/* routes are automatically protected by requireAuth middleware Dependencies added: - express-session: Session management - jsonwebtoken: JWT token generation and validation - passport: Authentication middleware - passport-oauth2: OAuth2/OIDC strategy for Passport The authentication system is designed to be: - Independent and minimally invasive to existing codebase - Configurable via environment variables - Optional (can be disabled via AUTH_ENABLED=false) - Production-ready with security best practices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces a comprehensive authentication system with OpenID Connect (OIDC) integration and JWT token support.
Features:
New modules:
src/server/auth/: Complete OIDC authentication module
src/server/token/: JWT token management
Configuration:
Integration:
Dependencies added:
The authentication system is designed to be: