standard_id-google 0.8.0 → 0.9.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/CHANGELOG.md +11 -0
- data/lib/standard_id/google/providers/google.rb +17 -5
- data/lib/standard_id/google/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d90903d8710b2b5fe45b33f5800613370b293efda74854a5c185f78a7501c98f
|
|
4
|
+
data.tar.gz: bd996ac59eff2afe1e9a19bf36899c167c01a4e50b40e73ae76a76dda062455a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f263923e5f7b0c697b3770459f31d022a32bccf02ec719fcdba7534e2d3ce3d09d3621a63675ad6a746e44ad4987fa1c249f034038c9b629ec596ca7d2076f63
|
|
7
|
+
data.tar.gz: a2c3254adb01bb95a6bb873a87acf3bb5c713c821f8684d1f82c0eb392dd6f36d50774eadf21512d82f2c16a627714af58bde39add3a0671a160f682704556e4
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.9.0] - 2026-11-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Every request names the provider to `StandardId::HttpClient`** (`provider: :google`): the
|
|
15
|
+
code exchange, both tokeninfo calls, userinfo and the JWKS download. A standard_id that takes
|
|
16
|
+
the keyword (0.61.0 and later) hands it to the host's `config.network_wrapper`, so a
|
|
17
|
+
circuit breaker or tracing span can tell Google's calls apart. Against older standard_id
|
|
18
|
+
releases the keyword is left out, detected from each method's parameters, so the `~> 0.42`
|
|
19
|
+
requirement is unchanged.
|
|
20
|
+
|
|
10
21
|
## [0.8.0] - 2026-10-26
|
|
11
22
|
|
|
12
23
|
### Changed
|
|
@@ -169,7 +169,7 @@ module StandardId
|
|
|
169
169
|
code: code,
|
|
170
170
|
grant_type: "authorization_code",
|
|
171
171
|
redirect_uri: redirect_uri
|
|
172
|
-
}.compact)
|
|
172
|
+
}.compact, **http_provider(:post_form))
|
|
173
173
|
|
|
174
174
|
unless token_response.is_a?(Net::HTTPSuccess)
|
|
175
175
|
raise StandardId::InvalidRequestError,
|
|
@@ -230,7 +230,7 @@ module StandardId
|
|
|
230
230
|
raise StandardId::InvalidRequestError, "Google access token is missing" if access_token.blank?
|
|
231
231
|
|
|
232
232
|
token_info = verify_token(access_token)
|
|
233
|
-
user_response = HttpClient.get_with_bearer(USERINFO_ENDPOINT, access_token)
|
|
233
|
+
user_response = HttpClient.get_with_bearer(USERINFO_ENDPOINT, access_token, **http_provider(:get_with_bearer))
|
|
234
234
|
|
|
235
235
|
unless user_response.is_a?(Net::HTTPSuccess)
|
|
236
236
|
raise StandardId::InvalidRequestError, "Failed to fetch Google user info: HTTP #{user_response.code}"
|
|
@@ -300,7 +300,7 @@ module StandardId
|
|
|
300
300
|
# Legacy tokeninfo path. Kept as an explicit opt-in for one release.
|
|
301
301
|
# Deprecated: will be removed in 0.9.0.
|
|
302
302
|
def verify_id_token_via_tokeninfo(id_token:, nonce: nil)
|
|
303
|
-
response = HttpClient.post_form(TOKEN_INFO_ENDPOINT, id_token: id_token)
|
|
303
|
+
response = HttpClient.post_form(TOKEN_INFO_ENDPOINT, { id_token: id_token }, **http_provider(:post_form))
|
|
304
304
|
raise StandardId::InvalidRequestError, "Invalid Google ID token: invalid or expired" unless response.is_a?(Net::HTTPSuccess)
|
|
305
305
|
|
|
306
306
|
token_info = JSON.parse(response.body)
|
|
@@ -372,7 +372,7 @@ module StandardId
|
|
|
372
372
|
def download_jwks
|
|
373
373
|
rescue_to_oauth_error("Failed to fetch Google JWKS") do
|
|
374
374
|
uri, resolved_ip = HttpClient.send(:validate_url!, JWKS_URI)
|
|
375
|
-
response = HttpClient.send(:start_connection, uri, resolved_ip: resolved_ip) do |http|
|
|
375
|
+
response = HttpClient.send(:start_connection, uri, resolved_ip: resolved_ip, **http_provider(:start_connection)) do |http|
|
|
376
376
|
http.request(Net::HTTP::Get.new(uri))
|
|
377
377
|
end
|
|
378
378
|
raise StandardId::OAuthError, "Failed to fetch Google JWKS: HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
@@ -432,7 +432,7 @@ module StandardId
|
|
|
432
432
|
# Confirms an access token was issued to this app's client before its
|
|
433
433
|
# userinfo is trusted.
|
|
434
434
|
def verify_token(access_token)
|
|
435
|
-
response = HttpClient.post_form(TOKEN_INFO_ENDPOINT, access_token: access_token)
|
|
435
|
+
response = HttpClient.post_form(TOKEN_INFO_ENDPOINT, { access_token: access_token }, **http_provider(:post_form))
|
|
436
436
|
raise StandardId::InvalidRequestError, "Invalid Google access token: invalid or expired" unless response.is_a?(Net::HTTPSuccess)
|
|
437
437
|
|
|
438
438
|
token_info = JSON.parse(response.body)
|
|
@@ -466,6 +466,18 @@ module StandardId
|
|
|
466
466
|
claims
|
|
467
467
|
end
|
|
468
468
|
|
|
469
|
+
# `provider: :google` for StandardId::HttpClient, which hands it to the
|
|
470
|
+
# host's `config.network_wrapper` (e.g. one circuit per provider). Only
|
|
471
|
+
# standard_id releases after 0.60.0 take the keyword, and this plugin
|
|
472
|
+
# still supports older ones, so it is passed only when the method
|
|
473
|
+
# declares it. Read on each call rather than cached: Method#parameters
|
|
474
|
+
# costs nothing next to the request itself.
|
|
475
|
+
def http_provider(method_name)
|
|
476
|
+
parameters = HttpClient.method(method_name).parameters
|
|
477
|
+
accepts = parameters.include?([:key, :provider]) || parameters.any? { |type, _| type == :keyrest }
|
|
478
|
+
accepts ? { provider: :google } : {}
|
|
479
|
+
end
|
|
480
|
+
|
|
469
481
|
def error_reason(response)
|
|
470
482
|
body = JSON.parse(response.body.to_s)
|
|
471
483
|
reason = body["error"] if body.is_a?(Hash)
|
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standard_id-google
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Rarebit One
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
98
|
version: '0'
|
|
99
99
|
requirements: []
|
|
100
|
-
rubygems_version: 4.0.
|
|
100
|
+
rubygems_version: 4.0.20
|
|
101
101
|
specification_version: 4
|
|
102
102
|
summary: Google Sign In provider plugin for the StandardId engine.
|
|
103
103
|
test_files: []
|