-
Notifications
You must be signed in to change notification settings - Fork 305
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
Add ID token verification helpers. #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Don't you want to return a boolean instead of the actual certs?
'/securetoken@system.gserviceaccount.com') | ||
|
||
|
||
def _fetch_certs(request, certs_url): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
raise exceptions.TransportError( | ||
'Could not fetch certificates at {}'.format(certs_url)) | ||
|
||
return json.loads(response.data.decode('utf-8')) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
id_token (Union[str, bytes]): The encoded token. | ||
request (google.auth.transport.Request): The object used to make | ||
HTTP requests. | ||
audience (str): The audience that this token is intended for. If None |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
HTTP requests. | ||
audience (str): The audience that this token is intended for. If None | ||
then the audience is not verified. | ||
certs_url (str): The URL that specifies the certificates to use to |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
id_token (Union[str, bytes]): The encoded token. | ||
request (google.auth.transport.Request): The object used to make | ||
HTTP requests. | ||
audience (str): The audience that this token is intended for. This is |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Mapping[str, Any]: The decoded token. | ||
|
||
Raises: | ||
ValueError: if verification fails. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Mapping[str, Any]: The decoded token. | ||
|
||
Raises: | ||
ValueError: if verification fails. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
certs_url=_GOOGLE_OAUTH2_CERTS_URL) | ||
|
||
|
||
def verify_firebase_token(id_token, request, audience=None): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
response = mock.Mock() | ||
response.status = status | ||
|
||
if data is not None: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Resolves #39 and the v1.0.0 milestone.