standard_id 0.51.2 → 0.52.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 +13 -0
- data/README.md +17 -0
- data/lib/generators/standard_id/install/templates/standard_id.rb +7 -0
- data/lib/standard_id/config/presets.rb +45 -0
- data/lib/standard_id/config_schema.rb +10 -0
- data/lib/standard_id/version.rb +1 -1
- data/lib/standard_id.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d91a49478fd5f477e7a20395c4c2f5b142b3bd813e96145af349143935a96482
|
|
4
|
+
data.tar.gz: 00d708402823a344e451032db69e6097c62ecc77d80ce66d4d1d68b24fed478a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 101b91f61aa5d72e333322c21c0fbe160105a9adda2bc851046ea625400e4fcda61cbc6131fdcefd8f6c7927f54f1308834be383e2d4fec1d83110276a3b9087
|
|
7
|
+
data.tar.gz: 853ef8ee5ea04b8feb98c1343025b692c8c41d9a597c3e2ae82bf31c32e16f03d810375849d0d04e5412ff96966643bdaf8529fdddeb3f30cca7f73d32edb282
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.52.0] - 2026-10-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`c.preset :inertia_web`.** Applies the settings an Inertia app with
|
|
15
|
+
passwordless or social sign-in flips: `use_inertia` and `alias_current_user`
|
|
16
|
+
true; `web.signup`, `web.password_login` and `web.password_reset` false;
|
|
17
|
+
`oauth.discovery_endpoint_base = :request`. Four of the five estate apps set
|
|
18
|
+
exactly this by hand. A preset fills only settings the host has not assigned
|
|
19
|
+
(via `Scope#assigned?`), so explicit assignments win in either order; an
|
|
20
|
+
unknown name raises `ArgumentError`. The public defaults are unchanged.
|
|
21
|
+
Presets live in `StandardId::Config::Presets`.
|
|
22
|
+
|
|
10
23
|
## [0.51.2] - 2026-10-21
|
|
11
24
|
|
|
12
25
|
### Fixed
|
data/README.md
CHANGED
|
@@ -629,6 +629,23 @@ StandardId.configure do |config|
|
|
|
629
629
|
end
|
|
630
630
|
```
|
|
631
631
|
|
|
632
|
+
Or start from the `:inertia_web` preset, which bundles the settings an
|
|
633
|
+
Inertia app with passwordless or social sign-in usually flips:
|
|
634
|
+
|
|
635
|
+
```ruby
|
|
636
|
+
StandardId.configure do |config|
|
|
637
|
+
config.preset :inertia_web
|
|
638
|
+
# use_inertia = true, alias_current_user = true,
|
|
639
|
+
# web.signup / web.password_login / web.password_reset = false,
|
|
640
|
+
# oauth.discovery_endpoint_base = :request
|
|
641
|
+
config.web.passwordless_login = true # not part of the preset: your call
|
|
642
|
+
end
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
A preset fills only the settings you haven't assigned, so an explicit
|
|
646
|
+
assignment wins whether it comes before or after `preset`. An unknown name
|
|
647
|
+
raises `ArgumentError`. The public defaults are unchanged.
|
|
648
|
+
|
|
632
649
|
3. Create the corresponding frontend components. The component path follows the pattern:
|
|
633
650
|
`{namespace}/{ControllerName}/{action}`
|
|
634
651
|
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
# Commented-out lines show defaults; uncomment and edit to override.
|
|
6
6
|
|
|
7
7
|
StandardId.configure do |c|
|
|
8
|
+
# An Inertia app whose users sign in passwordlessly or socially can start
|
|
9
|
+
# from a preset instead of setting each option below. :inertia_web sets
|
|
10
|
+
# use_inertia, alias_current_user, web.signup/password_login/password_reset
|
|
11
|
+
# = false and oauth.discovery_endpoint_base = :request. Anything you assign
|
|
12
|
+
# yourself wins, before or after this line.
|
|
13
|
+
# c.preset :inertia_web
|
|
14
|
+
|
|
8
15
|
# ---------------------------------------------------------------------------
|
|
9
16
|
# Required
|
|
10
17
|
# ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module StandardId
|
|
2
|
+
module Config
|
|
3
|
+
# Named bundles of settings, applied with `c.preset :name`.
|
|
4
|
+
#
|
|
5
|
+
# The public defaults suit a classic server-rendered app with password
|
|
6
|
+
# sign-up. Apps built the other way round (Inertia pages, passwordless or
|
|
7
|
+
# social sign-in, ApiEngine under a path prefix) flip the same handful of
|
|
8
|
+
# settings, so a preset names that bundle instead of changing the defaults
|
|
9
|
+
# for everyone else.
|
|
10
|
+
#
|
|
11
|
+
# A preset fills only settings the host has not assigned, so an explicit
|
|
12
|
+
# `c.web.signup = true` wins whether it comes before or after the preset.
|
|
13
|
+
module Presets
|
|
14
|
+
PRESETS = {
|
|
15
|
+
# Inertia-rendered web surface with no password sign-up, login or
|
|
16
|
+
# reset (sign-in is passwordless or social; which of those is on stays
|
|
17
|
+
# the host's call), and discovery endpoints built from the request so
|
|
18
|
+
# an ApiEngine mounted under a prefix advertises the right URLs.
|
|
19
|
+
inertia_web: {
|
|
20
|
+
base: { use_inertia: true, alias_current_user: true },
|
|
21
|
+
web: { signup: false, password_login: false, password_reset: false },
|
|
22
|
+
oauth: { discovery_endpoint_base: :request }
|
|
23
|
+
}
|
|
24
|
+
}.freeze
|
|
25
|
+
|
|
26
|
+
module_function
|
|
27
|
+
|
|
28
|
+
# @param config [StandardId::ConfigSchema::Config]
|
|
29
|
+
# @param name [Symbol, String]
|
|
30
|
+
# @raise [ArgumentError] for an unknown preset name
|
|
31
|
+
# @return [config]
|
|
32
|
+
def apply(config, name)
|
|
33
|
+
settings = PRESETS.fetch(name.to_sym) do
|
|
34
|
+
raise ArgumentError, "Unknown StandardId config preset: #{name.inspect}. Valid presets: #{PRESETS.keys.map(&:inspect).join(", ")}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
settings.each do |scope_name, values|
|
|
38
|
+
scope = config[scope_name]
|
|
39
|
+
values.each { |key, value| scope[key] = value unless scope.assigned?(key) }
|
|
40
|
+
end
|
|
41
|
+
config
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -266,6 +266,16 @@ module StandardId
|
|
|
266
266
|
|
|
267
267
|
def registered?(scope_name) = !!self[scope_name.to_sym]&.resolver
|
|
268
268
|
|
|
269
|
+
# Applies a named settings bundle (StandardId::Config::Presets). Only
|
|
270
|
+
# settings the host has not assigned are filled, so explicit
|
|
271
|
+
# assignments win in either order.
|
|
272
|
+
#
|
|
273
|
+
# StandardId.configure do |c|
|
|
274
|
+
# c.preset :inertia_web
|
|
275
|
+
# c.web.passwordless_login = true
|
|
276
|
+
# end
|
|
277
|
+
def preset(name) = StandardId::Config::Presets.apply(self, name)
|
|
278
|
+
|
|
269
279
|
def [](key)
|
|
270
280
|
sym = key.to_sym
|
|
271
281
|
return super if key?(sym) || __schema__.nil? || __schema__.scope?(sym)
|
data/lib/standard_id/version.rb
CHANGED
data/lib/standard_id.rb
CHANGED
|
@@ -7,6 +7,7 @@ require "standard_id/web_engine"
|
|
|
7
7
|
require "standard_id/api_engine"
|
|
8
8
|
require "standard_id/config_schema"
|
|
9
9
|
require "standard_id/config/schema"
|
|
10
|
+
require "standard_id/config/presets"
|
|
10
11
|
require "standard_id/scope_config"
|
|
11
12
|
require "standard_id/association_strict_loading"
|
|
12
13
|
require "standard_id/migration_check"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standard_id
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.52.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jaryl Sim
|
|
@@ -259,6 +259,7 @@ files:
|
|
|
259
259
|
- lib/standard_id/bearer_token_extraction.rb
|
|
260
260
|
- lib/standard_id/checks/migrations.rb
|
|
261
261
|
- lib/standard_id/config/callable_validator.rb
|
|
262
|
+
- lib/standard_id/config/presets.rb
|
|
262
263
|
- lib/standard_id/config/schema.rb
|
|
263
264
|
- lib/standard_id/config/scope_claims_validator.rb
|
|
264
265
|
- lib/standard_id/config_schema.rb
|