Improve navigation to manage identity from authorization page#3560
Open
Improve navigation to manage identity from authorization page#3560
Conversation
…o manage identity from authorization screen.
…o manage identity from authorization screen.
# Conflicts: # src/frontend/src/lib/components/ui/IdentitySwitcher.svelte # src/frontend/src/routes/(new-styling)/+page.svelte # src/frontend/src/routes/(new-styling)/authorize/+layout.svelte # src/frontend/src/routes/(new-styling)/manage/(authenticated)/+layout.svelte
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the navigation flow from the authorization page to the identity management dashboard by using secure postMessage-based authentication transfer instead of relying solely on session state. When a user clicks to manage their identity from the authorization page, the system authenticates them if needed, then opens a new window and securely transmits the authentication state to it.
Key changes:
- Introduces a new
/internal-authroute that receives authentication state from an opener window via postMessage and redirects to the management dashboard - Adds
toRelative()utility function to safely convert URLs to relative paths, centralizing URL sanitization logic - Implements
openWindowWithAuth()andrequestAuthFromOpener()functions for secure cross-window authentication transfer with origin validation
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/frontend/src/lib/utils/urlUtils.ts |
Adds toRelative() utility to convert absolute URLs to relative paths |
src/frontend/src/lib/utils/urlUtils.test.ts |
Adds tests for the new toRelative() function |
src/frontend/src/routes/(new-styling)/login/+page.ts |
Refactors to use new toRelative() utility instead of inline URL sanitization |
src/frontend/src/routes/(new-styling)/internal-auth/utils.ts |
Implements authentication serialization/deserialization and postMessage-based auth transfer between windows |
src/frontend/src/routes/(new-styling)/internal-auth/+page.ts |
Page loader for internal-auth route that sanitizes the 'next' parameter |
src/frontend/src/routes/(new-styling)/internal-auth/+page.svelte |
Loading page that receives auth from opener window and redirects to management dashboard |
src/frontend/src/routes/(new-styling)/authorize/+layout.svelte |
Adds "manage identity" flow with authentication and new window opening |
src/frontend/src/lib/components/views/ContinueToManage.svelte |
Dialog component prompting user to continue to management dashboard in new window |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…uthorize' into sea-snake/manage-identity-from-authorize
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.
Use internal authentication over post message to improve navigation to manage identity from authorization page.
Changes
ContinueToManagecomponent to views.toRelativetourlUtils.tswith tests and use it for existing/loginroute and newinternal-authroute./authorize/*to use newopenWindowWithAuthmethod to authenticate before opening the dashboard in a new window and then securely transmit this authentication to the new window./internal-authroute to handle receiving and handling this authentication state transmission in a new window.openWindowWithAuthandrequestAuthFromOpenermethods to allow securely transmitting auth from one same origin window to another.Tests
Added
Open dashboard from authorize pagee2e.