Method: Google::Auth::ServiceAccountJwtHeaderCredentials#initialize
- Defined in:
- lib/googleauth/service_account_jwt_header.rb
permalink #initialize(options = {}) ⇒ ServiceAccountJwtHeaderCredentials
Initializes a ServiceAccountJwtHeaderCredentials.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/googleauth/service_account_jwt_header.rb', line 60 def initialize = {} json_key_io = [:json_key_io] if json_key_io @private_key, @issuer, @project_id, @quota_project_id, @universe_domain = self.class.read_json_key json_key_io else @private_key = .key?(:private_key) ? [:private_key] : ENV[CredentialsLoader::PRIVATE_KEY_VAR] @issuer = .key?(:issuer) ? [:issuer] : ENV[CredentialsLoader::CLIENT_EMAIL_VAR] @project_id = .key?(:project_id) ? [:project_id] : ENV[CredentialsLoader::PROJECT_ID_VAR] @quota_project_id = [:quota_project_id] if .key? :quota_project_id @universe_domain = [:universe_domain] if .key? :universe_domain end @universe_domain ||= "googleapis.com" @project_id ||= CredentialsLoader.load_gcloud_project_id @signing_key = OpenSSL::PKey::RSA.new @private_key @scope = [:scope] if .key? :scope @logger = [:logger] if .key? :logger end |