turbaszek commented on a change in pull request #9848:
URL: https://github.com/apache/airflow/pull/9848#discussion_r457113517



##########
File path: airflow/providers/google/common/auth_backend/google_openid.py
##########
@@ -0,0 +1,138 @@
+#
+# 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.
+"""Authentication backend that use Google credentials for authorization."""
+import logging
+from functools import wraps
+from typing import Callable, TypeVar, cast
+
+import google
+import google.auth.transport.requests
+import google.oauth2.id_token
+from flask import Response, _request_ctx_stack, current_app, request  # type: 
ignore
+from google.auth import exceptions
+from google.auth.transport.requests import AuthorizedSession
+from google.oauth2 import service_account
+
+from airflow.configuration import conf
+from airflow.providers.google.common.utils.id_token_credentials import 
get_default_id_token_credentials
+
+log = logging.getLogger(__name__)
+
+_GOOGLE_ISSUERS = ["accounts.google.com", "https://accounts.google.com";]
+AUDIENCE = conf.get("api", "google_oauth2_audience")
+
+
+def create_client_session():
+    """Create a HTTP authorized client."""
+    service_account_path = conf.get("api", "google_key_path")
+    if service_account_path:
+        id_token_credentials = 
service_account.IDTokenCredentials.from_service_account_file(
+            service_account_path
+        )
+    else:
+        id_token_credentials = 
get_default_id_token_credentials(target_audience=AUDIENCE)
+    return AuthorizedSession(credentials=id_token_credentials)
+
+
+def init_app(_):
+    """Initializes authentication."""
+
+
+def _get_id_token_from_request(r):

Review comment:
       I wasn't aware that pylint does not check arguments names, only 
variables 👀 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to