bugraoz93 commented on code in PR #55969:
URL: https://github.com/apache/airflow/pull/55969#discussion_r2372583632


##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/services/token.py:
##########
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from typing import Literal
+
+from fastapi import HTTPException
+from keycloak import KeycloakAuthenticationError
+from starlette import status
+
+from airflow.api_fastapi.app import get_auth_manager
+from airflow.configuration import conf
+from airflow.providers.keycloak.auth_manager.keycloak_auth_manager import 
KeycloakAuthManager
+from airflow.providers.keycloak.auth_manager.user import 
KeycloakAuthManagerUser
+
+
+def create_token_for(username: str, password: str, token_type: Literal["API", 
"CTL"]) -> str:

Review Comment:
   Thanks for the review! I thought that as well, I lean toward this since the 
default of the `generate_jwt` expiration time is using API one. I think we are 
doing with time in seconds in other auth managers, just tried a different 
approach on this because of the default and passing it has no meaning for the 
API. Following up on the same approach would be good. I was thinking if we like 
this more I can update others similar yo this.
   I have no strong stance, I can update to take seconds and that would save me 
from updating others



##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/services/token.py:
##########
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from typing import Literal
+
+from fastapi import HTTPException
+from keycloak import KeycloakAuthenticationError
+from starlette import status
+
+from airflow.api_fastapi.app import get_auth_manager
+from airflow.configuration import conf
+from airflow.providers.keycloak.auth_manager.keycloak_auth_manager import 
KeycloakAuthManager
+from airflow.providers.keycloak.auth_manager.user import 
KeycloakAuthManagerUser
+
+
+def create_token_for(username: str, password: str, token_type: Literal["API", 
"CTL"]) -> str:

Review Comment:
   Thanks for the review! I thought that as well, I lean toward this since the 
default of the `generate_jwt` expiration time is using API one. I think we are 
doing with time in seconds in other auth managers, just tried a different 
approach on this because of the default and passing it has no meaning for the 
API. Following up on the same approach would be good. I was thinking if we like 
this more I can update others similar to this.
   I have no strong stance, I can update to take seconds and that would save me 
from updating others



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