omniauth-vitsme 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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +6 -3
- data/lib/omniauth/vitsme/partner.rb +8 -3
- data/lib/omniauth/vitsme/partner_directory.rb +20 -0
- data/lib/omniauth/vitsme/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3850ddfe79354a2ef8407ce6f6eeeed77508791b6ce9dc3442b5827e31aa509
|
|
4
|
+
data.tar.gz: 5101ccb683e71d694ae0897da842be6405be3ba111a013da0e87f5b894b88441
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9318ca1f2215877353b74c9b18fc0945884aa76e16249f7e15e1de7725957ec93127ef65fada7d67e6a9723da30adb44ca2db4426f8c3ff7e87a296f0703deff
|
|
7
|
+
data.tar.gz: a4c897c533691f61de68f1aa4271def64ee4f8a9d3486d52a4564c153c3048a10f64fbf9b7f2df99dc70655845144e1e22b4776cbca1599024d66f6934582432
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ 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-29
|
|
11
|
+
|
|
12
|
+
A partner that takes registrations may answer some scopes to a site with none.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- An ask with no `partner_secret` (on `provider :vitsme_partner`, a trip's stops and `OmniAuth::Vitsme::Partner.ask`)
|
|
17
|
+
shows a software statement at any partner, not only at one whose metadata says `software_statement_required`.
|
|
18
|
+
With a secret, it goes with Basic and no statement, as before.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `OmniAuth::Vitsme::Partner.scopes_without_registration(partner)`: what a partner answers with no registration
|
|
23
|
+
there, from its metadata's `scopes_without_registration` (`:all` where it takes no registrations). An ask with no
|
|
24
|
+
secret for any other scope raises `Partner::Refused` before anything is sent.
|
|
25
|
+
|
|
10
26
|
## [0.9.0] - 2026-11-28
|
|
11
27
|
|
|
12
28
|
Gates for groups of countries and for age, and a scope per label instead of a hint.
|
data/README.md
CHANGED
|
@@ -29,7 +29,7 @@ rules built in.
|
|
|
29
29
|
|
|
30
30
|
```ruby
|
|
31
31
|
# Gemfile
|
|
32
|
-
gem "omniauth-vitsme", "~> 0.
|
|
32
|
+
gem "omniauth-vitsme", "~> 0.10"
|
|
33
33
|
gem "omniauth-rails_csrf_protection" # OmniAuth 2 starts sign-in by POST only
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -242,8 +242,11 @@ OmniAuth::Vitsme::Partner.register(partner: "https://partner.example", software_
|
|
|
242
242
|
# => { "client_id" => …, "client_secret" => "…" } keep the secret: it is shown once
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
Without a `partner_secret`, every request goes with a fresh statement instead, which the strategy fetches for you:
|
|
246
|
+
at a partner that takes no registrations (`software_statement_required` in its metadata), and at one that does
|
|
247
|
+
for the scopes it answers to any site vits.me registered (`scopes_without_registration` in its metadata, as
|
|
248
|
+
Organizations Mattyr's details about a person's organization). Asking such a partner, with no secret, for a scope
|
|
249
|
+
it answers only to registered sites raises `OmniAuth::Vitsme::Partner::Refused` before anything is sent.
|
|
247
250
|
|
|
248
251
|
**Ask from a button of your own**, when you need what the partner holds, with your own explanation:
|
|
249
252
|
|
|
@@ -34,6 +34,7 @@ module OmniAuth
|
|
|
34
34
|
def listing(vitsme_issuer) = PartnerDirectory.listing(vitsme_issuer)
|
|
35
35
|
def trusted!(partner, vitsme_issuer) = PartnerDirectory.trusted!(partner, vitsme_issuer)
|
|
36
36
|
def metadata(partner) = PartnerDirectory.metadata(partner)
|
|
37
|
+
def scopes_without_registration(partner) = PartnerDirectory.scopes_without_registration(partner)
|
|
37
38
|
def clear! = PartnerDirectory.clear!
|
|
38
39
|
|
|
39
40
|
# The sealed subject: the ID token you hold for the person, encrypted to vits.me's own key (use: enc in
|
|
@@ -79,19 +80,23 @@ module OmniAuth
|
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
# Asks a partner about the person an ID token names: checks vits.me lists it as active, pushes the request
|
|
82
|
-
# with the sealed subject
|
|
83
|
-
#
|
|
83
|
+
# with the sealed subject, and returns where to send the person, with the state and PKCE verifier its
|
|
84
|
+
# callback needs. With a `partner_secret` (you registered there) the request goes with it; with none it
|
|
85
|
+
# goes with a software statement, at any partner: one that takes no registrations, or one that answers
|
|
86
|
+
# some scopes without one (`scopes_without_registration` in its metadata). Asking such a partner for a
|
|
87
|
+
# scope it answers only to registered sites, with no secret, is refused here, before anything is sent.
|
|
84
88
|
# The vitsme_partner and vitsme_trip strategies ask this way.
|
|
85
89
|
def ask(partner:, scope:, id_token:, client_id:, client_secret:, redirect_uri:, vitsme_issuer:,
|
|
86
90
|
partner_secret: nil, ui_locales: nil)
|
|
87
91
|
trusted!(partner, vitsme_issuer)
|
|
92
|
+
PartnerDirectory.refuse_unregistered!(partner, Required.plain_all(scope)) unless partner_secret
|
|
88
93
|
verifier, challenge = pkce
|
|
89
94
|
state = SecureRandom.urlsafe_base64(24)
|
|
90
95
|
params = { response_type: 'code', client_id: client_id, redirect_uri: redirect_uri,
|
|
91
96
|
scope: Array(scope).join(' '), state: state, code_challenge: challenge,
|
|
92
97
|
code_challenge_method: 'S256', ui_locales: ui_locales,
|
|
93
98
|
id_token_hint: seal_subject(id_token, vitsme_issuer) }.compact
|
|
94
|
-
|
|
99
|
+
unless partner_secret
|
|
95
100
|
params[:software_statement] = software_statement(vitsme_issuer: vitsme_issuer, client_id: client_id,
|
|
96
101
|
client_secret: client_secret, audience: partner)
|
|
97
102
|
end
|
|
@@ -52,6 +52,26 @@ module OmniAuth
|
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# The scopes a partner answers to a site with no registration there, which shows a software statement:
|
|
56
|
+
# every one (:all) where it takes no registrations, else those its metadata lists.
|
|
57
|
+
def scopes_without_registration(partner)
|
|
58
|
+
meta = metadata(partner)
|
|
59
|
+
return :all if meta['software_statement_required']
|
|
60
|
+
|
|
61
|
+
Array(meta['scopes_without_registration'])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# An ask with no partner secret for `scopes` (plain names) the partner answers only to a site registered
|
|
65
|
+
# there is refused before anything is sent.
|
|
66
|
+
def refuse_unregistered!(partner, scopes)
|
|
67
|
+
open = scopes_without_registration(partner)
|
|
68
|
+
needing = open == :all ? [] : scopes - open
|
|
69
|
+
return if needing.empty?
|
|
70
|
+
|
|
71
|
+
raise Partner::Refused, "#{partner} answers #{needing.join(' ')} only to a site registered there: " \
|
|
72
|
+
'give partner_secret'
|
|
73
|
+
end
|
|
74
|
+
|
|
55
75
|
def clear!
|
|
56
76
|
@mutex.synchronize { @cache.clear }
|
|
57
77
|
end
|