(url: URL)
| 64 | } |
| 65 | |
| 66 | export function buildSigninRedirectQuery(url: URL): Record<string, string> { |
| 67 | const query: Record<string, string> = {}; |
| 68 | // Forward signin-only query params (consumed by the signin page). |
| 69 | for (const param of SIGNIN_QUERY_PARAMS) { |
| 70 | const value = url.searchParams.get(param); |
| 71 | if (value) query[param] = value; |
| 72 | } |
| 73 | const fullPath = url.pathname + url.search + url.hash; |
| 74 | // Set redirect if not root and not already set; strip signin-only params. |
| 75 | if (fullPath !== "/" && !url.searchParams.get("redirect")) { |
| 76 | query["redirect"] = stripSigninQueryParams(fullPath); |
| 77 | } |
| 78 | return query; |
| 79 | } |
| 80 | |
| 81 | // Route-name prefixes that an authenticated user may always access. |
| 82 | const ALLOWED_ROUTE_PATTERNS = [ |
no test coverage detected