-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Summary
Now that the Petition app will integrate with BetterGov’s in-house SSO (Keycloak), we need to migrate our existing Google SSO users so they can continue signing in seamlessly through the new centralized authentication system.
This migration ensures that users don’t lose access to their existing accounts and data after the switch.
🧱 Objectives
- Preserve all existing Petition user accounts that were originally authenticated via Google.
- Link these accounts with their corresponding Keycloak identities (which also use Google as a federated IdP).
- Ensure no duplicate users are created during or after the migration.
🛠️ Migration Plan
-
Analyze Existing User Data
- Identify all users currently authenticated through Google OAuth.
- Confirm that
emailis stored and used as the unique identifier in the Petition database.
-
Prepare Keycloak Environment
- Ensure Google Identity Provider is enabled in the
bettergovrealm. - Confirm users who log in via Google through Keycloak have matching email addresses.
- Ensure Google Identity Provider is enabled in the
-
Implement Linking Logic
- On first login via BetterGov SSO:
- Check if the user’s email already exists in the Petition DB.
- If yes → link Keycloak user ID to the existing Petition record.
- If no → create a new record as a standard SSO user.
- On first login via BetterGov SSO:
-
Database Update
- Add a new column to store
keycloak_user_idor equivalent identifier. - Optionally log migration status or timestamps for audit trail.
- Add a new column to store
-
Testing
- Verify that migrated users can log in with the same Google account through Keycloak.
- Ensure data integrity — no duplicate user rows created.
- Test behavior for new (non-Google) Keycloak users.
🧠 Benefits
- Users experience a smooth transition with no new registration required.
- Maintains existing data and activity records linked to each account.
- Consolidates authentication under one secure and centralized system.
✅ Acceptance Criteria
- All existing Google-authenticated users successfully linked to Keycloak accounts.
- No duplicate accounts created during migration.
- Database migration and linking logic tested in staging.
- Migration script or logic documented for future reference.
📎 Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels