vincbeck commented on code in PR #76353:
URL: https://github.com/apache/airflow/pull/76353#discussion_r4592169452
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/keycloak_auth_manager.py:
##########
@@ -224,7 +224,9 @@ async def get_user_from_token(
# the cookie path those claims are covered by the Airflow JWT
signature, so they
# need no separate subject check. A browser token does not carry them
and can
# only be completed by KeycloakJWTMiddleware from the cookies; without
them
- # there is nothing to authorize against.
+ # there is nothing to authorize against. Return None rather than
raise: the
+ # core JWTRefreshMiddleware resolves this token on every request
without the
+ # cookies, and an exception there would end every browser session.
return user if user.access_token else None
Review Comment:
The same 500 is still reachable with a Bearer token. `/ui/auth/token` (token
generation from the UI) calls `generate_jwt`, so on 3.3+ the token has no
Keycloak claims, `get_user_from_token` returns `None` and `get_user` hands it
to the authorization checks. Fix: use `generate_api_jwt` in that route. Can be
a follow-up in core though, it is not related to this change.
--
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]