bugraoz93 commented on code in PR #51657:
URL: https://github.com/apache/airflow/pull/51657#discussion_r2180369468
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/routes/token.py:
##########
@@ -60,3 +64,23 @@ def create_token(body: TokenBody) -> TokenResponse:
token = get_auth_manager().generate_jwt(user)
return TokenResponse(access_token=token)
+
+
+@token_router.post(
+ "/refresh-token",
+ status_code=status.HTTP_200_OK,
+ responses=create_openapi_http_exception_doc([status.HTTP_400_BAD_REQUEST,
status.HTTP_401_UNAUTHORIZED]),
+)
+def refresh_token(user: GetUserDep) -> TokenResponse:
Review Comment:
Great info! Indeed, it worked in practice with postman, but I couldn't make
any tests green while trying to add unit tests.
Yeap, I got it. I thought we would still utilize the refresh method from the
auth manager. Let me update and update the enpoint with redirect. I thought
just acquiring the token with the new user info should be enough to update
local storage in UI, which worked in the middleware, but it's good to know we
need the context while doing the refresh and unifying solution in this case
makes sense
All good, I am happier this way since the code will contain the best
solution we come up with at the end and needs less and less update in the
future. My authentication knowledge also enhanced a lot. Thanks for your
patience and switft comments! :)
--
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]