safaehar commented on code in PR #76741:
URL: https://github.com/apache/airflow/pull/76741#discussion_r4666894698
##########
airflow-core/src/airflow/api_fastapi/core_api/security.py:
##########
@@ -171,6 +171,19 @@ async def get_user(
return await
resolve_user_from_token(request.cookies.get(COOKIE_NAME_JWT_TOKEN))
+async def get_optional_user(
+ request: Request,
+ bearer_credentials: HTTPAuthorizationCredentials | None =
Depends(bearer_scheme),
+) -> BaseUser | None:
+ """Return the authenticated user, or ``None`` when the request is
unauthenticated."""
+ try:
+ return await get_user(request, _oauth_token=None,
bearer_credentials=bearer_credentials)
+ except HTTPException as error:
Review Comment:
adressed !
--
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]