You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "joonsan-kim-moloco (via GitHub)" <gi...@apache.org> on 2023/06/02 06:05:05 UTC

[GitHub] [airflow] joonsan-kim-moloco commented on a diff in pull request #31651: Support providing creds lifetime for GCP connection token

joonsan-kim-moloco commented on code in PR #31651:
URL: https://github.com/apache/airflow/pull/31651#discussion_r1213959948


##########
airflow/providers/google/cloud/utils/credentials_provider.py:
##########
@@ -261,6 +263,16 @@ def get_credentials_and_project(self) -> tuple[google.auth.credentials.Credentia
 
             project_id = _get_project_id_from_service_account_email(self.target_principal)
 
+        if self.lifetime:
+            # Create new impersonated credentials with an extended expiration time
+            credentials = impersonated_credentials.Credentials(
+                source_credentials=credentials.source_credentials,

Review Comment:
   Regarding this comment on issue : https://github.com/apache/airflow/issues/31648#issuecomment-1572325675
   
   I think it's because there are two different `Credentials` here
   
   1. `Credentials` from `google.oauth2.service_account` [[source]](https://google-auth.readthedocs.io/en/master/_modules/google/oauth2/service_account.html#Credentials)
   2. `Credentials` from `google.auth.impersonated_credentials` [[source]](https://google-auth.readthedocs.io/en/master/_modules/google/auth/impersonated_credentials.html#Credentials)
   
   It looks like `credentials` could be one of both class according to `self.target_principal`



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org