dabla commented on code in PR #59411:
URL: https://github.com/apache/airflow/pull/59411#discussion_r2637792435


##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/routes/token.py:
##########
@@ -36,8 +44,16 @@
     status_code=status.HTTP_201_CREATED,
     responses=create_openapi_http_exception_doc([status.HTTP_400_BAD_REQUEST, 
status.HTTP_401_UNAUTHORIZED]),
 )
-def create_token(body: TokenBody) -> TokenResponse:
-    token = create_token_for(body.username, body.password)
+def create_token(
+    body: TokenBody,
+) -> TokenResponse:
+    credentials = body.root
+    if isinstance(credentials, TokenPasswordBody):

Review Comment:
   Wouldn't it be more logical to have the create_token method also exists on 
the TokenBody class, and the default implementation raising the ValueError?  
That way we just have to call that method within the create_token method here, 
which avoids need for if else statement with instanceof?



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