googleauth 0.15.0 → 0.15.1
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/release.yml +4 -1
- data/CHANGELOG.md +7 -0
- data/lib/googleauth/credentials.rb +34 -16
- data/lib/googleauth/version.rb +1 -1
- data/spec/googleauth/credentials_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e35a1b1c577067dfb5e6199a557139c4bbac47e9ab88ec65711264ac45df05
|
4
|
+
data.tar.gz: 8192491002f8082665a22d894f8d65485df79da746d6ec5b3a0719a65026fcaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d0b9a2b9fcd2f2805167acb8f51814077ba41643237af1005155103e1a87854f0a2c348522a93f9b7d112bd5de9fe96d6d93e608a890e1db88ea69fa8cfa4fc
|
7
|
+
data.tar.gz: 19b5c3c31d48427040f03865cfb6298d94eb1bed6f57a5a62a3179db1ebdf3a036742cfc8ff2af156e9ff691b4baadc6201a8678bbe23cbbdf4e08153d54414c
|
@@ -1,15 +1,18 @@
|
|
1
1
|
on:
|
2
2
|
schedule:
|
3
|
-
- cron: '29 9 * *
|
3
|
+
- cron: '29 9 * * *'
|
4
4
|
workflow_dispatch:
|
5
5
|
|
6
6
|
name: release
|
7
7
|
jobs:
|
8
8
|
release-please:
|
9
|
+
env:
|
10
|
+
ENABLE_RELEASE_PLEASE: ${{ secrets.ENABLE_RELEASE_PLEASE }}
|
9
11
|
runs-on: ubuntu-latest
|
10
12
|
steps:
|
11
13
|
- name: ReleasePlease
|
12
14
|
id: release-please
|
15
|
+
if: ${{ env.ENABLE_RELEASE_PLEASE || github.event_name == 'workflow_dispatch' }}
|
13
16
|
uses: GoogleCloudPlatform/release-please-action@v2
|
14
17
|
with:
|
15
18
|
command: release-pr
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
## [0.15.1](https://www.github.com/googleapis/google-auth-library-ruby/compare/v0.15.0...v0.15.1) (2021-02-08)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* Fix crash when using a client credential without any paths or env_vars set ([#296](https://www.github.com/googleapis/google-auth-library-ruby/issues/296)) ([c971c1a](https://www.github.com/googleapis/google-auth-library-ruby/commit/c971c1ad2d7730c0f5b389d533a972be32fbaf49))
|
9
|
+
|
3
10
|
## [0.15.0](https://www.github.com/googleapis/google-auth-library-ruby/compare/v0.14.0...v0.15.0) (2021-01-26)
|
4
11
|
|
5
12
|
|
@@ -103,7 +103,6 @@ module Google
|
|
103
103
|
# Set the default token credential URI to be used when none is provided during initialization.
|
104
104
|
#
|
105
105
|
# @param [String] new_token_credential_uri
|
106
|
-
# @return [String]
|
107
106
|
#
|
108
107
|
def self.token_credential_uri= new_token_credential_uri
|
109
108
|
@token_credential_uri = new_token_credential_uri
|
@@ -125,7 +124,6 @@ module Google
|
|
125
124
|
# Sets the default target audience ID to be used when none is provided during initialization.
|
126
125
|
#
|
127
126
|
# @param [String] new_audience
|
128
|
-
# @return [String]
|
129
127
|
#
|
130
128
|
def self.audience= new_audience
|
131
129
|
@audience = new_audience
|
@@ -140,7 +138,7 @@ module Google
|
|
140
138
|
# If {#scope} is set, this credential will produce access tokens.
|
141
139
|
# If {#target_audience} is set, this credential will produce ID tokens.
|
142
140
|
#
|
143
|
-
# @return [String, Array<String
|
141
|
+
# @return [String, Array<String>, nil]
|
144
142
|
#
|
145
143
|
def self.scope
|
146
144
|
lookup_auth_param :scope do
|
@@ -156,8 +154,7 @@ module Google
|
|
156
154
|
# If {#scope} is set, this credential will produce access tokens.
|
157
155
|
# If {#target_audience} is set, this credential will produce ID tokens.
|
158
156
|
#
|
159
|
-
# @param [String, Array<String
|
160
|
-
# @return [String, Array<String>]
|
157
|
+
# @param [String, Array<String>, nil] new_scope
|
161
158
|
#
|
162
159
|
def self.scope= new_scope
|
163
160
|
new_scope = Array new_scope unless new_scope.nil?
|
@@ -172,7 +169,7 @@ module Google
|
|
172
169
|
# If {#scope} is set, this credential will produce access tokens.
|
173
170
|
# If {#target_audience} is set, this credential will produce ID tokens.
|
174
171
|
#
|
175
|
-
# @return [String]
|
172
|
+
# @return [String, nil]
|
176
173
|
#
|
177
174
|
def self.target_audience
|
178
175
|
lookup_auth_param :target_audience
|
@@ -186,7 +183,7 @@ module Google
|
|
186
183
|
# If {#scope} is set, this credential will produce access tokens.
|
187
184
|
# If {#target_audience} is set, this credential will produce ID tokens.
|
188
185
|
#
|
189
|
-
# @param [String] new_target_audience
|
186
|
+
# @param [String, nil] new_target_audience
|
190
187
|
#
|
191
188
|
def self.target_audience= new_target_audience
|
192
189
|
@target_audience = new_target_audience
|
@@ -195,11 +192,20 @@ module Google
|
|
195
192
|
##
|
196
193
|
# The environment variables to search for credentials. Values can either be a file path to the
|
197
194
|
# credentials file, or the JSON contents of the credentials file.
|
195
|
+
# The env_vars will never be nil. If there are no vars, the empty array is returned.
|
198
196
|
#
|
199
197
|
# @return [Array<String>]
|
200
198
|
#
|
201
199
|
def self.env_vars
|
202
|
-
|
200
|
+
env_vars_internal || []
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# @private
|
205
|
+
# Internal recursive lookup for env_vars.
|
206
|
+
#
|
207
|
+
def self.env_vars_internal
|
208
|
+
lookup_auth_param :env_vars, :env_vars_internal do
|
203
209
|
# Pull values when PATH_ENV_VARS or JSON_ENV_VARS constants exists.
|
204
210
|
path_env_vars = lookup_local_constant :PATH_ENV_VARS
|
205
211
|
json_env_vars = lookup_local_constant :JSON_ENV_VARS
|
@@ -209,9 +215,10 @@ module Google
|
|
209
215
|
|
210
216
|
##
|
211
217
|
# Sets the environment variables to search for credentials.
|
218
|
+
# Setting to `nil` "unsets" the value, and defaults to the superclass
|
219
|
+
# (or to the empty array if there is no superclass).
|
212
220
|
#
|
213
|
-
# @param [Array<String
|
214
|
-
# @return [Array<String>]
|
221
|
+
# @param [String, Array<String>, nil] new_env_vars
|
215
222
|
#
|
216
223
|
def self.env_vars= new_env_vars
|
217
224
|
new_env_vars = Array new_env_vars unless new_env_vars.nil?
|
@@ -220,11 +227,20 @@ module Google
|
|
220
227
|
|
221
228
|
##
|
222
229
|
# The file paths to search for credentials files.
|
230
|
+
# The paths will never be nil. If there are no paths, the empty array is returned.
|
223
231
|
#
|
224
232
|
# @return [Array<String>]
|
225
233
|
#
|
226
234
|
def self.paths
|
227
|
-
|
235
|
+
paths_internal || []
|
236
|
+
end
|
237
|
+
|
238
|
+
##
|
239
|
+
# @private
|
240
|
+
# Internal recursive lookup for paths.
|
241
|
+
#
|
242
|
+
def self.paths_internal
|
243
|
+
lookup_auth_param :paths, :paths_internal do
|
228
244
|
# Pull in values if the DEFAULT_PATHS constant exists.
|
229
245
|
vals = lookup_local_constant :DEFAULT_PATHS
|
230
246
|
vals ? Array(vals).flatten.uniq : nil
|
@@ -233,9 +249,10 @@ module Google
|
|
233
249
|
|
234
250
|
##
|
235
251
|
# Set the file paths to search for credentials files.
|
252
|
+
# Setting to `nil` "unsets" the value, and defaults to the superclass
|
253
|
+
# (or to the empty array if there is no superclass).
|
236
254
|
#
|
237
|
-
# @param [Array<String
|
238
|
-
# @return [Array<String>]
|
255
|
+
# @param [String, Array<String>, nil] new_paths
|
239
256
|
#
|
240
257
|
def self.paths= new_paths
|
241
258
|
new_paths = Array new_paths unless new_paths.nil?
|
@@ -252,14 +269,15 @@ module Google
|
|
252
269
|
# Otherwise, calls the superclass method if present.
|
253
270
|
# Returns nil if all steps fail.
|
254
271
|
#
|
255
|
-
# @param [Symbol] The parameter name
|
272
|
+
# @param name [Symbol] The parameter name
|
273
|
+
# @param method_name [Symbol] The lookup method name, if different
|
256
274
|
# @return [Object] The value
|
257
275
|
#
|
258
|
-
def self.lookup_auth_param name
|
276
|
+
def self.lookup_auth_param name, method_name = name
|
259
277
|
val = instance_variable_get "@#{name}".to_sym
|
260
278
|
val = yield if val.nil? && block_given?
|
261
279
|
return val unless val.nil?
|
262
|
-
return superclass.send
|
280
|
+
return superclass.send method_name if superclass.respond_to? method_name
|
263
281
|
nil
|
264
282
|
end
|
265
283
|
|
data/lib/googleauth/version.rb
CHANGED
@@ -82,6 +82,11 @@ describe Google::Auth::Credentials, :private do
|
|
82
82
|
Google::Auth::Credentials.new default_keyfile_hash, scope: "http://example.com/scope"
|
83
83
|
end
|
84
84
|
|
85
|
+
it "uses empty paths and env_vars by default" do
|
86
|
+
expect(Google::Auth::Credentials.paths).to eq([])
|
87
|
+
expect(Google::Auth::Credentials.env_vars).to eq([])
|
88
|
+
end
|
89
|
+
|
85
90
|
describe "using CONSTANTS" do
|
86
91
|
it "can be subclassed to pass in other env paths" do
|
87
92
|
test_path_env_val = "/unknown/path/to/file.txt".freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googleauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Emiola
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|