SachinyadavAug20 commented on code in PR #77209:
URL: https://github.com/apache/airflow/pull/77209#discussion_r4617205713
##########
providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py:
##########
@@ -196,14 +202,21 @@ def _start_login(request: Request, mode: str) ->
RedirectResponse:
callback_url = saml_auth.login(f"{mode}:{nonce}")
response = RedirectResponse(url=callback_url)
pending = _read_pending_logins(request)[-(MAX_PENDING_LOGINS - 1) :]
- pending.append(
- {
- "nonce": nonce,
- "request_id": saml_auth.get_last_request_id(),
- "mode": mode,
- "exp": time.time() + LOGIN_STATE_MAX_AGE,
- }
- )
+ entry: dict[str, Any] = {
+ "nonce": nonce,
+ "request_id": saml_auth.get_last_request_id(),
+ "mode": mode,
+ "exp": time.time() + LOGIN_STATE_MAX_AGE,
+ }
+ if mode == LOGIN_MODE_REDIRECT:
+ next_url = request.query_params.get("next")
+ if (
Review Comment:
Added log.debug("Dropping next URL %r: exceeds maximum length or is
unsafe.", next_url) when next is present but dropped.
##########
providers/amazon/tests/unit/amazon/aws/auth_manager/routes/test_login.py:
##########
@@ -149,7 +160,7 @@ def get_login_callback_response(
relay_state: str,
*,
base_url: str = "http://testserver",
- pending: list[tuple[str, str, str]] | None = None,
+ pending: list[tuple] | None = None,
Review Comment:
Updated the type hints to tuple[str, str, str] | tuple[str, str, str, str |
None] and fixed the docstrings.
--
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]