dabla opened a new pull request, #77182:
URL: https://github.com/apache/airflow/pull/77182

   `POST /ui/auth/token`, the route behind "Generate token" in the UI, signs 
the token with `generate_jwt`, the method for the browser session cookie. An 
auth manager that keeps part of its state in cookies leaves that state out of 
this token. The Keycloak auth manager does so since Airflow 3.3: the Keycloak 
tokens travel in their own cookies, so the generated token carries none. Sent 
with the `Authorization` header it resolves to no user, and every request 
answers 500 in the authorization checks (`'NoneType' object has no attribute 
'access_token'`).
   
   The route now calls `generate_api_jwt`, which exists for exactly this 
client: one that authenticates with the header and sends no cookies. Auth 
managers whose tokens are self-contained do not override it, so nothing changes 
for them.
   
   This is another path to the 500 described in #76352. #76353 fixes the 
browser session whose Keycloak tokens are gone; this one was found in its 
review (https://github.com/apache/airflow/pull/76353#discussion_r4592169452) 
and is separate because it is a core change, while #76353 only touches the 
Keycloak provider.
   
   Test: the route returns what `generate_api_jwt` returns, for both token 
types and with their expiration times. It fails on `main`, where `generate_jwt` 
is called.
   
   related: #76352, #76353, #72381
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5.2)
   
   Generated-by: Claude Code (Fable 5.2) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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