standard_id-google 0.9.0 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d90903d8710b2b5fe45b33f5800613370b293efda74854a5c185f78a7501c98f
4
- data.tar.gz: bd996ac59eff2afe1e9a19bf36899c167c01a4e50b40e73ae76a76dda062455a
3
+ metadata.gz: 60c3d41107d65412fc83ae55a379dd60c0946d6974f03d35d0c8ea5c9c4179c4
4
+ data.tar.gz: 8b5c29326eb702a07ecd3304e285c1835848d7b6244f0efdd90abf6bc09ae2a1
5
5
  SHA512:
6
- metadata.gz: f263923e5f7b0c697b3770459f31d022a32bccf02ec719fcdba7534e2d3ce3d09d3621a63675ad6a746e44ad4987fa1c249f034038c9b629ec596ca7d2076f63
7
- data.tar.gz: a2c3254adb01bb95a6bb873a87acf3bb5c713c821f8684d1f82c0eb392dd6f36d50774eadf21512d82f2c16a627714af58bde39add3a0671a160f682704556e4
6
+ metadata.gz: 4ebedaa6555e59c41c0a3dee489dc58d62156bb85d2d6bfad12d0ac4d1dfd7610920691456f45172f0e9826dd8c82a9e283550c102cf5d75deb536addd605c39
7
+ data.tar.gz: 2c8145a4cdafd45d2ff8589f252a8ca01d080e9a630e45f793f568b543e7741f5317420a95eec47a31b381e2d81172a14a4fcd1f75523af2db4e2fc5b68ab70e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.0] - 2026-11-25
11
+
12
+ ### Added
13
+
14
+ - **Announces its env vars to standard_health.** With standard_health 0.9+ loaded, the plugin
15
+ contributes its variables through standard_health's load hook, under `standard_id-google`, so
16
+ apps no longer declare them by hand: `GOOGLE_CLIENT_ID` (recommended; it switches the provider
17
+ on), `GOOGLE_CLIENT_SECRET` (required only once the provider is on and the app leaves the field
18
+ to ENV) and `GOOGLE_REQUIRE_FOR_STAFF` (forbidden on production while it switches
19
+ `staff_policy` off). Nothing is required unconditionally, and an app's own `env_spec`
20
+ declaration still wins. No dependency on standard_health: without it the hook never runs.
21
+
22
+ ### Documentation
23
+
24
+ - **An open circuit in the host's `network_wrapper` needs no mapping here.** Every Google request
25
+ runs inside `rescue_to_oauth_error`. On a standard_id that raises
26
+ `StandardId::ProviderUnavailableError` when the wrapper refuses a request itself
27
+ (rarebit-one/standard_id#480), that error is an `OAuthError`, so it passes through unchanged,
28
+ and core shows "Google is temporarily unavailable" instead of the wrapper's own message (API:
29
+ 503 `temporarily_unavailable` instead of 400). Before that, and for the wrapper errors core
30
+ passes through (programming errors, errors raised after the request went through), the
31
+ wrapper's error becomes a plain `OAuthError`: sign-in fails, but never with a 500. New specs pin
32
+ both cases for the code, id_token (JWKS and tokeninfo) and access-token flows. No code change.
33
+
10
34
  ## [0.9.0] - 2026-11-23
11
35
 
12
36
  ### Added
data/README.md CHANGED
@@ -114,6 +114,7 @@ variable named after it, upper-cased:
114
114
  |---|---|---|
115
115
  | `google_client_id` | `GOOGLE_CLIENT_ID` | `GOOGLE_OAUTH_CLIENT_ID` |
116
116
  | `google_client_secret` | `GOOGLE_CLIENT_SECRET` | `GOOGLE_OAUTH_CLIENT_SECRET` |
117
+ | `google_require_for_staff` | `GOOGLE_REQUIRE_FOR_STAFF` | |
117
118
 
118
119
  So with those variables set the block above is optional. Explicit
119
120
  configuration, even `nil`, always wins. The `GOOGLE_OAUTH_*` names — what
@@ -138,6 +139,22 @@ StandardId::Providers::Google.configuration_errors
138
139
  config.social.provider_misconfiguration = :raise # fail a production boot instead of warning
139
140
  ```
140
141
 
142
+ ### standard_health
143
+
144
+ With [standard_health](https://github.com/rarebit-one/standard_health) 0.9+ in
145
+ the bundle, the plugin declares these variables on `/diagnostics/env` and in
146
+ `Checks::EnvSpecAudit`, grouped under `standard_id-google`, so apps need not
147
+ list them by hand. Without standard_health nothing happens: the gem does not
148
+ depend on it.
149
+
150
+ | Variable | Level | Applies |
151
+ |---|---|---|
152
+ | `GOOGLE_CLIENT_ID` | recommended | always (unset leaves the provider off) |
153
+ | `GOOGLE_CLIENT_SECRET` | required | once the provider is on, unless the app assigns `google_client_secret` or the deprecated `GOOGLE_OAUTH_CLIENT_SECRET` supplies it |
154
+ | `GOOGLE_REQUIRE_FOR_STAFF` | forbidden | on production, while it turns staff enforcement off |
155
+
156
+ An app that declares any of them in its own `env_spec` overrides the row here.
157
+
141
158
  ### Flows
142
159
 
143
160
  | Flow | Needs `google_client_secret` |
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Offers the plugin's env vars to standard_health without depending on it.
4
+ # The block runs only when standard_health is loaded (it fires
5
+ # `run_load_hooks(:standard_health, ...)`), whichever gem loads first; without
6
+ # standard_health it never runs. It receives standard_health's contribution
7
+ # registry, of which only `contribute_env_vars` is used here.
8
+ #
9
+ # The provider stays off until google_client_id is set, so nothing here is
10
+ # required unconditionally: GOOGLE_CLIENT_SECRET becomes required only once the
11
+ # provider is on and the app leaves the field to its ENV fallback. An app that
12
+ # declares any of these vars in its own env_spec overrides the row here.
13
+ ActiveSupport.on_load(:standard_health) do |health|
14
+ google = StandardId::Providers::Google
15
+
16
+ # Whether +field+ is left to its ENV fallback: the app never assigned it
17
+ # (standard_id < 0.43 can't tell, so it counts as unassigned) and the
18
+ # deprecated pre-0.5.0 name isn't supplying it either. An app that assigns
19
+ # the field, from credentials say, needs no ENV var for it.
20
+ from_env = lambda do |field|
21
+ social = StandardId.config.social
22
+ assigned = social.respond_to?(:assigned?) && social.assigned?(field)
23
+ !assigned && ENV[google::LEGACY_ENV.fetch(field)].blank?
24
+ end
25
+
26
+ health.contribute_env_vars "standard_id-google" do
27
+ recommended :GOOGLE_CLIENT_ID,
28
+ description: "Google OAuth client ID (social.google_client_id). Setting it switches Sign in with Google " \
29
+ "on; unset leaves the provider off. Replaces the deprecated GOOGLE_OAUTH_CLIENT_ID"
30
+ required :GOOGLE_CLIENT_SECRET,
31
+ if: -> { google.enabled? && from_env.call(:google_client_secret) },
32
+ description: "Google OAuth client secret (social.google_client_secret). Required once GOOGLE_CLIENT_ID " \
33
+ "switches the provider on, unless the app assigns the field itself. Replaces the deprecated " \
34
+ "GOOGLE_OAUTH_CLIENT_SECRET"
35
+ # On by default; setting it false turns StandardId::Google.staff_policy
36
+ # off, letting staff in by any login method. Flag that on production.
37
+ forbidden :GOOGLE_REQUIRE_FOR_STAFF, in: %w[production],
38
+ if: -> { StandardId.config.google_require_for_staff == false },
39
+ description: "Overrides social.google_require_for_staff (default true). Set false, it switches off " \
40
+ "StandardId::Google.staff_policy, so staff are no longer held to a pinned Google sign-in"
41
+ end
42
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StandardId
4
4
  module Google
5
- VERSION = "0.9.0"
5
+ VERSION = "0.10.0"
6
6
  end
7
7
  end
@@ -4,6 +4,7 @@ require "standard_id"
4
4
  require "standard_id/google/version"
5
5
  require "standard_id/google/providers/google"
6
6
  require "standard_id/google/staff_policy"
7
+ require "standard_id/google/health_contributions"
7
8
 
8
9
  # Registers the provider from a Railtie's after_initialize (a no-op outside
9
10
  # Rails). Its config fields are declared earlier, before config/initializers,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_id-google
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rarebit One
@@ -72,6 +72,7 @@ files:
72
72
  - lib/generators/standard_id/google/install/install_generator.rb
73
73
  - lib/generators/standard_id/google/install/templates/initializer.rb.erb
74
74
  - lib/standard_id/google.rb
75
+ - lib/standard_id/google/health_contributions.rb
75
76
  - lib/standard_id/google/providers/google.rb
76
77
  - lib/standard_id/google/staff_policy.rb
77
78
  - lib/standard_id/google/version.rb