Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change authentication method to use OIDC identity tokens #322

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sdk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cloudpickle==2.0.0
deprecation==2.1.0
fire
google-auth>=1.11.0
google-auth>=2.16.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this since this version is used in caraml-auth-google.

google-cloud-storage>=1.19.0
mlflow>=1.2.0,<=1.23.0
# Numpy >= v1.24.0 is incompatible with our pinned versions of mlflow due to the deprecation of several common numpy
Expand All @@ -12,3 +12,4 @@ protobuf>=3.0.0,<4.0.0dev
python_dateutil>=2.5.3
requests
urllib3>=1.25.3
caraml-auth-google @ git+https://github.com/caraml-dev/caraml-sdk.git@a662528#egg=caraml-auth-google&subdirectory=packages/caraml-auth-google
5 changes: 2 additions & 3 deletions sdk/turing/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ def __init__(
self._api_client = ApiClient(config)

if use_google_oauth:
import google.auth
from caraml_auth.id_token_credentials import get_default_id_token_credentials
from google.auth.transport.requests import Request
from google.auth.transport.urllib3 import urllib3, AuthorizedHttp

# Load default credentials
credentials, _ = google.auth.default(scopes=TuringSession.OAUTH_SCOPES)
credentials = get_default_id_token_credentials(target_audience="turing-sdk.caraml")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the target_audience expected to be used on the auth server? Or is it currently unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unused right now. But we can set up the RequestAuthentication resource to validate the aud field which this target_audience field would translate into in the jwt token generated for service accounts. CMIIW @mbruner

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.. I wonder if we should simply call it "sdk.caraml" in order to not distinguish each SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with any name to be honest 😅 sdk.caraml it shall be then!

# Refresh credentials, in case it's coming from Compute Engine.
# See: https://github.com/googleapis/google-auth-library-python/issues/1211
credentials.refresh(Request())
Expand Down