Cornell SSO login integration#607
Merged
Merged
Conversation
This reverts commit 2356d42.
Implements frontend SSO authentication matching existing Google OAuth pattern. Adds Cornell NetID login buttons for Riders, Admins, and Drivers with role-based authentication using SAML RelayState to preserve userType through IdP redirect. Frontend Changes: - Add SSO callback handler to detect auth=sso_success URL parameter - Fetch profile + JWT from /api/sso/profile with session cookies - Store JWT in encrypted cookies matching Google OAuth pattern - Add authMethod tracking (sso vs google) for proper logout flow - Add SSO login buttons with Cornell branding - Add error display for SSO authentication failures Backend Changes: - Implement RelayState in /api/sso/login to encode userType + redirectUri - Extract RelayState in /api/sso/callback to preserve role through SAML - Store validated userType in session for /profile endpoint - Update findUserByNetID to match Google OAuth table-based lookup pattern - Remove defaulting logic - fail explicitly if userType missing - Add CORS configuration with credentials support - Configure absolute frontend redirects Session Management: - Add userType to SessionData interface for persistence - Use session-based auth bridged to JWT tokens - Support both SSO and Google OAuth logout flows
Member
|
[diff-counting] Significant lines: 887. |
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.
Summary
This pull request implements Cornell SSO (Single Sign-On) authentication using SAML 2.0 protocol, allowing users to authenticate with their Cornell NetID. The implementation works side-by-side with the existing Google OAuth authentication method.
AuthManagercomponent/api/sso/login,/api/sso/callback,/api/sso/profile,/api/sso/logout)GoogleAuth.tsxcomponentserver/test-sso.sh)Test Plan
Manual Testing:
.envBackend Testing:
./server/test-sso.shto validate SSO endpointsKey Files Changed:
frontend/src/components/AuthManager/AuthManager.tsx- Added SSO login handlers and callback processingfrontend/src/App.tsx- Minor cleanupfrontend/src/components/AuthManager/authmanager.module.css- Added SSO button stylingfrontend/src/components/AuthManager/GoogleAuth.tsx- Removed (no longer needed)server/test-sso.sh- New test script for SSO validationNotes
@cornell.edu) in the same database tables as Google OAuth.CORNELL_SSO_IMPLEMENTATION.mdfor details).Breaking Changes
None. This implementation is fully backward compatible: