Repository navigation
[Design Discussion] Recover Gate From a Bookmarked or Shared Sign-in URL #6950
ThaminduDilshan
started this conversation in
Design
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Related Feature Issue
#4396
Problem Summary
Currently Gate removes
executionId,authIdandapplicationIdfrom the URL once the first step loads. So a bookmarked or shared sign-in URL is always/gate/signinwith no params.When it's opened later, there's no execution and no browser session. Gate doesn't know which application the user came from, so it can't send them back. The user ends up on an error with no way out.
There are two cases we need to solve;
High-Level Approach
The idea is to always find a URL to send the user back to, and let the app start a fresh authorization request. If the app redirects to sign-in automatically, the user lands on a new sign-in page.
refparam.~followed by base64url of the ID string.~isn't in the base64url alphabet, so it marks the string form.ref. Gate and the SDKs pass it on as is.SignInresolves it to the application URL and goes back there. So Gate and any custom sign-in page built on the SDK get the same behaviour.A bookmarked or shared sign-in URL then looks like this.
The sign-in page picks the return URL in this order;
Both URLs are optional. A reference that can't be decoded, or points to an application that no longer exists, is handled as no reference. In each case it moves to the next option.
Architecture Overview
/oauth2/authorizeadds the encoded reference to the Gate redirect, along with the existing params.GET /flow/meta?type=REF&id=<ref>decodes it and returns the same metadata astype=APP, including the applicationurl.REFkeepsrefopaque to clients. If another resource kind needs a reference later, the kind is encoded in the value.The existing
type=APP&id=<applicationId>lookup stays.The JavaScript SDKs resolve the return URL. A core helper looks up the application by
ref, then falls back to the default return URL. React, Vue and NuxtSignInuse it when the flow can't be started again in place, and show the existing session expired view with its countdown back. They keep working withapplicationIdalone, for servers that don't send the reference.Nuxt reaches
/flow/metathrough its same-origin route, so that route passes atype=REFlookup through.The default return URL is a new
defaultReturnUrlfield in theflowserver config section. It's seeded declaratively or set withPUT /server-config/flow.GET /flow/metareturns it at the top level, with or without atype, so the sign-in page reads it without a session.{ "defaultReturnUrl": "https://app.example.com", "application": { "name": "My App", "url": "https://myapp.example.com" } }No new store is needed.
Security Considerations
refhides the application ID from users. It isn't a secret, since it only resolves to the application metadata the sign-in page already shows.Impacted Areas
Alternatives Considered
refformats. Values below are for the application ID019a8c5e-2f41-7b3d-a9e6-5c0d1f7b3e28.eyJhbGciOiJBRVMtR0NNIiwiY3QiOi...(220 characters). It's too long, and likely to be flagged by WAFs.Qh7hMiP4RVUhsYIcKgMrCpPVQw4tHHPIZDQT-OMzBiO9ULcaTjNKl40Wrds(59 characters). Still long and random looking, and needs key handling.c51ece2a-21bb-2575-82f6-c535006ecb43(36 characters). A key rotation breaks old bookmarks. Encryption isn't needed sincerefisn't a secret.MDE5YThjNWUtMmY0MS03YjNkLWE5ZTYtNWMwZDFmN2IzZTI4(48 characters). It works, but it's twice as long for UUID application IDs.state, so it rejects the response./gate/signinwith no params carries no organization unit, so Gate can't pick one.deployment.yamlor Gate'sconfig.js. Server-wide runtime settings already live in the server config API, which validates on write and needs no restart.Questions for Community Input
N/A
All reactions