standard_id 0.66.0 → 0.66.1

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: ce9554a4ecea8b55429ff64af874edbb1fd9220d0cfaf866834b4c2acda20482
4
- data.tar.gz: cfe2fe8aee4b26f46111a27afec5b6c892cfed6602b306ff74c1ab2c1424adc7
3
+ metadata.gz: a5888f19201531026c10e1a91dd295dd1b5ed5b90fb4ddf139b3560489ba6797
4
+ data.tar.gz: d9515e19686e5fe874c72f9f610cdd7d5299686de1c6f94047c69be2782eb960
5
5
  SHA512:
6
- metadata.gz: 6e70a3bf0dc94040dbe10b1cbe90480de7b90e549f5b86311fe29e9b81798193a03745c1d2789bcd923eef74a549ba483f0ecca676aebc8f070644f60008d5b6
7
- data.tar.gz: 886cfc5f1f805f1716142eb945b0f0fcbb13c34859f9ce882076ea31c014bfeb65bcdcfb636103192f89572cf95d7ea7ec7c82bf6ab289da5b01c1d0b00dd2e4
6
+ metadata.gz: 90d7ab7ef2886e75311f4e1ffa76030965191914e80ec8f828c9a3b890b89f191ff2f75e9122547b8482f0301078de3b9e8c97f1b71866bf0254adc20749488d
7
+ data.tar.gz: 36de0dee3ada0ff656ff8e4fe74409791a689b24beac28ff62e1c0d9786779d26f2df4804c395277c1b1aeaff9ed7dc50ab1855220620cee7ceacb3c175797e5
data/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.66.1] - 2026-11-25
11
+
12
+ ### Fixed
13
+
14
+ - **`GET /userinfo` no longer 500s when the host's account model lacks an optional attribute.**
15
+ The `name` and `email` claims (with `email_verified`, which depends on `email`) are now read only
16
+ when the account responds to them, and omitted otherwise, as OIDC allows for every claim but
17
+ `sub`. Previously an Account without `name` raised `NoMethodError` for every caller.
18
+ `email_verified` is also omitted, rather than sent as `false`, when the account has no email.
19
+
10
20
  ## [0.66.0] - 2026-11-25
11
21
 
12
22
  ### Added
@@ -16,22 +16,31 @@ module StandardId
16
16
 
17
17
  private
18
18
 
19
+ # OIDC userinfo claims other than `sub` are optional: a claim whose
20
+ # attribute the host's account model doesn't define is omitted, not
21
+ # sent as null and not a NoMethodError.
19
22
  def build_userinfo_response(account)
23
+ email = optional_attribute(account, :email)
24
+
20
25
  {
21
26
  sub: account_sub(account),
22
- name: account.name,
23
- email: account.email,
24
- email_verified: email_verified?(account),
25
- updated_at: account.respond_to?(:updated_at) ? account.updated_at&.to_i : nil
27
+ name: optional_attribute(account, :name),
28
+ email: email,
29
+ email_verified: email.present? ? email_verified?(email) : nil,
30
+ updated_at: optional_attribute(account, :updated_at)&.to_i
26
31
  }.compact
27
32
  end
28
33
 
34
+ def optional_attribute(account, attribute)
35
+ account.public_send(attribute) if account.respond_to?(attribute)
36
+ end
37
+
29
38
  def account_sub(account)
30
39
  account.id.to_s
31
40
  end
32
41
 
33
- def email_verified?(account)
34
- identifier = StandardId::EmailIdentifier.find_by(value: account.email)
42
+ def email_verified?(email)
43
+ identifier = StandardId::EmailIdentifier.find_by(value: email)
35
44
  identifier&.verified_at.present?
36
45
  end
37
46
  end
@@ -1,3 +1,3 @@
1
1
  module StandardId
2
- VERSION = "0.66.0"
2
+ VERSION = "0.66.1"
3
3
  end
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.66.0
4
+ version: 0.66.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rarebit One