bugraoz93 commented on code in PR #47043: URL: https://github.com/apache/airflow/pull/47043#discussion_r1970676850
########## providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/login.py: ########## @@ -0,0 +1,42 @@ +# 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 datetime import timedelta +from typing import cast + +from airflow.api_fastapi.app import get_auth_manager +from airflow.providers.fab.auth_manager.api_fastapi.datamodels.login import LoginResponse +from airflow.providers.fab.auth_manager.fab_auth_manager import FabAuthManager + + +class FABAuthManagerLogin: + """Login Service for FABAuthManager.""" + + @classmethod + def create_token(cls, expiration_time_in_sec: int) -> LoginResponse: + """Create a new token with the given expiration time.""" + auth_manager = cast(FabAuthManager, get_auth_manager()) + + # There is no user base expiration in FAB, so we can't use this. Review Comment: This is a bit problem. In FAB, I couldn't find a way to set this one. I think we need to implement our own mechanism to support expiration time for tokens. I can include it into this PR but let's have a consensus on the approach on this. -- 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]
