vincbeck commented on code in PR #77182:
URL: https://github.com/apache/airflow/pull/77182#discussion_r4601588389


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/auth.py:
##########
@@ -81,7 +81,9 @@ def generate_token(
     else:
         expiration_seconds = conf.getint("api_auth", "jwt_expiration_time")
 
-    access_token = get_auth_manager().generate_jwt(user, 
expiration_time_in_seconds=expiration_seconds)
+    # The token is used with the ``Authorization`` header, without the cookies 
of the
+    # browser session it was generated from.
+    access_token = get_auth_manager().generate_api_jwt(user, 
expiration_time_in_seconds=expiration_seconds)

Review Comment:
   With Keycloak this token probably stops working after a few minutes. It 
embeds the Keycloak access token from the browser cookie, and nothing refreshes 
it when the token is sent in the `Authorization` header (`refresh_user` only 
runs in the cookie middlewares). Once it expires, `_is_authorized` gets a 401 
or `invalid_grant` from Keycloak and every request returns 403, while the UI 
says the token is valid for 24h. We definitely can do it as a follow-up in the 
Keycloak provider but is that expected?



-- 
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