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
   It looks like `credentials` could be one of them according to 
`self.target_principal`
   
   1. `Credentials` from `google.oauth2.service_account` 
[[source]](https://google-auth.readthedocs.io/en/master/_modules/google/oauth2/service_account.html#Credentials)
   : returned by `self._get_credentials_using_*` variations
   
   2. `Credentials` from `google.auth.impersonated_credentials` 
[[source]](https://google-auth.readthedocs.io/en/master/_modules/google/auth/impersonated_credentials.html#Credentials)
   : assigned by `if 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: [email protected]

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

Reply via email to