nov-doorkeeper-openid_connect 1.10.2

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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +380 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +117 -0
  5. data/app/controllers/concerns/doorkeeper/openid_connect/authorizations_extension.rb +13 -0
  6. data/app/controllers/doorkeeper/openid_connect/discovery_controller.rb +132 -0
  7. data/app/controllers/doorkeeper/openid_connect/dynamic_client_registration_controller.rb +85 -0
  8. data/app/controllers/doorkeeper/openid_connect/userinfo_controller.rb +13 -0
  9. data/config/locales/en.yml +28 -0
  10. data/lib/doorkeeper/oauth/id_token_request.rb +37 -0
  11. data/lib/doorkeeper/oauth/id_token_response.rb +33 -0
  12. data/lib/doorkeeper/oauth/id_token_token_request.rb +15 -0
  13. data/lib/doorkeeper/oauth/id_token_token_response.rb +15 -0
  14. data/lib/doorkeeper/openid_connect/claims/aggregated_claim.rb +11 -0
  15. data/lib/doorkeeper/openid_connect/claims/claim.rb +49 -0
  16. data/lib/doorkeeper/openid_connect/claims/distributed_claim.rb +11 -0
  17. data/lib/doorkeeper/openid_connect/claims/normal_claim.rb +20 -0
  18. data/lib/doorkeeper/openid_connect/claims_builder.rb +40 -0
  19. data/lib/doorkeeper/openid_connect/config.rb +108 -0
  20. data/lib/doorkeeper/openid_connect/engine.rb +15 -0
  21. data/lib/doorkeeper/openid_connect/errors.rb +45 -0
  22. data/lib/doorkeeper/openid_connect/grant_types_supported_mixin.rb +13 -0
  23. data/lib/doorkeeper/openid_connect/helpers/controller.rb +294 -0
  24. data/lib/doorkeeper/openid_connect/id_token.rb +109 -0
  25. data/lib/doorkeeper/openid_connect/id_token_token.rb +42 -0
  26. data/lib/doorkeeper/openid_connect/oauth/authorization/code.rb +39 -0
  27. data/lib/doorkeeper/openid_connect/oauth/authorization_code_request.rb +26 -0
  28. data/lib/doorkeeper/openid_connect/oauth/dynamic_registration_request.rb +108 -0
  29. data/lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb +35 -0
  30. data/lib/doorkeeper/openid_connect/oauth/pre_authorization.rb +30 -0
  31. data/lib/doorkeeper/openid_connect/oauth/token_response.rb +25 -0
  32. data/lib/doorkeeper/openid_connect/orm/active_record/access_grant.rb +17 -0
  33. data/lib/doorkeeper/openid_connect/orm/active_record/mixins/openid_request.rb +43 -0
  34. data/lib/doorkeeper/openid_connect/orm/active_record/request.rb +11 -0
  35. data/lib/doorkeeper/openid_connect/orm/active_record.rb +54 -0
  36. data/lib/doorkeeper/openid_connect/rails/routes/mapper.rb +32 -0
  37. data/lib/doorkeeper/openid_connect/rails/routes/mapping.rb +40 -0
  38. data/lib/doorkeeper/openid_connect/rails/routes.rb +82 -0
  39. data/lib/doorkeeper/openid_connect/token_endpoint_auth_methods_supported_mixin.rb +18 -0
  40. data/lib/doorkeeper/openid_connect/user_info.rb +40 -0
  41. data/lib/doorkeeper/openid_connect/version.rb +13 -0
  42. data/lib/doorkeeper/openid_connect.rb +178 -0
  43. data/lib/doorkeeper/request/id_token.rb +19 -0
  44. data/lib/doorkeeper/request/id_token_token.rb +19 -0
  45. data/lib/generators/doorkeeper/openid_connect/install_generator.rb +18 -0
  46. data/lib/generators/doorkeeper/openid_connect/migration_generator.rb +33 -0
  47. data/lib/generators/doorkeeper/openid_connect/templates/initializer.rb +136 -0
  48. data/lib/generators/doorkeeper/openid_connect/templates/migration.rb.erb +15 -0
  49. metadata +258 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0f00bcea0c3989cfb705845e15aa74cc87ca6727af7ee7e7c51886fd591245a4
4
+ data.tar.gz: bd0dae8c7d5b8a24723397627a41ea23ef68c2c2730c12b7ce399affd19a03a7
5
+ SHA512:
6
+ metadata.gz: f37aae11219f954fc6b53d081f92edb2d8d207cf1492dccd02158b77efecf0ed1285544c837c8a701498b0e3759aa2d2468901ff0676f87b2b1fff9945a39a63
7
+ data.tar.gz: a090fe8d79d4c423bd40ee72f17c73b1e4cef08243e68aab77efc3bac7130d8a5568d549892cc324fbef5513a433715b0f85b6b1e97aefe96add5895e486d5e0
data/CHANGELOG.md ADDED
@@ -0,0 +1,380 @@
1
+ ## Unreleased
2
+
3
+ - Please add here
4
+
5
+ ## v1.10.2 (2026-06-22)
6
+
7
+ - [#315] Drop support for EOL Ruby 3.1 (EOL 2025-03-25) and require Ruby `>= 3.2`. `i18n 1.15.0` uses the `Fiber[]` storage API which only exists on Ruby 3.2+, so the Ruby 3.1 CI row no longer loads; the matrix now tests Ruby 3.2 as the minimum
8
+ - [#316] Set `fail-fast: false` in CI matrix so a single failing job no longer cancels the rest
9
+ - [#303] execute account selection even without owner, and `select_account_for_resource_owner` can now receive `nil` as the first argument.
10
+ - [#304] allow handle auth_time per grant
11
+ - [#305] Document the `auth_time_from_access_token` config option in the README (per-grant `auth_time`), clarifying that it only affects the ID Token `auth_time` claim and not `max_age` enforcement
12
+ - [#307] Fix `bundle exec rake server` for the test application
13
+ - [#313] Move Configuration documentation from README to Wiki
14
+ - [#312] Raise `Errors::MissingRequiredClaim` instead of silently dropping a blank REQUIRED ID Token claim (`iss`/`sub`/`aud`/`exp`/`iat`) in `IdToken#as_json`, which previously could emit a non-conformant ID Token (OIDC Core 1.0 §2). OPTIONAL claims such as `nonce`/`auth_time` are still omitted when blank
15
+ - [#311] Include the REQUIRED `client_secret_expires_at` member (value `0`, never expires) in the Dynamic Client Registration response whenever a `client_secret` is issued (RFC 7591 §3.2.1 / OpenID Connect Dynamic Client Registration 1.0 §3.2)
16
+ - [#309] Add a browser dashboard to the test application (`spec/dummy`) for exercising the OpenID Connect endpoints by hand — replacing the rails console + curl workflow with forms for Setup, Discovery, Authorization (code / implicit / PKCE / nonce / prompt / `max_age`), token exchange, UserInfo, introspection and revocation
17
+ - [#308] Fix `NameError: uninitialized constant Auth::ApplicationRecord` on boot when using a namespaced custom access grant model (e.g. `Auth::OAuthAccessGrant < ApplicationRecord`). Since v1.10.0 ([#241]) the `openid_request` association was wired inside an `ActiveSupport.on_load(:active_record)` block, which fires while `ActiveRecord::Base` is first loaded and constantizes the grant model too early. The association is now added from Doorkeeper's `AccessGrant` mixin `included` callback — at the model's own load time, without constantizing — mirroring the fix doorkeeper made in [#1830](https://github.com/doorkeeper-gem/doorkeeper/pull/1830) ([#306](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/issues/306))
18
+
19
+ ## v1.10.1 (2026-06-03)
20
+
21
+ - [#294] Drop stale `Metrics/ClassLength` and `Metrics/BlockLength` overrides from `.rubocop_todo.yml`
22
+ - [#293] Drop `Naming/VariableNumber` from `.rubocop_todo.yml` and normalise test variable names
23
+ - [#291] Document multi-namespace mount pattern for multiple resource owner models ([#192](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/issues/192))
24
+ - [#292] Drop formatting cops from `.rubocop_todo.yml` and align trailing-comma style with upstream doorkeeper
25
+ - [#296] Fix the `prompt` parameter being rejected with `invalid_request` when it contains leading or duplicate spaces (e.g. `prompt=%20none`) — blank entries in the space-delimited value are now ignored
26
+ - [#299] Raise `InvalidConfiguration` when the `issuer` config resolves to a blank value instead of silently advertising an empty `issuer` in the discovery document. Since v1.10.0 an arity-2 `issuer` block receives `(resource_owner, application)` — both `nil` in the discovery context — so a block relying on the old v1.9.0 request argument could return `nil` and produce a discovery `issuer` that mismatched the ID token `iss` ([#298](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/issues/298))
27
+
28
+ ## v1.10.0 (2026-06-01)
29
+
30
+ >[!IMPORTANT]
31
+ >
32
+ >- **Breaking (arity-2 issuer blocks):** `resolve_issuer` now dispatches arity-2 blocks with `(resource_owner, application)` in all contexts, including discovery. In v1.9.0 `DiscoveryController` passed `request` as the first argument; existing arity-2 blocks that relied on this receive `(nil, nil)` in v1.10.0 and should migrate to arity-3 — see [#298](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/issues/298) for details and migration examples
33
+
34
+ - [#241] Fix NameError on doorkeeper master by deferring AR model loading in run_hooks (see [Doorkeeper PR](https://github.com/doorkeeper-gem/doorkeeper/pull/1804))
35
+ - [#242] Fix `NoMethodError` for openid_request in testing environments.
36
+ - [#246] Fix `at_hash` to use correct hash algorithm based on `signing_algorithm`
37
+ - [#250] Return configured `issuer` instead of `root_url` in WebFinger response (thanks to @sato11 for the original work in #172)
38
+ - [#248] Fix `max_age` always triggering reauthentication when `auth_time_from_resource_owner` returns Integer
39
+ - [#254] **Breaking:** Omit `expires_in` from the `response_type=id_token` response (OIDC Core §3.2.2.5 — `expires_in` represents the Access Token lifetime; it is still returned for `response_type=id_token token`)
40
+ - [#252] Treat `auth_time_from_resource_owner` as optional in `IdToken` — omit `auth_time` claim when unconfigured instead of raising `InvalidConfiguration`
41
+ - [#256] Accept non-callable values (symbol / string) for the `protocol` config option, matching the pattern used by `issuer` / `signing_algorithm` / `signing_key` / `expiration`
42
+ - [#258] Skip `IdToken` construction on password grants without the `openid` scope
43
+ - [#259] Skip `IdToken` construction on authorization code grants without the `openid` scope
44
+ - [#261] Fix obsolete RuboCop configuration (`require:` → `plugins:`, `RSpec/FilePath` split, remove `Capybara/FeatureMethods`)
45
+ - [#263] **Security/Breaking:** Determine dynamically registered client's `confidential` flag from `token_endpoint_auth_method` per RFC 7591 — previously every dynamically registered client was created as public (`confidential: false`), which let callers authenticate with only `client_id` (`by_uid_and_secret(uid, nil)` bypass). Default is now `client_secret_basic` (confidential); `none` produces a public client; unsupported values (e.g. `private_key_jwt`) are rejected with `invalid_client_metadata`. Also derive `token_endpoint_auth_methods_supported` in the response from `Doorkeeper.configuration.client_credentials_methods` instead of a hardcoded list, matching #236
46
+ - [#264] Apply safe RuboCop autocorrections and fix resulting artifacts
47
+ - [#265] Add Dynamic Client Registration section to README
48
+ - [#266] Validate `application_type`, `response_types`, and `grant_types` parameters in dynamic client registration per RFC 7591 — reject unsupported values with `invalid_client_metadata` and echo the requested values back in the registration response, instead of silently ignoring them and returning the server's global configuration
49
+ - [#267] Add `authorize_dynamic_client_registration` config option to gate the dynamic client registration endpoint per RFC 7591 §3.1 — when set to a callable, the block is evaluated in the controller scope (with access to `request`, `params`, `request.headers`, etc.) and falsy return values reject the request with `401 invalid_token`. Default is `nil` so the endpoint remains open for backward compatibility; consumers should configure this to validate an Initial Access Token (or any other authorization scheme) before allowing client registration
50
+ - [#268] Update Dynamic Client Registration README for validated metadata parameters
51
+ - [#269] Document `authorize_dynamic_client_registration` in README
52
+ - [#270] Document the unified issuer block signature in README
53
+ - [#278] Test against Ruby 4.0.
54
+ - [#271] **Security:** Add `auth_time_from_session` config for per-session `max_age` enforcement. The legacy `auth_time_from_resource_owner` cannot distinguish between concurrent sessions and is now deprecated for `max_age` use (see [#150](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/issues/150))
55
+ - [#272] Document `auth_time_from_session` in README (follow-up to [#271](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/pull/271))
56
+ - [#273] **Security/Hardening:** Merge framework-controlled registered claims last — `iss`/`sub`/`aud`/`exp`/`iat`/`nonce`/`auth_time` for the ID Token and `sub` for UserInfo — so a custom claim block can no longer override security-critical values. No legitimate configuration relied on this; custom claims that intentionally shadowed a registered claim name will now be ignored for that key (OIDC Core §2 / §3.1.3.7 / §5.3.2).
57
+ - [#276] Get RuboCop to zero offenses: fix `Lint/MissingSuper` in `IdTokenResponse`, replace `puts` with `warn` for deprecation notices, and modernise spec style
58
+ - [#277] Fix README inaccuracies (`signing_algorithm` description and link, `discovery_url_options` endpoint list, `oauth-authorization-server` route) and use constant-time comparison in the DCR authorization example to prevent timing attacks on the Initial Access Token
59
+ - [#279] Return `account_selection_required` when a `prompt=select_account` handler does not generate a response, per [OIDC Core 1.0 §3.1.2.6](https://openid.net/specs/openid-connect-core-1_0.html#AuthError) — previously the authorization silently continued without account selection. Adds the missing `Errors::AccountSelectionRequired` class, mirroring the existing `login_required` backstop for `reauthenticate_resource_owner`
60
+ - [#275] Return `login_required` for `max_age` reauthentication when `prompt=none`, instead of triggering the interactive `reauthenticate_resource_owner` flow (OIDC Core §3.1.2.1)
61
+ - [#284] Document `acr` / `amr` claims in README — show how to expose Authentication Context Class Reference and Authentication Methods References via the `claim` DSL, with callouts for the `response:` and `scope:` defaults that silently bite
62
+ - [#288] Document `offline_access` scope recipe in README — show how to wire `use_refresh_token` with scope-based filtering for OIDC offline access
63
+ - [#281] Fix `NoMethodError` / `DoubleRenderError` when `resource_owner_authenticator` redirects with a truthy non-model value (e.g. `current_user || redirect_to(login_url)`). Normalize the leaked value to `nil` when `performed?` and add missing `if owner` guard on `select_account`.
64
+ - [#285] Document custom `jwks_uri` path pattern in README — show how to advertise a non-default path in the discovery document using Rails' `direct` URL helper
65
+ - [#283] Support multiple signing keys in the JWKS response — `signing_key` now also accepts an array (and callables returning an array). The first entry is the active key used to sign new ID tokens; the remaining entries are published in the JWKS so clients can still validate tokens signed with a retired key during a rotation window. Single-value and callable forms continue to work unchanged
66
+ - [#286] Allow claims to be assigned to multiple scopes via `scope: [:profile, :all_data]` — the claim is returned whenever the access token grants any of the listed scopes. **Note:** the previously implicit `Claim#scope=` writer (from `attr_accessor :scope`) is no longer provided; rebuild the claim instead of mutating it
67
+ - [#287] Add `apply_prompt_to_non_oidc_requests` option to honor the `prompt` parameter on plain OAuth requests that do not include the `openid` scope
68
+ - [#282] Allow `prompt=none` reauthorization with a narrower subset of previously-granted scopes (issue #63). Per RFC 6749 §1.5, narrower-or-equal scopes do not require fresh user consent; previously these requests returned `consent_required`.
69
+ - [#290] Freeze `Claim#scopes` and `Claim#response` arrays at construction so callers can't accidentally mutate the claim's internal state from outside
70
+ - [#297] Fix the generated initializer's `issuer` example referencing an undefined `request` local (the block parameter is `_request`), which raised `NameError` when copied verbatim
71
+
72
+ ## v1.9.0 (2026-03-16)
73
+
74
+ - [#229] Allow to application manage signing key and algorithm
75
+ - [#230] Add dynamic client registration
76
+ - [#233] fix: handle `DoubleRenderError` in library instead of requiring consumer workaround
77
+ - [#232] Implements customizable OpenID request class
78
+ - [#236] Derive `token_endpoint_auth_methods_supported` from Doorkeeper's client_credentials config
79
+ - [#225] Allow configuration of id_token expiration using a block.
80
+ - [#237] Fix dynamic client registration returning hashed secret when `hash_application_secrets` is enabled
81
+ - [#226] Respect Doorkeeper's configured `pkce_code_challenge_methods`
82
+
83
+ ## v1.8.11 (2025-02-10)
84
+
85
+ - [#219] Test against Ruby 3.4.
86
+ - [#216] Test against Rails 7.1, 7.2, 8.0.
87
+ - [#222] Support max_age=0
88
+ - [#221] Avoid raising invalid_request error on prompt=create
89
+ - [#220] Define priority on possible prompt values to statically & successfully process multiple prompt values
90
+ - [#224] Define priority between max_age & prompt
91
+
92
+ ## v1.8.10 (2024-11-29)
93
+
94
+ - [#215] Drop support for Ruby 2.7, 3.0 and Rails 6.
95
+ - [#209] Configuration per IdToken expiration (thanks to @martinezcoder)
96
+
97
+ ## v1.8.9 (2024-05-07)
98
+
99
+ - Support Doorkeeper 5.7
100
+
101
+ ## v1.8.8 (2024-02-26)
102
+
103
+ - [#201] Add back typ=JWT to header
104
+
105
+ ## v1.8.7 (2023-05-18)
106
+
107
+ - [#198] Fully qualify `JWT::JWK::Thumbprint` constant with :: (thanks to @stanhu)
108
+
109
+ ## v1.8.6 (2023-05-12)
110
+
111
+ - [#194] Default to RFC 7638 kid fingerprint generation (thanks to @stanhu).
112
+
113
+ ## v1.8.5 (2023-02-02)
114
+
115
+ - [#186] Simplify gem configuration reusing Doorkeeper configuration option DSL (thanks to @nbulaj).
116
+ - [#182] Drop support for Ruby 2.6 and Rails 5 (thanks to @sato11).
117
+ - [#188] Fix dookeeper-jwt compatibility (thanks to @zavan).
118
+
119
+ ## v1.8.4 (2023-02-01)
120
+
121
+ Note that v1.8.4 changed the default kid fingerprint generation from RFC 7638 to a format
122
+ based on the SHA256 digest of the key element. To restore the previous behavior, upgrade to v1.8.6.
123
+
124
+ - [#177] Replace `json-jwt` with `ruby-jwt` to align with doorkeeper-jwt (thanks to @kristof-mattei).
125
+ - [#185] Don't call active_record_options for Doorkeeper >= 5.6.3 (thanks to @zavan).
126
+ - [#183] Stop render consent screen when user is not logged-in (thanks to @nov).
127
+
128
+ ## v1.8.3 (2022-12-02)
129
+
130
+ - [#180] Add PKCE support to OpenID discovery endpoint (thanks to @stanhu).
131
+
132
+ ## v1.8.2 (2022-07-13)
133
+
134
+ - [#168] Allow to use custom doorkeeper access grant model (thanks @nov).
135
+ - [#170] Controllers inherit `Doorkeeper::AppliactionMetalController` (thanks @sato11).
136
+ - [#171] Correctly override `AuthorizationsController` params (thanks to @nbulaj).
137
+
138
+ ## v1.8.1 (2022-02-09)
139
+
140
+ - [#153] Fix ArgumentError caused by client credential validation introduced in Doorkeeper 5.5.1 (thanks to @CircumnavigatingFlatEarther)
141
+ - [#161] Fix .well-known/openid-connect issuer (respond to block if provided) (thanks to @fkowal).
142
+ - [#152] Expose oauth-authorization-server in routes (thanks to @mitar)
143
+
144
+ ## v1.8.0 (2021-05-11)
145
+
146
+ No changes from v1.8.0-rc1.
147
+
148
+ ## v1.8.0-rc1 (2021-04-20)
149
+
150
+ ### Upgrading
151
+
152
+ This gem now requires Doorkeeper 5.5 and Ruby 2.5.
153
+
154
+ ### Changes
155
+
156
+ - [#138] Support form_post response mode (thanks to @linhdangduy)
157
+ - [#144] Support block syntax for `issuer` configuration (thanks to @maxxsnake)
158
+ - [#145] Register token flows with the strategy instead of the token class (thanks to @paukul)
159
+
160
+ ## v1.7.5 (2020-12-15)
161
+
162
+ ### Changes
163
+
164
+ - [#126] Add discovery_url_options option for discovery endpoints URL generation (thanks to @phlegx)
165
+
166
+ ### Bugfixes
167
+
168
+ - [#123] Remove reference to ApplicationRecord (thanks to @wheeyls)
169
+ - [#124] Clone doorkeeper.grant_flows array before appending 'refresh_token' (thanks to @davidbasalla)
170
+ - [#129] Avoid to use the config alias while supporting Doorkeeper 5.2 (thanks to @kymmt90)
171
+
172
+ ## v1.7.4 (2020-07-06)
173
+
174
+ - [#119] Execute end_session_endpoint in the controllers context (thanks to @joeljunstrom)
175
+
176
+ ## v1.7.3 (2020-07-06)
177
+
178
+ - [#111] Add configuration callback `select_account_for_resource_owner` to support the `prompt=select_account` param
179
+ - [#112] Add grant_types_supported to discovery response
180
+ - [#114] Fix user_info endpoint when used in api mode
181
+ - [#116] Support Doorkeeper API (> 5.4) for registering custom grant flows.
182
+ - [#117] Fix migration template to use Rails migrations DSL for association.
183
+ - [#118] Use fragment urls for implicit flow error redirects (thanks to @joeljunstrom)
184
+
185
+ ## v1.7.2 (2020-05-20)
186
+
187
+ ### Changes
188
+
189
+ - [#108] Add support for Doorkeeper 5.4
190
+ - [#103] Add support for end_session_endpoint
191
+ - [#109] Test against Ruby 2.7 & Rails 6.x
192
+
193
+ ## v1.7.1 (2020-02-07)
194
+
195
+ ### Upgrading
196
+
197
+ This version adds `on_delete: :cascade` to the migration template for the `oauth_openid_requests` table, in order to fix #82.
198
+
199
+ For existing installations, you should add a new migration in your application to drop the existing foreign key and replace it with a new one with `on_delete: :cascade` included. Depending on the database you're using and the size of your application this might bring up some concerns, but in most cases the following should be sufficient:
200
+
201
+ ```ruby
202
+ class UpdateOauthOpenIdRequestsForeignKeys < ActiveRecord::Migration[5.2]
203
+ def up
204
+ remove_foreign_key(:oauth_openid_requests, column: :access_grant_id)
205
+ add_foreign_key(:oauth_openid_requests, :oauth_access_grants, column: :access_grant_id, on_delete: :cascade)
206
+ end
207
+
208
+ def down
209
+ remove_foreign_key(:oauth_openid_requests, column: :access_grant_id)
210
+ add_foreign_key(:oauth_openid_requests, :oauth_access_grants, column: :access_grant_id)
211
+ end
212
+ end
213
+ ```
214
+
215
+ ### Bugfixes
216
+
217
+ - [#96] Bump `json-jwt` because of CVE-2019-18848 (thanks to @leleabhinav)
218
+ - [#97] Fixes for compatibility with Doorkeeper 5.2 (thanks to @linhdangduy)
219
+ - [#98] Cascade deletes from `oauth_openid_requests` to `oauth_access_grants` (thanks to @manojmj92)
220
+ - [#99] Fix `audience` claim when application is not set on access token (thanks to @ionut998)
221
+
222
+ ## v1.7.0 (2019-11-04)
223
+
224
+ ### Changes
225
+
226
+ - [#85] This gem now requires Doorkeeper 5.2, Rails 5, and Ruby 2.4
227
+
228
+ ## v1.6.3 (2019-09-24)
229
+
230
+ ### Changes
231
+
232
+ - [#81] Allow silent authentication without user consent (thanks to @jarosan)
233
+ - Don't support Doorkeeper >= 5.2 due to breaking changes
234
+
235
+ ## v1.6.2 (2019-08-09)
236
+
237
+ ### Bugfixes
238
+
239
+ - [#80] Check for client presence in controller, fixes a 500 error when `client_id` is missing (thanks to @cincospenguinos @urnf @isabellechalhoub)
240
+
241
+ ## v1.6.1 (2019-06-07)
242
+
243
+ ### Bugfixes
244
+
245
+ - [#75] Fix return value for `after_successful_response` (thanks to @daveed)
246
+
247
+ ### Changes
248
+
249
+ - [#72] Add `revocation_endpoint` and `introspection_endpoint` to discovery response (thanks to @scarfacedeb)
250
+
251
+ ## v1.6.0 (2019-03-06)
252
+
253
+ ### Changes
254
+
255
+ - [#70] This gem now requires Doorkeeper 5.0, and actually has done so since v1.5.4 (thanks to @michaelglass)
256
+
257
+ ## v1.5.5 (2019-03-03)
258
+
259
+ - [#69] Return `crv` parameter for EC keys (thanks to @marco-nicola)
260
+
261
+ ## v1.5.4 (2019-02-15)
262
+
263
+ ### Bugfixes
264
+
265
+ - [#66] Fix an open redirect vulnerability ([CVE-2019-9837](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-9837), thanks to @meagar)
266
+ - [#67] Don't delete existing tokens with `prompt=consent` (thanks to @nov)
267
+
268
+ ### Changes
269
+
270
+ - [#62] Support customization of redirect params in `id_token` and `id_token token` responses (thanks to @meagar)
271
+
272
+ ## v1.5.3 (2019-01-19)
273
+
274
+ ### Bugfixes
275
+
276
+ - [#60] Don't break native authorization in Doorkeeper 5.x
277
+
278
+ ### Changes
279
+
280
+ - [#58] Use versioned migrations for Rails 5.x (thanks to @tvongaza)
281
+
282
+ ## v1.5.2 (2018-09-04)
283
+
284
+ ### Changes
285
+
286
+ - [#56] The previous release was a bit premature, this fixes some compatibility issues with Doorkeeper 5.x
287
+
288
+ ## v1.5.1 (2018-09-04)
289
+
290
+ ### Changes
291
+
292
+ - [#55] This gem is now compatible with Doorkeeper 5.x
293
+
294
+ ## v1.5.0 (2018-06-27)
295
+
296
+ ### Features
297
+
298
+ - [#52] Custom claims can now also be returned directly in the ID token, see the updated README for usage instructions
299
+
300
+ ## v1.4.0 (2018-05-31)
301
+
302
+ ### Upgrading
303
+
304
+ - Support for Ruby versions older than 2.3 was dropped
305
+
306
+ ### Features
307
+
308
+ - Redirect errors per Section 3.1.2.6 of OpenID Connect 1.0 (by @ryands)
309
+ - Set `id_token` when it's nil in token response (it's used in `refresh_token` requests) (by @Miouge1)
310
+
311
+ ## v1.3.0 (2018-03-05)
312
+
313
+ ### Features
314
+
315
+ - Support for Implicit Flow (`response_type=id_token` and `response_type=id_token token`),
316
+ see the updated README for usage instructions (by @nashby, @nhance and @stevenvegt)
317
+
318
+ ## v1.2.0 (2017-08-31)
319
+
320
+ ### Upgrading
321
+
322
+ - The configuration setting `jws_private_key` was renamed to `signing_key`, you can still use the old name until it's removed in the next major release
323
+
324
+ ### Features
325
+
326
+ - Support for pairwise subject identifiers (by @travisofthenorth)
327
+ - Support for EC and HMAC signing algorithms (by @110y)
328
+ - Claims now receive an optional third `access_token` argument which allow you to dynamically adjust claim values based on the client's token (by @gigr)
329
+
330
+ ### Bugfixes
331
+
332
+ ## v1.1.2 (2017-01-18)
333
+
334
+ ### Bugfixes
335
+
336
+ - Fixes the `undefined local variable or method 'pre_auth'` error
337
+
338
+ ## v1.1.1 (2017-01-18)
339
+
340
+ #### Upgrading
341
+
342
+ - The configuration setting `jws_public_key` wasn't actually used, it's deprecated now and will be removed in the next major release
343
+ - The undocumented shorthand `to_proc` syntax for defining claims (`claim :user, &:name`) is not supported anymore
344
+
345
+ #### Features
346
+
347
+ - Claims now receive an optional second `scopes` argument which allow you to dynamically adjust claim values based on the requesting applications' scopes (by @nbibler)
348
+ - The `prompt` parameter values `login` and `consent` are now supported
349
+ - The configuration setting `protocol` was added (by @gigr)
350
+
351
+ #### Bugfixes
352
+
353
+ - Standard Claims are now mapped correctly to their default scopes (by @tylerhunt)
354
+ - Blank `nonce` parameters are now ignored
355
+
356
+ #### Changes
357
+
358
+ - `nil` values and empty strings are now removed from the UserInfo and IdToken responses
359
+ - Allow `json-jwt` dependency at ~> 1.6. (by @nbibler)
360
+ - Configuration blocks no longer internally use `instance_eval` which previously gave undocumented and unexpected `self` access to the caller (by @nbibler)
361
+
362
+ ## v1.1.0 (2016-11-30)
363
+
364
+ This release is a general clean-up and adds support for some advanced OpenID Connect features.
365
+
366
+ #### Upgrading
367
+
368
+ - This version adds a table to store temporary nonces, use the generator `doorkeeper:openid_connect:migration` to create a migration
369
+ - Implement the new configuration callbacks `auth_time_from_resource_owner` and `reauthenticate_resource_owner` to support advanced features
370
+
371
+ #### Features
372
+
373
+ - Add discovery endpoint ([a16caa8](/../../commit/a16caa8))
374
+ - Add webfinger and keys endpoints for discovery ([f70898b](/../../commit/f70898b))
375
+ - Add supported claims to discovery response ([1d8f9ea](/../../commit/1d8f9ea))
376
+ - Support prompt=none parameter ([c775d8b](/../../commit/c775d8b))
377
+ - Store and return nonces in IdToken responses ([d28ca8c](/../../commit/d28ca8c))
378
+ - Add generator for initializer ([80399fd](/../../commit/80399fd))
379
+ - Support max_age parameter ([aabe3aa](/../../commit/aabe3aa))
380
+ - Respect scope grants in UserInfo response ([25f2170](/../../commit/25f2170))
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014 PlayOn! Sports
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Doorkeeper::OpenidConnect
2
+
3
+ [![CI](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/actions/workflows/ci.yml/badge.svg)](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/actions/workflows/ci.yml)
4
+ [![Maintainability](https://qlty.sh/gh/doorkeeper-gem/projects/doorkeeper-openid_connect/maintainability.svg)](https://qlty.sh/gh/doorkeeper-gem/projects/doorkeeper-openid_connect)
5
+ [![Gem Version](https://badge.fury.io/rb/doorkeeper-openid_connect.svg)](https://rubygems.org/gems/doorkeeper-openid_connect)
6
+
7
+ This library implements an [OpenID Connect](http://openid.net/connect/) authentication provider for Rails applications on top of the [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper) OAuth 2.0 framework.
8
+
9
+ OpenID Connect is a single-sign-on and identity layer with a [growing list of server and client implementations](http://openid.net/developers/libraries/). If you're looking for a client in Ruby check out [omniauth_openid_connect](https://github.com/m0n9oose/omniauth_openid_connect/).
10
+
11
+ ## Table of Contents
12
+
13
+ - [Status](#status)
14
+ - [Known Issues](#known-issues)
15
+ - [Example Applications](#example-applications)
16
+ - [Installation](#installation)
17
+ - [Configuration](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Configuration)
18
+ - [Development](#development)
19
+ - [License](#license)
20
+ - [Sponsors](#sponsors)
21
+
22
+ ## Status
23
+
24
+ The following parts of [OpenID Connect Core 1.0](http://openid.net/specs/openid-connect-core-1_0.html) are currently supported:
25
+ - [Authentication using the Authorization Code Flow](http://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth)
26
+ - [Authentication using the Implicit Flow](http://openid.net/specs/openid-connect-core-1_0.html#ImplicitFlowAuth)
27
+ - [Requesting Claims using Scope Values](http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims)
28
+ - [UserInfo Endpoint](http://openid.net/specs/openid-connect-core-1_0.html#UserInfo)
29
+ - [Normal Claims](http://openid.net/specs/openid-connect-core-1_0.html#NormalClaims)
30
+ - [OAuth 2.0 Form Post Response Mode](https://openid.net/specs/oauth-v2-form-post-response-mode-1_0.html)
31
+ - [OAuth 2.0 Dynamic Client Registration Protocol](https://datatracker.ietf.org/doc/html/rfc7591)
32
+
33
+ In addition, we also support most of [OpenID Connect Discovery 1.0](http://openid.net/specs/openid-connect-discovery-1_0.html) for automatic configuration discovery.
34
+
35
+ Take a look at the [DiscoveryController](app/controllers/doorkeeper/openid_connect/discovery_controller.rb) for more details on supported features.
36
+
37
+ ### Known Issues
38
+
39
+ - Doorkeeper's API mode (`Doorkeeper.configuration.api_only`) is not properly supported yet
40
+
41
+ ### Example Applications
42
+
43
+ - [GitLab](https://gitlab.com/gitlab-org/gitlab-ce) ([original MR](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8018))
44
+ - [Testing app for this gem](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/tree/master/spec/dummy)
45
+
46
+ ## Installation
47
+
48
+ Make sure your application is already set up with [Doorkeeper](https://github.com/doorkeeper-gem/doorkeeper#installation).
49
+
50
+ Add this line to your application's `Gemfile` and run `bundle install`:
51
+
52
+ ```ruby
53
+ gem 'doorkeeper-openid_connect'
54
+ ```
55
+
56
+ Run the installation generator to update routes and create the initializer:
57
+
58
+ ```sh
59
+ rails generate doorkeeper:openid_connect:install
60
+ ```
61
+
62
+ Generate a migration for Active Record (other ORMs are currently not supported):
63
+
64
+ ```sh
65
+ rails generate doorkeeper:openid_connect:migration
66
+ rake db:migrate
67
+ ```
68
+
69
+ If you're upgrading from an earlier version, check [Migration from old versions](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Migration%E2%80%90from%E2%80%90old%E2%80%90versions)
70
+ wiki and [CHANGELOG.md](CHANGELOG.md) for upgrade instructions.
71
+
72
+ ## Configuration
73
+
74
+ See the [wiki](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Configuration) for detailed configuration instructions, including:
75
+
76
+ - [Scopes](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Scopes)
77
+ - [Claims](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Claims)
78
+ - [Routes](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Routes)
79
+ - [Nonces](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Nonces)
80
+ - [Internationalization (I18n)](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/I18n)
81
+ - [Dynamic Client Registration](https://github.com/doorkeeper-gem/doorkeeper-openid_connect/wiki/Dynamic-Client-Registration)
82
+
83
+ ## Development
84
+
85
+ Run `bundle install` to setup all development dependencies.
86
+
87
+ To run all specs:
88
+
89
+ ```sh
90
+ bundle exec rake spec
91
+ ```
92
+
93
+ To generate and run migrations in the test application:
94
+
95
+ ```sh
96
+ bundle exec rake migrate
97
+ ```
98
+
99
+ To run the local engine server:
100
+
101
+ ```sh
102
+ bundle exec rake server
103
+ ```
104
+
105
+ By default, the latest Rails version is used. To use a specific version run:
106
+
107
+ ```
108
+ rails=7.2 bundle update
109
+ ```
110
+
111
+ ## License
112
+
113
+ Doorkeeper::OpenidConnect is released under the [MIT License](http://www.opensource.org/licenses/MIT).
114
+
115
+ ## Sponsors
116
+
117
+ Initial development of this project was sponsored by [PlayOn! Sports](https://github.com/playon).
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Doorkeeper
4
+ module OpenidConnect
5
+ module AuthorizationsExtension
6
+ private
7
+
8
+ def pre_auth_param_fields
9
+ super.append(:nonce)
10
+ end
11
+ end
12
+ end
13
+ end