SachinyadavAug20 commented on issue #77208:
URL: https://github.com/apache/airflow/issues/77208#issuecomment-6956420254

   Proposed fix:
   
   Follow the same pattern recently merged in `KeycloakAuthManager` (#76362) 
and `FabAuthManager` (#73134):
   
   1. **Preserve `next_url` query param:**
      `AwsAuthManager.get_url_login(next_url=...)` --> appends `?next=<url>` 
(via `urlencode`) when present.
   
   2. **Store safe destination in cookie:**
      User hits `/auth/login?next=...` --> validate `next` with `is_safe_url()`:
      => If safe: save in a short-lived HTTP-only cookie 
(`_awsam_login_next_url`, SameSite=None if HTTPS else Lax, max-age 10m matching 
login state).
      => If unsafe or missing: clear/delete any stale `_awsam_login_next_url` 
cookie.
   
   3. **Redirect on SAML callback:**
      IdP completes SAML POST to `/auth/login_callback` --> read 
`_awsam_login_next_url` from cookie:
      => If present & safe: redirect user to `next_url` (e.g. `/dags/...`).
      => If absent or invalid: fallback to `[api] base_url`.
      => Clear `_awsam_login_next_url` cookie (`Max-Age=0`).
   
   I have the patch and unit tests ready locally (all 95 auth manager tests 
passing). Opening PR shortly!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to