• Home
  • Raw
  • Download

Lines Matching full:credentials

16 """Interfaces for credentials."""
23 from google.auth import credentials
27 class Credentials(credentials.Credentials): class
28 """Async inherited credentials class from google.auth.credentials.
31 All credentials have a :attr:`token` that is used for authentication and
35 Most credentials will be :attr:`invalid` until :meth:`refresh` is called.
36 Credentials can do this automatically before the first HTTP request in
39 Although the token and expiration will change as the credentials are
40 :meth:`refreshed <refresh>` and used, credentials should be considered
41 immutable. Various credentials will accept configuration such as private
43 construction. Some classes will provide mechanisms to copy the credentials
50 Refreshes the credentials if necessary, then calls :meth:`apply` to
73 class CredentialsWithQuotaProject(credentials.CredentialsWithQuotaProject):
74 """Abstract base for credentials supporting ``with_quota_project`` factory"""
77 class AnonymousCredentials(credentials.AnonymousCredentials, Credentials):
78 """Credentials that do not provide any authentication information.
81 local service emulators that do not use credentials. This class inherits
82 from the sync anonymous credentials file, but is kept if async credentials
83 is initialized and we would like anonymous credentials.
88 class ReadOnlyScoped(credentials.ReadOnlyScoped):
89 """Interface for credentials whose scopes can be queried.
91 OAuth 2.0-based credentials allow limiting access using scopes as described
93 If a credential class implements this interface then the credentials either
96 Some credentials require scopes in order to obtain a token. You can check
99 if credentials.requires_scopes:
101 credentials = _credentials_async.with_scopes(scopes=['one', 'two'])
103 Credentials that require scopes must either be constructed with scopes::
105 credentials = SomeScopedCredentials(scopes=['one', 'two'])
111 Some credentials have scopes but do not allow or require scopes to be set,
112 these credentials can be used as-is.
118 class Scoped(credentials.Scoped):
119 """Interface for credentials whose scopes can be replaced while copying.
121 OAuth 2.0-based credentials allow limiting access using scopes as described
123 If a credential class implements this interface then the credentials either
126 Some credentials require scopes in order to obtain a token. You can check
129 if credentials.requires_scopes:
131 credentials = _credentials_async.create_scoped(['one', 'two'])
133 Credentials that require scopes must either be constructed with scopes::
135 credentials = SomeScopedCredentials(scopes=['one', 'two'])
139 scoped_credentials = credentials.with_scopes(scopes=['one', 'two'])
141 Some credentials have scopes but do not allow or require scopes to be set,
142 these credentials can be used as-is.
148 def with_scopes_if_required(credentials, scopes): argument
149 """Creates a copy of the credentials with scopes if scoping is required.
152 specific type of credentials you are using (such as when you use
154 :meth:`Scoped.with_scopes` if the credentials are scoped credentials and if
155 the credentials require scoping. Otherwise, it will return the credentials
159 credentials (google.auth.credentials.Credentials): The credentials to
164 google.auth._credentials_async.Credentials: Either a new set of scoped
165 credentials, or the passed in credentials instance if no scoping
168 if isinstance(credentials, Scoped) and credentials.requires_scopes:
169 return credentials.with_scopes(scopes)
171 return credentials
175 class Signing(credentials.Signing):
176 """Interface for credentials that can cryptographically sign messages."""