Module: Google::Auth::Extras
- Extended by:
- Extras
- Included in:
- Extras
- Defined in:
- lib/google/auth/extras.rb,
lib/google/auth/extras/version.rb,
lib/google/auth/extras/token_info.rb,
lib/google/auth/extras/static_credential.rb,
lib/google/auth/extras/impersonated_credential.rb,
lib/google/auth/extras/identity_credential_refresh_patch.rb
Overview
This module provides some extra features not supported in the normal googleauth gem.
Defined Under Namespace
Modules: IdentityCredentialRefreshPatch, TokenInfo Classes: ImpersonatedCredential, RefreshNotSupported, StaticCredential
Constant Summary collapse
- VERSION =
'0.4.0'
Instance Method Summary collapse
-
#impersonated_authorization(email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil) ⇒ Google::Auth::Extras::ImpersonatedCredential
A credential that impersonates a service account.
-
#impersonated_credential(email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil) ⇒ Google::Auth::Credential<Google::Auth::Extras::ImpersonatedCredential>
A credential that impersonates a service account.
-
#static_authorization(token, quota_project_id: nil) ⇒ Google::Auth::Extras::StaticCredential
A credential using a static access token.
-
#static_credential(token, quota_project_id: nil) ⇒ Google::Auth::Credential<Google::Auth::Extras::StaticCredential>
A credential using a static access token.
-
#wrap_authorization(client) ⇒ Google::Auth::Credential
Take an authorization and turn it into a credential, primarily used for setting up both the old and new style SDKs.
Instance Method Details
#impersonated_authorization(email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil) ⇒ Google::Auth::Extras::ImpersonatedCredential
A credential that impersonates a service account. For usage with the older style GCP Ruby SDKs from the google-apis-* gems.
The ‘email_address` of the service account to impersonate may be the exact same as the one represented in `base_credentials` for any desired situation but a handy usage is for going from and access token to an ID token (aka using `target_audience`).
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/google/auth/extras.rb', line 68 def ( email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil ) ImpersonatedCredential.new( base_credentials: base_credentials, delegate_email_addresses: delegate_email_addresses, email_address: email_address, include_email: include_email, lifetime: lifetime, quota_project_id: quota_project_id, scope: scope, target_audience: target_audience, ) end |
#impersonated_credential(email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil) ⇒ Google::Auth::Credential<Google::Auth::Extras::ImpersonatedCredential>
A credential that impersonates a service account. For usage with the newer style GCP Ruby SDKs from the google-cloud-* gems.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/google/auth/extras.rb', line 130 def impersonated_credential( email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil ) ( ( base_credentials: base_credentials, delegate_email_addresses: delegate_email_addresses, email_address: email_address, include_email: include_email, lifetime: lifetime, quota_project_id: quota_project_id, scope: scope, target_audience: target_audience, ), ) end |
#static_authorization(token, quota_project_id: nil) ⇒ Google::Auth::Extras::StaticCredential
A credential using a static access token. For usage with the older style GCP Ruby SDKs from the google-apis-* gems.
167 168 169 |
# File 'lib/google/auth/extras.rb', line 167 def (token, quota_project_id: nil) StaticCredential.new(access_token: token, quota_project_id: quota_project_id) end |
#static_credential(token, quota_project_id: nil) ⇒ Google::Auth::Credential<Google::Auth::Extras::StaticCredential>
A credential using a static access token. For usage with the newer style GCP Ruby SDKs from the google-cloud-* gems.
183 184 185 |
# File 'lib/google/auth/extras.rb', line 183 def static_credential(token, quota_project_id: nil) ((token, quota_project_id: quota_project_id)) end |