Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Add Credentials implementation supplying an ID token.#234

Merged
theacodes merged 3 commits intogoogleapis:masterfrom
kryzthov:master
Feb 8, 2018
Merged

Add Credentials implementation supplying an ID token.#234
theacodes merged 3 commits intogoogleapis:masterfrom
kryzthov:master

Conversation

@kryzthov
Copy link
Contributor

@jonparrott Here's a primitive implementation for #130.
This adds everything in google.auth.id_token as I don't know any better.
Could you advise on how to structure this better?
Thanks!

@theacodes theacodes requested a review from dhermes January 19, 2018 01:09
@theacodes
Copy link
Contributor

I changed a significant portion of this so some else needs to review. @dhermes?


def id_token_jwt_grant(request, token_uri, assertion):
"""Implements the JWT Profile for OAuth 2.0 Authorization Grants, but
requests an OpenID Connect ID Token instead of a access token.

This comment was marked as spam.

This comment was marked as spam.

Args:
request (google.auth.transport.Request): A callable used to make
HTTP requests.
token_uri (str): The OAuth 2.0 authorizations server's token endpoint

This comment was marked as spam.

This comment was marked as spam.

URI.
assertion (str): JWT token signed by a service account. The assertion
must include a ``target_audience`` claim.
Returns:

This comment was marked as spam.

This comment was marked as spam.

token_uri (str): The OAuth 2.0 authorizations server's token endpoint
URI.
assertion (str): JWT token signed by a service account. The assertion
must include a ``target_audience`` claim.

This comment was marked as spam.

This comment was marked as spam.

Tuple[str, Optional[datetime], Mapping[str, str]]:
The (encoded) Open ID Connect ID Token, expiration, and additional
data returned by the endpoint.
Raises:

This comment was marked as spam.

This comment was marked as spam.

self._token_uri = token_uri
self._target_audience = target_audience

if additional_claims is not None:

This comment was marked as spam.

This comment was marked as spam.

delegated_credentials = credentials.with_subject(subject)

"""
def __init__(self, signer, service_account_email, token_uri,

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

google.auth.service_account.IDTokenCredentials: A new credentials
instance.
"""
return IDTokenCredentials(

This comment was marked as spam.

This comment was marked as spam.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants