You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2021/10/25 16:39:39 UTC

[GitHub] [libcloud] RunOrVeith edited a comment on pull request #1621: [Google] Don't retry failed requests on auth when determining if GCE metadata server is available

RunOrVeith edited a comment on pull request #1621:
URL: https://github.com/apache/libcloud/pull/1621#issuecomment-951105677


   sounds reasonable to me, but I actually think we could do something that doesn't require interaction.
   According to [this documentation](https://developers.google.com/identity/sign-in/web/server-side-flow) Step 3, the IA user_id for the guess_type method always ends with "apps.googleusercontent.com",
   
   so I would propose something like 
   ```python
   
   class GoogleAuthType:
       ...
    
       @classmethod
       def guess_type(cls, user_id):
            ...
            elif cls._is_installed_application(user_id):
                  return cls.IA
           elif cls._is_gce():
                 # it's important that this is the last check, because it may take a long time if it fails and is retrying is enabled
                 return cls.GCE
           else:
                 # Either rise an error (not sure which one) or fall back to cls.IA again
                 raise RuntimeError("Could not guess authentication scheme")
   
       @staticmethod
       def _is_installed_application(user_id):
           return user_id.endswith("apps.googleusercontent.com")
   
   ```
   
   I tried it with an instance were I want to authenticate with IA and the ending is there in the user_id


-- 
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: notifications-unsubscribe@libcloud.apache.org

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