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/service_account_jwt_credential.rb
Overview
This module provides some extra features not supported in the normal googleauth gem.
Defined Under Namespace
Modules: TokenInfo Classes: ImpersonatedCredential, RefreshNotSupported, ServiceAccountJWTCredential, StaticCredential
Constant Summary collapse
- VERSION =
'0.6.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, universe_domain: 'googleapis.com') ⇒ 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, universe_domain: 'googleapis.com') ⇒ Google::Auth::Credential<Google::Auth::Extras::ImpersonatedCredential>
A credential that impersonates a service account.
-
#service_account_jwt_authorization(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil, universe_domain: 'googleapis.com') ⇒ Google::Auth::Extras::ServiceAccountJWTCredential
A credential that obtains a signed JWT from Google for a service account.
-
#service_account_jwt_credential(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil, universe_domain: 'googleapis.com') ⇒ Google::Auth::Extras::ServiceAccountJWTCredential
A credential that obtains a signed JWT from Google for a service account.
-
#static_authorization(token, quota_project_id: nil, universe_domain: 'googleapis.com') ⇒ Google::Auth::Extras::StaticCredential
A credential using a static access token.
-
#static_credential(token, quota_project_id: nil, universe_domain: 'googleapis.com') ⇒ 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, universe_domain: 'googleapis.com') ⇒ 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).
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/google/auth/extras.rb', line 72 def ( email_address:, base_credentials: nil, delegate_email_addresses: nil, include_email: nil, lifetime: nil, quota_project_id: nil, scope: nil, target_audience: nil, universe_domain: 'googleapis.com' ) 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, universe_domain: universe_domain, ) 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, universe_domain: 'googleapis.com') ⇒ 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.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/google/auth/extras.rb', line 140 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, universe_domain: 'googleapis.com' ) ( ( 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, universe_domain: universe_domain, ), ) end |
#service_account_jwt_authorization(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil, universe_domain: 'googleapis.com') ⇒ Google::Auth::Extras::ServiceAccountJWTCredential
A credential that obtains a signed JWT from Google for a service account. For usage with the older style GCP Ruby SDKs from the google-apis-* gems. Also useful for calling IAP-protected endpoints using the Google-managed OAuth client.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'lib/google/auth/extras.rb', line 205 def ( email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil, universe_domain: 'googleapis.com' ) ServiceAccountJWTCredential.new( base_credentials: base_credentials, delegate_email_addresses: delegate_email_addresses, email_address: email_address, issuer: issuer, lifetime: lifetime, subject: subject, target_audience: target_audience, universe_domain: universe_domain, ) end |
#service_account_jwt_credential(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil, universe_domain: 'googleapis.com') ⇒ Google::Auth::Extras::ServiceAccountJWTCredential
A credential that obtains a signed JWT from Google for a service account. For usage with the newer style GCP Ruby SDKs from the google-cloud-* gems.
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/google/auth/extras.rb', line 264 def service_account_jwt_credential( email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil, universe_domain: 'googleapis.com' ) ( ( base_credentials: base_credentials, delegate_email_addresses: delegate_email_addresses, email_address: email_address, issuer: issuer, lifetime: lifetime, subject: subject, target_audience: target_audience, universe_domain: universe_domain, ), ) end |
#static_authorization(token, quota_project_id: nil, universe_domain: 'googleapis.com') ⇒ 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.
304 305 306 |
# File 'lib/google/auth/extras.rb', line 304 def (token, quota_project_id: nil, universe_domain: 'googleapis.com') StaticCredential.new(access_token: token, quota_project_id: quota_project_id, universe_domain: universe_domain) end |
#static_credential(token, quota_project_id: nil, universe_domain: 'googleapis.com') ⇒ 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.
324 325 326 327 328 |
# File 'lib/google/auth/extras.rb', line 324 def static_credential(token, quota_project_id: nil, universe_domain: 'googleapis.com') ( (token, quota_project_id: quota_project_id, universe_domain: universe_domain), ) end |