-
Notifications
You must be signed in to change notification settings - Fork 303
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
Conversation
I am unsure if I should leave the |
I vote for public read-only. I'm holding off a review here until you tell me to look @jonparrott |
Sgtm, gonna let Nathaniel chime in first. On Tue, Oct 4, 2016, 3:08 PM Danny Hermes notifications@github.com wrote:
|
@nathanielmanistaatgoogle ping, this is now blocking. |
@jonparrott rebase? |
@dhermes doing it now. |
b00bfcc
to
84a8f6b
Compare
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
message (bytes): The message to sign. | ||
|
||
Returns: | ||
bytes: The messages cryptographic signature. |
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.
"""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.
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.
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.
|
||
|
||
@six.add_metaclass(abc.ABCMeta) | ||
class ScopedCredentials(object): |
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.
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.
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.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
"""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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
""" | ||
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.
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.
e27eca9
to
602be67
Compare
@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. |
@nathanielmanistaatgoogle this is the section you indicated you wanted to give input on. PTAL.