googleauth 0.5.1 → 0.14.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 +5 -5
- data/.github/CODEOWNERS +7 -0
- data/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +5 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +36 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
- data/.github/ISSUE_TEMPLATE/support_request.md +7 -0
- data/.kokoro/build.bat +16 -0
- data/.kokoro/build.sh +4 -0
- data/.kokoro/continuous/common.cfg +24 -0
- data/.kokoro/continuous/linux.cfg +25 -0
- data/.kokoro/continuous/osx.cfg +8 -0
- data/.kokoro/continuous/post.cfg +30 -0
- data/.kokoro/continuous/windows.cfg +29 -0
- data/.kokoro/osx.sh +4 -0
- data/.kokoro/presubmit/common.cfg +24 -0
- data/.kokoro/presubmit/linux.cfg +24 -0
- data/.kokoro/presubmit/osx.cfg +8 -0
- data/.kokoro/presubmit/windows.cfg +29 -0
- data/.kokoro/release.cfg +94 -0
- data/.kokoro/trampoline.bat +10 -0
- data/.kokoro/trampoline.sh +4 -0
- data/.repo-metadata.json +5 -0
- data/.rubocop.yml +19 -1
- data/CHANGELOG.md +112 -19
- data/CODE_OF_CONDUCT.md +43 -0
- data/Gemfile +19 -13
- data/{COPYING → LICENSE} +0 -0
- data/README.md +58 -18
- data/Rakefile +126 -9
- data/googleauth.gemspec +28 -25
- data/integration/helper.rb +31 -0
- data/integration/id_tokens/key_source_test.rb +74 -0
- data/lib/googleauth.rb +7 -96
- data/lib/googleauth/application_default.rb +81 -0
- data/lib/googleauth/client_id.rb +21 -19
- data/lib/googleauth/compute_engine.rb +70 -43
- data/lib/googleauth/credentials.rb +442 -0
- data/lib/googleauth/credentials_loader.rb +117 -43
- data/lib/googleauth/default_credentials.rb +93 -0
- data/lib/googleauth/iam.rb +11 -11
- data/lib/googleauth/id_tokens.rb +233 -0
- data/lib/googleauth/id_tokens/errors.rb +71 -0
- data/lib/googleauth/id_tokens/key_sources.rb +394 -0
- data/lib/googleauth/id_tokens/verifier.rb +144 -0
- data/lib/googleauth/json_key_reader.rb +50 -0
- data/lib/googleauth/scope_util.rb +12 -12
- data/lib/googleauth/service_account.rb +74 -63
- data/lib/googleauth/signet.rb +55 -13
- data/lib/googleauth/stores/file_token_store.rb +8 -8
- data/lib/googleauth/stores/redis_token_store.rb +22 -22
- data/lib/googleauth/token_store.rb +6 -6
- data/lib/googleauth/user_authorizer.rb +80 -68
- data/lib/googleauth/user_refresh.rb +44 -35
- data/lib/googleauth/version.rb +1 -1
- data/lib/googleauth/web_user_authorizer.rb +77 -68
- data/rakelib/devsite_builder.rb +45 -0
- data/rakelib/link_checker.rb +64 -0
- data/rakelib/repo_metadata.rb +59 -0
- data/spec/googleauth/apply_auth_examples.rb +74 -50
- data/spec/googleauth/client_id_spec.rb +75 -55
- data/spec/googleauth/compute_engine_spec.rb +98 -46
- data/spec/googleauth/credentials_spec.rb +478 -0
- data/spec/googleauth/get_application_default_spec.rb +149 -111
- data/spec/googleauth/iam_spec.rb +25 -25
- data/spec/googleauth/scope_util_spec.rb +26 -24
- data/spec/googleauth/service_account_spec.rb +269 -144
- data/spec/googleauth/signet_spec.rb +101 -30
- data/spec/googleauth/stores/file_token_store_spec.rb +12 -13
- data/spec/googleauth/stores/redis_token_store_spec.rb +11 -11
- data/spec/googleauth/stores/store_examples.rb +16 -16
- data/spec/googleauth/user_authorizer_spec.rb +153 -124
- data/spec/googleauth/user_refresh_spec.rb +186 -121
- data/spec/googleauth/web_user_authorizer_spec.rb +82 -69
- data/spec/spec_helper.rb +21 -19
- data/test/helper.rb +33 -0
- data/test/id_tokens/key_sources_test.rb +240 -0
- data/test/id_tokens/verifier_test.rb +269 -0
- metadata +87 -34
- data/.rubocop_todo.yml +0 -32
- data/.travis.yml +0 -37
@@ -0,0 +1,269 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Redistribution and use in source and binary forms, with or without
|
4
|
+
# modification, are permitted provided that the following conditions are
|
5
|
+
# met:
|
6
|
+
#
|
7
|
+
# * Redistributions of source code must retain the above copyright
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
9
|
+
# * Redistributions in binary form must reproduce the above
|
10
|
+
# copyright notice, this list of conditions and the following disclaimer
|
11
|
+
# in the documentation and/or other materials provided with the
|
12
|
+
# distribution.
|
13
|
+
# * Neither the name of Google Inc. nor the names of its
|
14
|
+
# contributors may be used to endorse or promote products derived from
|
15
|
+
# this software without specific prior written permission.
|
16
|
+
#
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
18
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
19
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
20
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
21
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
24
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
25
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
|
29
|
+
require "helper"
|
30
|
+
|
31
|
+
describe Google::Auth::IDTokens::Verifier do
|
32
|
+
describe "verify_oidc" do
|
33
|
+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
|
48
|
+
let(:oidc_jwk_body) {
|
49
|
+
<<~JWK
|
50
|
+
{
|
51
|
+
"keys": [
|
52
|
+
{
|
53
|
+
"kid": "fb8ca5b7d8d9a5c6c6788071e866c6c40f3fc1f9",
|
54
|
+
"e": "AQAB",
|
55
|
+
"alg": "RS256",
|
56
|
+
"use": "sig",
|
57
|
+
"n": "zK8PHf_6V3G5rU-viUOL1HvAYn7q--dxMoUkt7x1rSWX6fimla-lpoYAKhFTLUELkRKy_6UDzfybz0P9eItqS2UxVWYpKYmKTQ08HgUBUde4GtO_B0SkSk8iLtGh653UBBjgXmfzdfQEz_DsaWn7BMtuAhY9hpMtJye8LQlwaS8ibQrsC0j0GZM5KXRITHwfx06_T1qqC_MOZRA6iJs-J2HNlgeyFuoQVBTY6pRqGXa-qaVsSG3iU-vqNIciFquIq-xydwxLqZNksRRer5VAsSHf0eD3g2DX-cf6paSy1aM40svO9EfSvG_07MuHafEE44RFvSZZ4ubEN9U7ALSjdw",
|
58
|
+
"kty": "RSA"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"kty": "RSA",
|
62
|
+
"kid": "492710a7fcdb153960ce01f760520a32c8455dff",
|
63
|
+
"e": "AQAB",
|
64
|
+
"alg": "RS256",
|
65
|
+
"use": "sig",
|
66
|
+
"n": "wl6TaY_3dsuLczYH_hioeQ5JjcLKLGYb--WImN9_IKMkOj49dgs25wkjsdI9XGJYhhPJLlvfjIfXH49ZGA_XKLx7fggNaBRZcj1y-I3_77tVa9N7An5JLq3HT9XVt0PNTq0mtX009z1Hva4IWZ5IhENx2rWlZOfFAXiMUqhnDc8VY3lG7vr8_VG3cw3XRKvlZQKbb6p2YIMFsUwaDGL2tVF4SkxpxIazUYfOY5lijyVugNTslOBhlEMq_43MZlkznSrbFx8ToQ2bQX4Shj-r9pLyofbo6A7K9mgWnQXGY5rQVLPYYRzUg0ThWDzwHdgxYC5MNxKyQH4RC2LPv3U0LQ"
|
67
|
+
}
|
68
|
+
]
|
69
|
+
}
|
70
|
+
JWK
|
71
|
+
}
|
72
|
+
let(:expected_aud) { "http://example.com" }
|
73
|
+
let(:expected_azp) { "542339357638-cr0dserr2evg7sv1meghqeu703274f3h@developer.gserviceaccount.com" }
|
74
|
+
let(:unexpired_test_time) { Time.at 1591339181 }
|
75
|
+
let(:expired_test_time) { unexpired_test_time + 86400 }
|
76
|
+
|
77
|
+
after do
|
78
|
+
WebMock.reset!
|
79
|
+
Google::Auth::IDTokens.forget_sources!
|
80
|
+
end
|
81
|
+
|
82
|
+
it "verifies a good token with iss, aud, and azp checks" do
|
83
|
+
stub_request(:get, Google::Auth::IDTokens::OAUTH2_V3_CERTS_URL).to_return(body: oidc_jwk_body)
|
84
|
+
Time.stub :now, unexpired_test_time do
|
85
|
+
Google::Auth::IDTokens.verify_oidc oidc_token, aud: expected_aud, azp: expected_azp
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it "fails to verify a bad token" do
|
90
|
+
stub_request(:get, Google::Auth::IDTokens::OAUTH2_V3_CERTS_URL).to_return(body: oidc_jwk_body)
|
91
|
+
Time.stub :now, unexpired_test_time do
|
92
|
+
assert_raises Google::Auth::IDTokens::SignatureError do
|
93
|
+
Google::Auth::IDTokens.verify_oidc "#{oidc_token}x"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it "fails to verify a token with the wrong aud" do
|
99
|
+
stub_request(:get, Google::Auth::IDTokens::OAUTH2_V3_CERTS_URL).to_return(body: oidc_jwk_body)
|
100
|
+
Time.stub :now, unexpired_test_time do
|
101
|
+
assert_raises Google::Auth::IDTokens::AudienceMismatchError do
|
102
|
+
Google::Auth::IDTokens.verify_oidc oidc_token, aud: ["hello", "world"]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it "fails to verify a token with the wrong azp" do
|
108
|
+
stub_request(:get, Google::Auth::IDTokens::OAUTH2_V3_CERTS_URL).to_return(body: oidc_jwk_body)
|
109
|
+
Time.stub :now, unexpired_test_time do
|
110
|
+
assert_raises Google::Auth::IDTokens::AuthorizedPartyMismatchError do
|
111
|
+
Google::Auth::IDTokens.verify_oidc oidc_token, azp: "hello"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
it "fails to verify a token with the wrong issuer" do
|
117
|
+
stub_request(:get, Google::Auth::IDTokens::OAUTH2_V3_CERTS_URL).to_return(body: oidc_jwk_body)
|
118
|
+
Time.stub :now, unexpired_test_time do
|
119
|
+
assert_raises Google::Auth::IDTokens::IssuerMismatchError do
|
120
|
+
Google::Auth::IDTokens.verify_oidc oidc_token, iss: "hello"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it "fails to verify an expired token" do
|
126
|
+
stub_request(:get, Google::Auth::IDTokens::OAUTH2_V3_CERTS_URL).to_return(body: oidc_jwk_body)
|
127
|
+
Time.stub :now, expired_test_time do
|
128
|
+
assert_raises Google::Auth::IDTokens::ExpiredTokenError do
|
129
|
+
Google::Auth::IDTokens.verify_oidc oidc_token
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe "verify_iap" do
|
136
|
+
let(:iap_token) {
|
137
|
+
"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjBvZUxjUSJ9.eyJhdWQiOiIvcH" \
|
138
|
+
"JvamVjdHMvNjUyNTYyNzc2Nzk4L2FwcHMvY2xvdWQtc2FtcGxlcy10ZXN0cy1waHAtaWFwI" \
|
139
|
+
"iwiZW1haWwiOiJkYXp1bWFAZ29vZ2xlLmNvbSIsImV4cCI6MTU5MTMzNTcyNCwiZ29vZ2xl" \
|
140
|
+
"Ijp7ImFjY2Vzc19sZXZlbHMiOlsiYWNjZXNzUG9saWNpZXMvNTE4NTUxMjgwOTI0L2FjY2V" \
|
141
|
+
"zc0xldmVscy9yZWNlbnRTZWN1cmVDb25uZWN0RGF0YSIsImFjY2Vzc1B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159
|
+
{
|
160
|
+
"alg" : "ES256",
|
161
|
+
"crv" : "P-256",
|
162
|
+
"kid" : "LYyP2g",
|
163
|
+
"kty" : "EC",
|
164
|
+
"use" : "sig",
|
165
|
+
"x" : "SlXFFkJ3JxMsXyXNrqzE3ozl_0913PmNbccLLWfeQFU",
|
166
|
+
"y" : "GLSahrZfBErmMUcHP0MGaeVnJdBwquhrhQ8eP05NfCI"
|
167
|
+
},
|
168
|
+
{
|
169
|
+
"alg" : "ES256",
|
170
|
+
"crv" : "P-256",
|
171
|
+
"kid" : "mpf0DA",
|
172
|
+
"kty" : "EC",
|
173
|
+
"use" : "sig",
|
174
|
+
"x" : "fHEdeT3a6KaC1kbwov73ZwB_SiUHEyKQwUUtMCEn0aI",
|
175
|
+
"y" : "QWOjwPhInNuPlqjxLQyhveXpWqOFcQPhZ3t-koMNbZI"
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"alg" : "ES256",
|
179
|
+
"crv" : "P-256",
|
180
|
+
"kid" : "b9vTLA",
|
181
|
+
"kty" : "EC",
|
182
|
+
"use" : "sig",
|
183
|
+
"x" : "qCByTAvci-jRAD7uQSEhTdOs8iA714IbcY2L--YzynI",
|
184
|
+
"y" : "WQY0uCoQyPSozWKGQ0anmFeOH5JNXiZa9i6SNqOcm7w"
|
185
|
+
},
|
186
|
+
{
|
187
|
+
"alg" : "ES256",
|
188
|
+
"crv" : "P-256",
|
189
|
+
"kid" : "0oeLcQ",
|
190
|
+
"kty" : "EC",
|
191
|
+
"use" : "sig",
|
192
|
+
"x" : "MdhRXGEoGJLtBjQEIjnYLPkeci9rXnca2TffkI0Kac0",
|
193
|
+
"y" : "9BoREHfX7g5OK8ELpA_4RcOnFCGSjfR4SGZpBo7juEY"
|
194
|
+
},
|
195
|
+
{
|
196
|
+
"alg" : "ES256",
|
197
|
+
"crv" : "P-256",
|
198
|
+
"kid" : "g5X6ig",
|
199
|
+
"kty" : "EC",
|
200
|
+
"use" : "sig",
|
201
|
+
"x" : "115LSuaFVzVROJiGfdPN1kT14Hv3P4RIjthfslZ010s",
|
202
|
+
"y" : "-FAaRtO4yvrN4uJ89xwGWOEJcSwpLmFOtb0SDJxEAuc"
|
203
|
+
}
|
204
|
+
]
|
205
|
+
}
|
206
|
+
JWK
|
207
|
+
}
|
208
|
+
let(:expected_aud) { "/projects/652562776798/apps/cloud-samples-tests-php-iap" }
|
209
|
+
let(:unexpired_test_time) { Time.at 1591335143 }
|
210
|
+
let(:expired_test_time) { unexpired_test_time + 86400 }
|
211
|
+
|
212
|
+
after do
|
213
|
+
WebMock.reset!
|
214
|
+
Google::Auth::IDTokens.forget_sources!
|
215
|
+
end
|
216
|
+
|
217
|
+
it "verifies a good token with iss and aud checks" do
|
218
|
+
stub_request(:get, Google::Auth::IDTokens::IAP_JWK_URL).to_return(body: iap_jwk_body)
|
219
|
+
Time.stub :now, unexpired_test_time do
|
220
|
+
Google::Auth::IDTokens.verify_iap iap_token, aud: expected_aud
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
it "fails to verify a bad token" do
|
225
|
+
stub_request(:get, Google::Auth::IDTokens::IAP_JWK_URL).to_return(body: iap_jwk_body)
|
226
|
+
Time.stub :now, unexpired_test_time do
|
227
|
+
assert_raises Google::Auth::IDTokens::SignatureError do
|
228
|
+
Google::Auth::IDTokens.verify_iap "#{iap_token}x"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
it "fails to verify a token with the wrong aud" do
|
234
|
+
stub_request(:get, Google::Auth::IDTokens::IAP_JWK_URL).to_return(body: iap_jwk_body)
|
235
|
+
Time.stub :now, unexpired_test_time do
|
236
|
+
assert_raises Google::Auth::IDTokens::AudienceMismatchError do
|
237
|
+
Google::Auth::IDTokens.verify_iap iap_token, aud: ["hello", "world"]
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
it "fails to verify a token with the wrong azp" do
|
243
|
+
stub_request(:get, Google::Auth::IDTokens::IAP_JWK_URL).to_return(body: iap_jwk_body)
|
244
|
+
Time.stub :now, unexpired_test_time do
|
245
|
+
assert_raises Google::Auth::IDTokens::AuthorizedPartyMismatchError do
|
246
|
+
Google::Auth::IDTokens.verify_iap iap_token, azp: "hello"
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
it "fails to verify a token with the wrong issuer" do
|
252
|
+
stub_request(:get, Google::Auth::IDTokens::IAP_JWK_URL).to_return(body: iap_jwk_body)
|
253
|
+
Time.stub :now, unexpired_test_time do
|
254
|
+
assert_raises Google::Auth::IDTokens::IssuerMismatchError do
|
255
|
+
Google::Auth::IDTokens.verify_iap iap_token, iss: "hello"
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
it "fails to verify an expired token" do
|
261
|
+
stub_request(:get, Google::Auth::IDTokens::IAP_JWK_URL).to_return(body: iap_jwk_body)
|
262
|
+
Time.stub :now, expired_test_time do
|
263
|
+
assert_raises Google::Auth::IDTokens::ExpiredTokenError do
|
264
|
+
Google::Auth::IDTokens.verify_iap iap_token
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googleauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Emiola
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.9'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: logging
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
19
|
+
version: 0.17.3
|
20
|
+
- - "<"
|
32
21
|
- !ruby/object:Gem::Version
|
33
22
|
version: '2.0'
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.17.3
|
30
|
+
- - "<"
|
39
31
|
- !ruby/object:Gem::Version
|
40
32
|
version: '2.0'
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
34
|
name: jwt
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
44
36
|
requirements:
|
45
|
-
- - "
|
37
|
+
- - ">="
|
46
38
|
- !ruby/object:Gem::Version
|
47
39
|
version: '1.4'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '3.0'
|
48
43
|
type: :runtime
|
49
44
|
prerelease: false
|
50
45
|
version_requirements: !ruby/object:Gem::Requirement
|
51
46
|
requirements:
|
52
|
-
- - "
|
47
|
+
- - ">="
|
53
48
|
- !ruby/object:Gem::Version
|
54
49
|
version: '1.4'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '3.0'
|
55
53
|
- !ruby/object:Gem::Dependency
|
56
54
|
name: memoist
|
57
55
|
requirement: !ruby/object:Gem::Requirement
|
58
56
|
requirements:
|
59
57
|
- - "~>"
|
60
58
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0.
|
59
|
+
version: '0.16'
|
62
60
|
type: :runtime
|
63
61
|
prerelease: false
|
64
62
|
version_requirements: !ruby/object:Gem::Requirement
|
65
63
|
requirements:
|
66
64
|
- - "~>"
|
67
65
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0.
|
66
|
+
version: '0.16'
|
69
67
|
- !ruby/object:Gem::Dependency
|
70
68
|
name: multi_json
|
71
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,30 +82,50 @@ dependencies:
|
|
84
82
|
name: os
|
85
83
|
requirement: !ruby/object:Gem::Requirement
|
86
84
|
requirements:
|
87
|
-
- - "
|
85
|
+
- - ">="
|
88
86
|
- !ruby/object:Gem::Version
|
89
87
|
version: '0.9'
|
88
|
+
- - "<"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '2.0'
|
90
91
|
type: :runtime
|
91
92
|
prerelease: false
|
92
93
|
version_requirements: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
|
-
- - "
|
95
|
+
- - ">="
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '0.9'
|
98
|
+
- - "<"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '2.0'
|
97
101
|
- !ruby/object:Gem::Dependency
|
98
102
|
name: signet
|
99
103
|
requirement: !ruby/object:Gem::Requirement
|
100
104
|
requirements:
|
101
105
|
- - "~>"
|
102
106
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
107
|
+
version: '0.14'
|
104
108
|
type: :runtime
|
105
109
|
prerelease: false
|
106
110
|
version_requirements: !ruby/object:Gem::Requirement
|
107
111
|
requirements:
|
108
112
|
- - "~>"
|
109
113
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
114
|
+
version: '0.14'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: yard
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0.9'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - "~>"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0.9'
|
111
129
|
description: |2
|
112
130
|
Allows simple authorization for accessing Google APIs.
|
113
131
|
Provide support for Application Default Credentials, as described at
|
@@ -117,23 +135,52 @@ executables: []
|
|
117
135
|
extensions: []
|
118
136
|
extra_rdoc_files: []
|
119
137
|
files:
|
138
|
+
- ".github/CODEOWNERS"
|
139
|
+
- ".github/CONTRIBUTING.md"
|
140
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
141
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
142
|
+
- ".github/ISSUE_TEMPLATE/support_request.md"
|
120
143
|
- ".gitignore"
|
144
|
+
- ".kokoro/build.bat"
|
145
|
+
- ".kokoro/build.sh"
|
146
|
+
- ".kokoro/continuous/common.cfg"
|
147
|
+
- ".kokoro/continuous/linux.cfg"
|
148
|
+
- ".kokoro/continuous/osx.cfg"
|
149
|
+
- ".kokoro/continuous/post.cfg"
|
150
|
+
- ".kokoro/continuous/windows.cfg"
|
151
|
+
- ".kokoro/osx.sh"
|
152
|
+
- ".kokoro/presubmit/common.cfg"
|
153
|
+
- ".kokoro/presubmit/linux.cfg"
|
154
|
+
- ".kokoro/presubmit/osx.cfg"
|
155
|
+
- ".kokoro/presubmit/windows.cfg"
|
156
|
+
- ".kokoro/release.cfg"
|
157
|
+
- ".kokoro/trampoline.bat"
|
158
|
+
- ".kokoro/trampoline.sh"
|
159
|
+
- ".repo-metadata.json"
|
121
160
|
- ".rspec"
|
122
161
|
- ".rubocop.yml"
|
123
|
-
- ".rubocop_todo.yml"
|
124
|
-
- ".travis.yml"
|
125
162
|
- CHANGELOG.md
|
126
|
-
-
|
127
|
-
- COPYING
|
163
|
+
- CODE_OF_CONDUCT.md
|
128
164
|
- Gemfile
|
165
|
+
- LICENSE
|
129
166
|
- README.md
|
130
167
|
- Rakefile
|
131
168
|
- googleauth.gemspec
|
169
|
+
- integration/helper.rb
|
170
|
+
- integration/id_tokens/key_source_test.rb
|
132
171
|
- lib/googleauth.rb
|
172
|
+
- lib/googleauth/application_default.rb
|
133
173
|
- lib/googleauth/client_id.rb
|
134
174
|
- lib/googleauth/compute_engine.rb
|
175
|
+
- lib/googleauth/credentials.rb
|
135
176
|
- lib/googleauth/credentials_loader.rb
|
177
|
+
- lib/googleauth/default_credentials.rb
|
136
178
|
- lib/googleauth/iam.rb
|
179
|
+
- lib/googleauth/id_tokens.rb
|
180
|
+
- lib/googleauth/id_tokens/errors.rb
|
181
|
+
- lib/googleauth/id_tokens/key_sources.rb
|
182
|
+
- lib/googleauth/id_tokens/verifier.rb
|
183
|
+
- lib/googleauth/json_key_reader.rb
|
137
184
|
- lib/googleauth/scope_util.rb
|
138
185
|
- lib/googleauth/service_account.rb
|
139
186
|
- lib/googleauth/signet.rb
|
@@ -144,9 +191,13 @@ files:
|
|
144
191
|
- lib/googleauth/user_refresh.rb
|
145
192
|
- lib/googleauth/version.rb
|
146
193
|
- lib/googleauth/web_user_authorizer.rb
|
194
|
+
- rakelib/devsite_builder.rb
|
195
|
+
- rakelib/link_checker.rb
|
196
|
+
- rakelib/repo_metadata.rb
|
147
197
|
- spec/googleauth/apply_auth_examples.rb
|
148
198
|
- spec/googleauth/client_id_spec.rb
|
149
199
|
- spec/googleauth/compute_engine_spec.rb
|
200
|
+
- spec/googleauth/credentials_spec.rb
|
150
201
|
- spec/googleauth/get_application_default_spec.rb
|
151
202
|
- spec/googleauth/iam_spec.rb
|
152
203
|
- spec/googleauth/scope_util_spec.rb
|
@@ -159,7 +210,10 @@ files:
|
|
159
210
|
- spec/googleauth/user_refresh_spec.rb
|
160
211
|
- spec/googleauth/web_user_authorizer_spec.rb
|
161
212
|
- spec/spec_helper.rb
|
162
|
-
|
213
|
+
- test/helper.rb
|
214
|
+
- test/id_tokens/key_sources_test.rb
|
215
|
+
- test/id_tokens/verifier_test.rb
|
216
|
+
homepage: https://github.com/googleapis/google-auth-library-ruby
|
163
217
|
licenses:
|
164
218
|
- Apache-2.0
|
165
219
|
metadata: {}
|
@@ -171,15 +225,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
225
|
requirements:
|
172
226
|
- - ">="
|
173
227
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
228
|
+
version: 2.4.0
|
175
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
230
|
requirements:
|
177
231
|
- - ">="
|
178
232
|
- !ruby/object:Gem::Version
|
179
233
|
version: '0'
|
180
234
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.4.3
|
235
|
+
rubygems_version: 3.1.4
|
183
236
|
signing_key:
|
184
237
|
specification_version: 4
|
185
238
|
summary: Google Auth Library for Ruby
|
@@ -187,6 +240,7 @@ test_files:
|
|
187
240
|
- spec/googleauth/apply_auth_examples.rb
|
188
241
|
- spec/googleauth/client_id_spec.rb
|
189
242
|
- spec/googleauth/compute_engine_spec.rb
|
243
|
+
- spec/googleauth/credentials_spec.rb
|
190
244
|
- spec/googleauth/get_application_default_spec.rb
|
191
245
|
- spec/googleauth/iam_spec.rb
|
192
246
|
- spec/googleauth/scope_util_spec.rb
|
@@ -199,4 +253,3 @@ test_files:
|
|
199
253
|
- spec/googleauth/user_refresh_spec.rb
|
200
254
|
- spec/googleauth/web_user_authorizer_spec.rb
|
201
255
|
- spec/spec_helper.rb
|
202
|
-
has_rdoc:
|