Class Google::Auth::ServiceAccountJwtHeaderCredentials
In: lib/googleauth/service_account.rb
Parent: Object

Authenticates requests using Google‘s Service Account credentials via JWT Header.

This class allows authorizing requests for service accounts directly from credentials from a json key file downloaded from the developer console (via ‘Generate new Json Key’). It is not part of any OAuth2 flow, rather it creates a JWT and sends that as a credential.

cf [Application Default Credentials](goo.gl/mkAHpZ)

Methods

Constants

JWT_AUD_URI_KEY = :jwt_aud_uri
AUTH_METADATA_KEY = Signet::OAuth2::AUTH_METADATA_KEY
TOKEN_CRED_URI = "https://www.googleapis.com/oauth2/v4/token".freeze
SIGNING_ALGORITHM = "RS256".freeze
EXPIRY = 60

Attributes

project_id  [R] 

Public Class methods

make_creds proxies the construction of a credentials instance

make_creds is used by the methods in CredentialsLoader.

By default, it calls new with 2 args, the second one being an optional scope. Here‘s the constructor only has one param, so we modify make_creds to reflect this.

Initializes a ServiceAccountJwtHeaderCredentials.

@param json_key_io [IO] an IO from which the JSON key can be read

Public Instance methods

Returns a clone of a_hash updated with the authoriation header

Construct a jwt token if the JWT_AUD_URI key is present in the input hash.

The jwt token is used as the value of a ‘Bearer ’.

Returns a reference to the apply method, suitable for passing as a closure

Protected Instance methods

[Validate]