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

Add google.auth.credentials - the public interfaces for credentials #8

Merged
merged 8 commits into from
Oct 14, 2016

Conversation

theacodes
Copy link
Contributor

@nathanielmanistaatgoogle this is the section you indicated you wanted to give input on. PTAL.

@theacodes theacodes added this to the 1.0.0 milestone Oct 4, 2016
@theacodes
Copy link
Contributor Author

I am unsure if I should leave the scopes property as is (completely private) or make it a public read-only property.

@dhermes
Copy link
Contributor

dhermes commented Oct 4, 2016

I vote for public read-only. I'm holding off a review here until you tell me to look @jonparrott

@theacodes
Copy link
Contributor Author

Sgtm, gonna let Nathaniel chime in first.

On Tue, Oct 4, 2016, 3:08 PM Danny Hermes notifications@github.com wrote:

I vote for public read-only. I'm holding off a review here until you tell
me to look @jonparrott https://github.com/jonparrott


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAPUc-0omIhmwrF0HlyVl8t7Mu8-MKApks5qws5igaJpZM4KOMdL
.

@theacodes
Copy link
Contributor Author

@nathanielmanistaatgoogle ping, this is now blocking.

@dhermes
Copy link
Contributor

dhermes commented Oct 10, 2016

@jonparrott rebase?

@theacodes
Copy link
Contributor Author

@dhermes doing it now.

@theacodes
Copy link
Contributor Author

Rebased.

with :attr:`expiry` set to None is considered to never expire.
"""
now = _helpers.utcnow()
if self.expiry is None or self.expiry > now:

This comment was marked as spam.

This comment was marked as spam.

token (Optional[str]): If specified, overrides the current access
token.
"""
headers[b'authorization'] = 'Bearer {}'.format(

This comment was marked as spam.

This comment was marked as spam.

This is True if the credentials have a :attr:`token` and the token
is not :attr:`expired`.
"""
return self.token is not None and not self.expired

This comment was marked as spam.

This comment was marked as spam.

def has_scopes(self, scopes):
"""Checks if the credentials have the given scopes.

.. warning: This method is not guarenteed to be accurate if the

This comment was marked as spam.

This comment was marked as spam.

message (bytes): The message to sign.

Returns:
bytes: The messages cryptographic signature.

This comment was marked as spam.

This comment was marked as spam.

"""Create a copy of these credentials with the specified scopes.

Args:
scopes (Union[str, Sequence]): The scope or list of scopes to

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.



@six.add_metaclass(abc.ABCMeta)
class ScopedCredentials(object):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

"""Refreshes the access token.

Args:
request (google.auth.transport.Request): A callable used to make

This comment was marked as spam.

This comment was marked as spam.

"""
def __init__(self):
self.token = None
"""str: The bearer token that can be used in HTTP headers to make

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

@nathanielmanistaatgoogle after discussing with @dhermes offline, I'm gonna go ahead and merge this so we can unblock reviewing some concrete classes.

We can still continue to discuss here and I'll send follow-up PRs to make changes. This is all fluid until 1.0. Unless there is a very significant change I don't anticipate the impact on concrete classes to be large.

@theacodes theacodes merged commit 71ce2a0 into master Oct 14, 2016
@theacodes theacodes deleted the credentials-abc branch October 14, 2016 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants