googleauth-extras 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +8 -8
- data/googleauth-extras.gemspec +6 -6
- data/lib/google/auth/extras/impersonated_credential.rb +11 -0
- data/lib/google/auth/extras/service_account_jwt_credential.rb +110 -0
- data/lib/google/auth/extras/static_credential.rb +14 -2
- data/lib/google/auth/extras/version.rb +1 -1
- data/lib/google/auth/extras.rb +136 -4
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ef5e7a09636bad627874135bfa0c1f020eace2016a31aaf8952a70b01465593
|
4
|
+
data.tar.gz: 77d1fd18df712dbf3dd6620c4d3e2dfdcd0ced4872e6ebea6f05340cc8bf28f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dbab8990a50ddcea8df7e25aa651c294005bf9827c2b3729d77dc07df601384ece65af0acec8eeda7337a9c0fc358f8b9540e3fdde074cd718a496994bd26b9
|
7
|
+
data.tar.gz: 0e7aed934ce2b0e42f7e96e48ceca7866c81216e67a97b3e59f4027c298040c603e2c3a01e601914e8b33a97fb7c7457d52b70412a66f0bb2446b8a390cb8607
|
data/.github/workflows/ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
0.5.0
|
4
|
+
----------
|
5
|
+
|
6
|
+
- Support signed JWT credentials. ([#14](https://github.com/persona-id/googleauth-extras/pull/14))
|
7
|
+
|
8
|
+
- Drop support for Ruby 2.7 & 3.0, update test dependencies. ([#15](https://github.com/persona-id/googleauth-extras/pull/15))
|
9
|
+
|
10
|
+
0.4.0
|
11
|
+
----------
|
12
|
+
|
13
|
+
- Support setting a quota project. ([#11](https://github.com/persona-id/googleauth-extras/pull/11))
|
14
|
+
|
15
|
+
- Update gemspec for new RuboCop settings. ([#12](https://github.com/persona-id/googleauth-extras/pull/12))
|
16
|
+
|
3
17
|
0.3.0
|
4
18
|
-----
|
5
19
|
|
data/Gemfile
CHANGED
@@ -5,12 +5,12 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in googleauth-extras.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'google-cloud-storage', '~> 1.
|
8
|
+
gem 'google-cloud-storage', '~> 1.55'
|
9
9
|
|
10
|
-
gem 'pry-byebug', '~> 3.
|
11
|
-
gem 'rake', '~>
|
12
|
-
gem 'rspec', '~> 3.
|
13
|
-
gem 'rubocop', '~> 1.
|
14
|
-
gem 'rubocop-rspec', '~>
|
15
|
-
gem 'timecop', '~> 0.9.
|
16
|
-
gem 'webmock', '~> 3.
|
10
|
+
gem 'pry-byebug', '~> 3.11'
|
11
|
+
gem 'rake', '~> 13.2'
|
12
|
+
gem 'rspec', '~> 3.13'
|
13
|
+
gem 'rubocop', '~> 1.75'
|
14
|
+
gem 'rubocop-rspec', '~> 3.5'
|
15
|
+
gem 'timecop', '~> 0.9.10'
|
16
|
+
gem 'webmock', '~> 3.25'
|
data/googleauth-extras.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.homepage = 'https://github.com/persona-id/googleauth-extras'
|
13
13
|
spec.license = 'MIT'
|
14
14
|
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
|
16
16
|
|
17
17
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
18
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
|
-
spec.
|
34
|
-
spec.
|
35
|
-
spec.
|
36
|
-
spec.
|
37
|
-
spec.
|
33
|
+
spec.add_dependency 'addressable', '~> 2.8'
|
34
|
+
spec.add_dependency 'faraday', '>= 1.0', '< 3.0'
|
35
|
+
spec.add_dependency 'google-apis-iamcredentials_v1'
|
36
|
+
spec.add_dependency 'googleauth', '~> 1.3'
|
37
|
+
spec.add_dependency 'signet', '>= 0.17.0', '< 0.19.0'
|
38
38
|
end
|
@@ -7,6 +7,8 @@ module Google
|
|
7
7
|
class ImpersonatedCredential < Signet::OAuth2::Client
|
8
8
|
include IdentityCredentialRefreshPatch
|
9
9
|
|
10
|
+
attr_reader :quota_project_id
|
11
|
+
|
10
12
|
# A credential that impersonates a service account.
|
11
13
|
#
|
12
14
|
# The `email_address` of the service account to impersonate may be the exact
|
@@ -36,6 +38,10 @@ module Google
|
|
36
38
|
# additional API call.
|
37
39
|
# Only supported when not using a target_audience.
|
38
40
|
#
|
41
|
+
# @param quota_project_id [String]
|
42
|
+
# The project ID used for quota and billing. This project may be different from
|
43
|
+
# the project used to create the credentials.
|
44
|
+
#
|
39
45
|
# @param scope [String, Array<String>]
|
40
46
|
# The OAuth 2 scopes to request. Can either be formatted as a comma seperated string or array.
|
41
47
|
# Only supported when not using a target_audience.
|
@@ -54,6 +60,7 @@ module Google
|
|
54
60
|
delegate_email_addresses: nil,
|
55
61
|
include_email: nil,
|
56
62
|
lifetime: nil,
|
63
|
+
quota_project_id: nil,
|
57
64
|
scope: nil,
|
58
65
|
target_audience: nil
|
59
66
|
)
|
@@ -90,6 +97,8 @@ module Google
|
|
90
97
|
end
|
91
98
|
|
92
99
|
@impersonate_name = transform_email_to_name(email_address)
|
100
|
+
|
101
|
+
@quota_project_id = quota_project_id
|
93
102
|
end
|
94
103
|
|
95
104
|
def fetch_access_token(*)
|
@@ -135,6 +144,7 @@ module Google
|
|
135
144
|
" @impersonate_delegates=#{@impersonate_delegates.inspect}" \
|
136
145
|
" @impersonate_include_email=#{@impersonate_include_email.inspect}" \
|
137
146
|
" @impersonate_name=#{@impersonate_name.inspect}" \
|
147
|
+
" @quota_project_id=#{@quota_project_id.inspect}" \
|
138
148
|
" @target_audience=#{@target_audience.inspect}" \
|
139
149
|
'>'
|
140
150
|
else
|
@@ -144,6 +154,7 @@ module Google
|
|
144
154
|
" @impersonate_delegates=#{@impersonate_delegates.inspect}" \
|
145
155
|
" @impersonate_lifetime=#{@impersonate_lifetime.inspect}" \
|
146
156
|
" @impersonate_name=#{@impersonate_name.inspect}" \
|
157
|
+
" @quota_project_id=#{@quota_project_id.inspect}" \
|
147
158
|
'>'
|
148
159
|
end
|
149
160
|
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Google
|
4
|
+
module Auth
|
5
|
+
module Extras
|
6
|
+
# This credential issues JWTs signed a service account.
|
7
|
+
class ServiceAccountJWTCredential < Signet::OAuth2::Client
|
8
|
+
include IdentityCredentialRefreshPatch
|
9
|
+
|
10
|
+
# A credential that obtains a signed JWT from Google for a service account.
|
11
|
+
#
|
12
|
+
# @param base_credentials [Hash, String, Signet::OAuth2::Client]
|
13
|
+
# Credentials to use to sign the JWTs.
|
14
|
+
#
|
15
|
+
# @param delegate_email_addresses [String, Array<String>]
|
16
|
+
# The email addresses (if any) of intermediate service accounts to reach
|
17
|
+
# the +email_address+ from +base_credentials+.
|
18
|
+
#
|
19
|
+
# @param email_address [String]
|
20
|
+
# Email of the service account to sign the JWT.
|
21
|
+
#
|
22
|
+
# @param issuer [String]
|
23
|
+
# The desired value of the iss field on the issued JWT. Defaults to the email_address.
|
24
|
+
#
|
25
|
+
# @param lifetime [Integers]
|
26
|
+
# The desired lifetime (in seconds) of the JWT before needing to be refreshed.
|
27
|
+
# Defaults to 3600 (1h), adjust as needed given a refresh is automatically
|
28
|
+
# performed when the token less than 60s of remaining life and refresh requires
|
29
|
+
# an additional API call.
|
30
|
+
#
|
31
|
+
# @param subject [String]
|
32
|
+
# The desired value of the sub field on the issued JWT. Defaults to the email_address.
|
33
|
+
#
|
34
|
+
# @param target_audience [String]
|
35
|
+
# The audience for the token, such as the API or account that this token grants access to.
|
36
|
+
#
|
37
|
+
# @see https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt
|
38
|
+
# @see https://cloud.google.com/iam/docs/create-short-lived-credentials-delegated#sa-credentials-permissions
|
39
|
+
#
|
40
|
+
def initialize(
|
41
|
+
email_address:,
|
42
|
+
target_audience:,
|
43
|
+
base_credentials: nil,
|
44
|
+
delegate_email_addresses: nil,
|
45
|
+
issuer: nil,
|
46
|
+
lifetime: 3600,
|
47
|
+
subject: nil
|
48
|
+
)
|
49
|
+
super(client_id: target_audience, target_audience: target_audience)
|
50
|
+
|
51
|
+
@iam_credentials_service = Google::Apis::IamcredentialsV1::IAMCredentialsService.new.tap do |ics|
|
52
|
+
ics.authorization = base_credentials if base_credentials
|
53
|
+
end
|
54
|
+
|
55
|
+
@jwt_issuer = issuer || email_address
|
56
|
+
@jwt_lifetime = lifetime
|
57
|
+
@jwt_subject = subject || email_address
|
58
|
+
|
59
|
+
@sa_delegates = Array(delegate_email_addresses).map do |email|
|
60
|
+
transform_email_to_name(email)
|
61
|
+
end
|
62
|
+
|
63
|
+
@sa_name = transform_email_to_name(email_address)
|
64
|
+
end
|
65
|
+
|
66
|
+
def fetch_access_token(*)
|
67
|
+
now = Time.now.to_i
|
68
|
+
|
69
|
+
request = Google::Apis::IamcredentialsV1::SignJwtRequest.new(
|
70
|
+
payload: JSON.dump(
|
71
|
+
aud: target_audience,
|
72
|
+
exp: now + @jwt_lifetime,
|
73
|
+
iat: now,
|
74
|
+
iss: @jwt_issuer,
|
75
|
+
sub: @jwt_subject,
|
76
|
+
),
|
77
|
+
)
|
78
|
+
|
79
|
+
# The Google SDK doesn't like nil repeated values, but be careful with others as well.
|
80
|
+
request.delegates = @sa_delegates unless @sa_delegates.empty?
|
81
|
+
|
82
|
+
response = @iam_credentials_service.sign_service_account_jwt(@sa_name, request)
|
83
|
+
|
84
|
+
{
|
85
|
+
id_token: response.signed_jwt,
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
def inspect
|
90
|
+
"#<#{self.class.name}" \
|
91
|
+
" @expires_at=#{expires_at.inspect}" \
|
92
|
+
" @id_token=#{@id_token ? '[REDACTED]' : 'nil'}" \
|
93
|
+
" @jwt_issuer=#{@jwt_issuer.inspect}" \
|
94
|
+
" @jwt_lifetime=#{@jwt_lifetime.inspect}" \
|
95
|
+
" @jwt_subject=#{@jwt_subject.inspect}" \
|
96
|
+
" @sa_delegates=#{@sa_delegates.inspect}" \
|
97
|
+
" @sa_name=#{@sa_name.inspect}" \
|
98
|
+
" @target_audience=#{@target_audience.inspect}" \
|
99
|
+
'>'
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def transform_email_to_name(email)
|
105
|
+
"projects/-/serviceAccounts/#{email}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -7,17 +7,25 @@ module Google
|
|
7
7
|
class StaticCredential < Signet::OAuth2::Client
|
8
8
|
class AuthorizationExpired < StandardError; end
|
9
9
|
|
10
|
+
attr_reader :quota_project_id
|
11
|
+
|
10
12
|
# A credential using a static access token.
|
11
13
|
#
|
12
14
|
# @param access_token [String]
|
13
15
|
# The access token to use.
|
14
16
|
#
|
15
|
-
|
17
|
+
# @param quota_project_id [String]
|
18
|
+
# The project ID used for quota and billing. This project may be different from
|
19
|
+
# the project used to create the credentials.
|
20
|
+
#
|
21
|
+
def initialize(access_token:, quota_project_id: nil)
|
16
22
|
super(
|
17
23
|
access_token: access_token,
|
18
24
|
expires_at: TokenInfo.lookup_access_token(access_token).fetch('exp'),
|
19
25
|
issued_at: nil,
|
20
26
|
)
|
27
|
+
|
28
|
+
@quota_project_id = quota_project_id
|
21
29
|
end
|
22
30
|
|
23
31
|
def fetch_access_token(*)
|
@@ -28,7 +36,11 @@ module Google
|
|
28
36
|
end
|
29
37
|
|
30
38
|
def inspect
|
31
|
-
"#<#{self.class.name}
|
39
|
+
"#<#{self.class.name}" \
|
40
|
+
' @access_token=[REDACTED]' \
|
41
|
+
" @expires_at=#{expires_at.inspect}" \
|
42
|
+
" @quota_project_id=#{@quota_project_id.inspect}" \
|
43
|
+
'>'
|
32
44
|
end
|
33
45
|
end
|
34
46
|
end
|
data/lib/google/auth/extras.rb
CHANGED
@@ -6,6 +6,7 @@ require 'signet/oauth_2/client'
|
|
6
6
|
|
7
7
|
require 'google/auth/extras/identity_credential_refresh_patch'
|
8
8
|
require 'google/auth/extras/impersonated_credential'
|
9
|
+
require 'google/auth/extras/service_account_jwt_credential'
|
9
10
|
require 'google/auth/extras/static_credential'
|
10
11
|
require 'google/auth/extras/token_info'
|
11
12
|
require 'google/auth/extras/version'
|
@@ -50,6 +51,10 @@ module Google
|
|
50
51
|
# additional API call.
|
51
52
|
# Only supported when not using a target_audience.
|
52
53
|
#
|
54
|
+
# @param quota_project_id [String]
|
55
|
+
# The project ID used for quota and billing. This project may be different from
|
56
|
+
# the project used to create the credentials.
|
57
|
+
#
|
53
58
|
# @param scope [String, Array<String>]
|
54
59
|
# The OAuth 2 scopes to request. Can either be formatted as a comma seperated string or array.
|
55
60
|
# Only supported when not using a target_audience.
|
@@ -67,6 +72,7 @@ module Google
|
|
67
72
|
delegate_email_addresses: nil,
|
68
73
|
include_email: nil,
|
69
74
|
lifetime: nil,
|
75
|
+
quota_project_id: nil,
|
70
76
|
scope: nil,
|
71
77
|
target_audience: nil
|
72
78
|
)
|
@@ -76,6 +82,7 @@ module Google
|
|
76
82
|
email_address: email_address,
|
77
83
|
include_email: include_email,
|
78
84
|
lifetime: lifetime,
|
85
|
+
quota_project_id: quota_project_id,
|
79
86
|
scope: scope,
|
80
87
|
target_audience: target_audience,
|
81
88
|
)
|
@@ -106,6 +113,10 @@ module Google
|
|
106
113
|
# additional API call.
|
107
114
|
# Only supported when not using a target_audience.
|
108
115
|
#
|
116
|
+
# @param quota_project_id [String]
|
117
|
+
# The project ID used for quota and billing. This project may be different from
|
118
|
+
# the project used to create the credentials.
|
119
|
+
#
|
109
120
|
# @param scope [String, Array<String>]
|
110
121
|
# The OAuth 2 scopes to request. Can either be formatted as a comma seperated string or array.
|
111
122
|
# Only supported when not using a target_audience.
|
@@ -123,6 +134,7 @@ module Google
|
|
123
134
|
delegate_email_addresses: nil,
|
124
135
|
include_email: nil,
|
125
136
|
lifetime: nil,
|
137
|
+
quota_project_id: nil,
|
126
138
|
scope: nil,
|
127
139
|
target_audience: nil
|
128
140
|
)
|
@@ -133,22 +145,138 @@ module Google
|
|
133
145
|
email_address: email_address,
|
134
146
|
include_email: include_email,
|
135
147
|
lifetime: lifetime,
|
148
|
+
quota_project_id: quota_project_id,
|
136
149
|
scope: scope,
|
137
150
|
target_audience: target_audience,
|
138
151
|
),
|
139
152
|
)
|
140
153
|
end
|
141
154
|
|
155
|
+
# A credential that obtains a signed JWT from Google for a service account.
|
156
|
+
# For usage with the older style GCP Ruby SDKs from the google-apis-* gems.
|
157
|
+
# Also useful for calling IAP-protected endpoints using the Google-managed
|
158
|
+
# OAuth client.
|
159
|
+
#
|
160
|
+
# @param base_credentials [Hash, String, Signet::OAuth2::Client]
|
161
|
+
# Credentials to use to sign the JWTs.
|
162
|
+
#
|
163
|
+
# @param delegate_email_addresses [String, Array<String>]
|
164
|
+
# The email addresses (if any) of intermediate service accounts to reach
|
165
|
+
# the +email_address+ from +base_credentials+.
|
166
|
+
#
|
167
|
+
# @param email_address [String]
|
168
|
+
# Email of the service account to sign the JWT.
|
169
|
+
#
|
170
|
+
# @param issuer [String]
|
171
|
+
# The desired value of the iss field on the issued JWT. Defaults to the email_address.
|
172
|
+
#
|
173
|
+
# @param lifetime [Integers]
|
174
|
+
# The desired lifetime (in seconds) of the JWT before needing to be refreshed.
|
175
|
+
# Defaults to 3600 (1h), adjust as needed given a refresh is automatically
|
176
|
+
# performed when the token less than 60s of remaining life and refresh requires
|
177
|
+
# an additional API call.
|
178
|
+
#
|
179
|
+
# @param subject [String]
|
180
|
+
# The desired value of the sub field on the issued JWT. Defaults to the email_address.
|
181
|
+
#
|
182
|
+
# @param target_audience [String]
|
183
|
+
# The audience for the token, such as the API or account that this token grants access to.
|
184
|
+
#
|
185
|
+
# @return [Google::Auth::Extras::ServiceAccountJWTCredential]
|
186
|
+
#
|
187
|
+
# @see https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt
|
188
|
+
# @see https://cloud.google.com/iam/docs/create-short-lived-credentials-delegated#sa-credentials-permissions
|
189
|
+
#
|
190
|
+
def service_account_jwt_authorization(
|
191
|
+
email_address:,
|
192
|
+
target_audience:,
|
193
|
+
base_credentials: nil,
|
194
|
+
delegate_email_addresses: nil,
|
195
|
+
issuer: nil,
|
196
|
+
lifetime: 3600,
|
197
|
+
subject: nil
|
198
|
+
)
|
199
|
+
ServiceAccountJWTCredential.new(
|
200
|
+
base_credentials: base_credentials,
|
201
|
+
delegate_email_addresses: delegate_email_addresses,
|
202
|
+
email_address: email_address,
|
203
|
+
issuer: issuer,
|
204
|
+
lifetime: lifetime,
|
205
|
+
subject: subject,
|
206
|
+
target_audience: target_audience,
|
207
|
+
)
|
208
|
+
end
|
209
|
+
|
210
|
+
# A credential that obtains a signed JWT from Google for a service account.
|
211
|
+
# For usage with the newer style GCP Ruby SDKs from the google-cloud-* gems.
|
212
|
+
#
|
213
|
+
# @param base_credentials [Hash, String, Signet::OAuth2::Client]
|
214
|
+
# Credentials to use to sign the JWTs.
|
215
|
+
#
|
216
|
+
# @param delegate_email_addresses [String, Array<String>]
|
217
|
+
# The email addresses (if any) of intermediate service accounts to reach
|
218
|
+
# the +email_address+ from +base_credentials+.
|
219
|
+
#
|
220
|
+
# @param email_address [String]
|
221
|
+
# Email of the service account to sign the JWT.
|
222
|
+
#
|
223
|
+
# @param issuer [String]
|
224
|
+
# The desired value of the iss field on the issued JWT. Defaults to the email_address.
|
225
|
+
#
|
226
|
+
# @param lifetime [Integers]
|
227
|
+
# The desired lifetime (in seconds) of the JWT before needing to be refreshed.
|
228
|
+
# Defaults to 3600 (1h), adjust as needed given a refresh is automatically
|
229
|
+
# performed when the token less than 60s of remaining life and refresh requires
|
230
|
+
# an additional API call.
|
231
|
+
#
|
232
|
+
# @param subject [String]
|
233
|
+
# The desired value of the sub field on the issued JWT. Defaults to the email_address.
|
234
|
+
#
|
235
|
+
# @param target_audience [String]
|
236
|
+
# The audience for the token, such as the API or account that this token grants access to.
|
237
|
+
#
|
238
|
+
# @return [Google::Auth::Extras::ServiceAccountJWTCredential]
|
239
|
+
#
|
240
|
+
# @see https://cloud.google.com/iam/docs/reference/credentials/rest/v1/projects.serviceAccounts/signJwt
|
241
|
+
# @see https://cloud.google.com/iam/docs/create-short-lived-credentials-delegated#sa-credentials-permissions
|
242
|
+
#
|
243
|
+
def service_account_jwt_credential(
|
244
|
+
email_address:,
|
245
|
+
target_audience:,
|
246
|
+
base_credentials: nil,
|
247
|
+
delegate_email_addresses: nil,
|
248
|
+
issuer: nil,
|
249
|
+
lifetime: 3600,
|
250
|
+
subject: nil
|
251
|
+
)
|
252
|
+
wrap_authorization(
|
253
|
+
service_account_jwt_authorization(
|
254
|
+
base_credentials: base_credentials,
|
255
|
+
delegate_email_addresses: delegate_email_addresses,
|
256
|
+
email_address: email_address,
|
257
|
+
issuer: issuer,
|
258
|
+
lifetime: lifetime,
|
259
|
+
subject: subject,
|
260
|
+
target_audience: target_audience,
|
261
|
+
),
|
262
|
+
)
|
263
|
+
end
|
264
|
+
|
142
265
|
# A credential using a static access token. For usage with the older
|
143
266
|
# style GCP Ruby SDKs from the google-apis-* gems.
|
144
267
|
#
|
145
268
|
# @param token [String]
|
146
269
|
# The access token to use.
|
147
270
|
#
|
271
|
+
# @param quota_project_id [String]
|
272
|
+
# The project ID used for quota and billing. This project may be different from
|
273
|
+
# the project used to create the credentials.
|
274
|
+
#
|
275
|
+
#
|
148
276
|
# @return [Google::Auth::Extras::StaticCredential]
|
149
277
|
#
|
150
|
-
def static_authorization(token)
|
151
|
-
StaticCredential.new(access_token: token)
|
278
|
+
def static_authorization(token, quota_project_id: nil)
|
279
|
+
StaticCredential.new(access_token: token, quota_project_id: quota_project_id)
|
152
280
|
end
|
153
281
|
|
154
282
|
# A credential using a static access token. For usage with the newer
|
@@ -157,10 +285,14 @@ module Google
|
|
157
285
|
# @param token [String]
|
158
286
|
# The access token to use.
|
159
287
|
#
|
288
|
+
# @param quota_project_id [String]
|
289
|
+
# The project ID used for quota and billing. This project may be different from
|
290
|
+
# the project used to create the credentials.
|
291
|
+
#
|
160
292
|
# @return [Google::Auth::Credential<Google::Auth::Extras::StaticCredential>]
|
161
293
|
#
|
162
|
-
def static_credential(token)
|
163
|
-
wrap_authorization(static_authorization(token))
|
294
|
+
def static_credential(token, quota_project_id: nil)
|
295
|
+
wrap_authorization(static_authorization(token, quota_project_id: quota_project_id))
|
164
296
|
end
|
165
297
|
|
166
298
|
# Take an authorization and turn it into a credential, primarily used
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googleauth-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Persona Identities
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
- - "<"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 0.19.0
|
95
|
-
description:
|
95
|
+
description:
|
96
96
|
email:
|
97
97
|
- alex.coomans@withpersona.com
|
98
98
|
executables: []
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/google/auth/extras.rb
|
116
116
|
- lib/google/auth/extras/identity_credential_refresh_patch.rb
|
117
117
|
- lib/google/auth/extras/impersonated_credential.rb
|
118
|
+
- lib/google/auth/extras/service_account_jwt_credential.rb
|
118
119
|
- lib/google/auth/extras/static_credential.rb
|
119
120
|
- lib/google/auth/extras/token_info.rb
|
120
121
|
- lib/google/auth/extras/version.rb
|
@@ -128,7 +129,7 @@ metadata:
|
|
128
129
|
homepage_uri: https://github.com/persona-id/googleauth-extras
|
129
130
|
source_code_uri: https://github.com/persona-id/googleauth-extras
|
130
131
|
changelog_uri: https://github.com/persona-id/googleauth-extras/blob/main/CHANGELOG.md
|
131
|
-
post_install_message:
|
132
|
+
post_install_message:
|
132
133
|
rdoc_options: []
|
133
134
|
require_paths:
|
134
135
|
- lib
|
@@ -136,15 +137,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
137
|
requirements:
|
137
138
|
- - ">="
|
138
139
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
140
|
+
version: 3.1.0
|
140
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
142
|
requirements:
|
142
143
|
- - ">="
|
143
144
|
- !ruby/object:Gem::Version
|
144
145
|
version: '0'
|
145
146
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
147
|
-
signing_key:
|
147
|
+
rubygems_version: 3.3.27
|
148
|
+
signing_key:
|
148
149
|
specification_version: 4
|
149
150
|
summary: Additions to the googleauth gem for unsupported authentication schemes.
|
150
151
|
test_files: []
|