Feature/OIDC auth support#613
Open
TheoAtTechStack wants to merge 16 commits intofastenhealth:mainfrom
Open
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
Contributor
Author
Google.Auth.config.DEMO.mov |
Contributor
Author
|
This PR aims to solve the OIDC authentication flow mentioned here: #47 |
[AUTH-SUPPORT]
…onfig instance test [AUTH-SUPPORT]
… user auth flow [AUTH-SUPPORT]
[AUTH-SUPPORT]
…and flow [AUTH-SUPPORT]
[AUTH-SUPPORT]
[AUTH-SUPPORT]
…ord for compatibility on new users [AUTH-SUPPORT]
[AUTH-SUPPORT]
[AUTH-SUPPORT]
b8589a4 to
a5fc90f
Compare
|
Bump. Ready for review :) |
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.
🔐 OIDC & SSO Authentication Integration
This update introduces OpenID Connect (OIDC) authentication to the Fasten backend and frontend, enabling secure login via Google and other SSO providers (e.g., Auth0, Azure AD, Okta).
🚀 Overview
The authentication flow has been refactored to support OIDC-based login alongside traditional username/password authentication.
The new OIDC system allows users to:
Log in with an external identity provider (Google, Auth0, etc.)
Automatically create or link a user record in our database
Receive a signed JWT token for application access
Be redirected back to the frontend after successful login
This implementation is designed to be easily extendable for additional providers through configuration only (no code changes required).
🧩 Architecture
1. Backend (Go + Gin)
Introduces a generic OIDC handler that:
Loads provider configurations from
config.ymlInitiates authorization redirects to each provider
Handles the provider callback
Verifies the OIDC ID token and extracts claims
Creates or updates a local user entry
Issues a JWT token for session continuity
Redirects the browser to the frontend with the token as a parameter
Supports multiple OIDC providers defined in config.
Example config:
Each provider configuration is auto-discovered and exposed through the
/api/oidc/providersendpoint.2. Database
A new
auth_typecolumn was added to theuserstable via migration to distinguish between:local(username/password users)oidc(users created via OIDC)During OIDC login:
If a user with the same email exists, it’s linked.
If not, a new user record is created with a generated password (since OIDC users don’t require local auth).
3. Frontend (Angular)
Added a SSO login UI showing available OIDC providers dynamically.
When a provider is selected, the browser redirects to
/api/oidc/<provider>.The backend completes the OAuth2 flow and redirects the user back to
/oidc/<provider>/callback?token=<jwt>.The
AuthCallbackComponentin Angular:Parses the token
Calls
completeOidcLogin(token)Redirects the user to the main application route (e.g.,
/dashboard)🔄 Login Flow Summary
🧪 Testing Providers
✅ Google
Already tested with
accounts.google.comFlow confirmed working end-to-end
✅ Auth0
Added configuration for a second provider
Verified login via Auth0-hosted page
Confirms system supports enterprise SSO (Azure AD, Okta, etc.)
🛠️ Migrations
A new migration adds the
auth_typecolumn.🧱 Future Improvements
Add dynamic OIDC provider registration (via admin UI or database)
Map provider roles/groups to local roles
Implement token refresh & logout endpoints
Support multi-tenant configurations
✅ Summary