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,
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, ServiceAccountJWTCredential, StaticCredential
Constant Summary collapse
- VERSION =
'0.5.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.
-
#service_account_jwt_authorization(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil) ⇒ 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) ⇒ Google::Auth::Extras::ServiceAccountJWTCredential
A credential that obtains a signed JWT from Google for 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`).
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/google/auth/extras.rb', line 69 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.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/google/auth/extras.rb', line 131 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 |
#service_account_jwt_authorization(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil) ⇒ 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.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/google/auth/extras.rb', line 190 def ( email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil ) 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, ) end |
#service_account_jwt_credential(email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil) ⇒ 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.
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/google/auth/extras.rb', line 243 def service_account_jwt_credential( email_address:, target_audience:, base_credentials: nil, delegate_email_addresses: nil, issuer: nil, lifetime: 3600, subject: nil ) ( ( base_credentials: base_credentials, delegate_email_addresses: delegate_email_addresses, email_address: email_address, issuer: issuer, lifetime: lifetime, subject: subject, 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.
278 279 280 |
# File 'lib/google/auth/extras.rb', line 278 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.
294 295 296 |
# File 'lib/google/auth/extras.rb', line 294 def static_credential(token, quota_project_id: nil) ((token, quota_project_id: quota_project_id)) end |