Skip to content

Add comprehensive Keycloak OAuth support to products-web application#2

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-cde11336-4983-438a-8d53-eb0a8a41cf21
Draft

Add comprehensive Keycloak OAuth support to products-web application#2
Copilot wants to merge 2 commits intomainfrom
copilot/fix-cde11336-4983-438a-8d53-eb0a8a41cf21

Conversation

Copy link

Copilot AI commented Sep 25, 2025

Implements full Keycloak authentication support for the products-web application while maintaining backward compatibility with Microsoft Entra ID.

Problem

The products-web application was hardcoded to use Microsoft Entra ID for OAuth authentication, limiting its deployment flexibility for organizations using other identity providers like Keycloak.

Solution

Added multi-provider OAuth2/OpenID Connect support with automatic endpoint configuration:

Key Features

  • Multi-Provider Support: Configurable authentication via AUTH_PROVIDER environment variable
  • Auto-Configuration: Automatic OAuth endpoint construction for Keycloak using server URL and realm
  • Backward Compatible: All existing Microsoft Entra ID configurations continue to work unchanged
  • Enhanced Validation: Improved error messages and configuration guidance
  • Comprehensive Documentation: Complete setup guides for both providers

Configuration Examples

Keycloak Configuration:

AUTH_PROVIDER=keycloak
CLIENT_ID=products-web-client
CLIENT_SECRET=your_keycloak_client_secret
KEYCLOAK_SERVER_URL=https://keycloak.yourdomain.com
KEYCLOAK_REALM=your-realm-name
SCOPE=openid profile email

Microsoft Entra ID (unchanged):

AUTH_PROVIDER=entra_id  # or omit for default
CLIENT_ID=your_azure_client_id
CLIENT_SECRET=your_azure_client_secret
TENANT_ID=your_tenant_id

Implementation Details

The application now:

  1. Detects the authentication provider from environment variables
  2. Automatically constructs appropriate OAuth2 endpoints
  3. Updates the UI to reflect the chosen provider ("Login with Keycloak" vs "Login with Microsoft")
  4. Provides provider-specific configuration help and error messages

Files Added/Modified

  • app.py: Enhanced OAuth configuration logic with multi-provider support
  • .env.keycloak.example: Keycloak configuration template
  • KEYCLOAK.md: Comprehensive Keycloak setup documentation
  • README.md & QUICKSTART.md: Updated with multi-provider instructions
  • Screenshots demonstrating Keycloak integration

Testing

The implementation has been tested with:

  • ✅ Keycloak endpoint auto-configuration
  • ✅ Microsoft Entra ID backward compatibility
  • ✅ Configuration validation and error handling
  • ✅ UI updates reflecting the chosen provider

This enhancement enables the products-web application to integrate with a broader range of identity management systems while preserving all existing functionality.

Original prompt

This section details on the original issue you should resolve

<issue_title>Keycloak Support</issue_title>
<issue_description>I want to know if this product_web app will support Keycloak</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: shoootyou <19865273+shoootyou@users.noreply.github.com>
Copilot AI changed the title [WIP] Keycloak Support Add comprehensive Keycloak OAuth support to products-web application Sep 25, 2025
Copilot AI requested a review from shoootyou September 25, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keycloak Support

2 participants