Skip to content

Commit 1be7a08

Browse files
authored
Merge pull request #256 from 55728/fix/protocol-callable-check
Accept non-callable values for the `protocol` config option
2 parents 22654c4 + 5208d83 commit 1be7a08

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [#248] Fix `max_age` always triggering reauthentication when `auth_time_from_resource_owner` returns Integer
88
- [#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`)
99
- [#252] Treat `auth_time_from_resource_owner` as optional in `IdToken` — omit `auth_time` claim when unconfigured instead of raising `InvalidConfiguration`
10+
- [#256] Accept non-callable values (symbol / string) for the `protocol` config option, matching the pattern used by `issuer` / `signing_algorithm` / `signing_key` / `expiration`
1011

1112
## v1.9.0 (2026-03-16)
1213

app/controllers/doorkeeper/openid_connect/discovery_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def keys_response
116116
end
117117

118118
def protocol
119-
Doorkeeper::OpenidConnect.configuration.protocol.call
119+
configured = Doorkeeper::OpenidConnect.configuration.protocol
120+
configured.respond_to?(:call) ? configured.call : configured
120121
end
121122

122123
def discovery_url_options

spec/controllers/discovery_controller_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,32 @@
270270
expect(data['authorization_endpoint']).to eq 'testing://test.host/oauth/authorize'
271271
end
272272

273+
context 'when the protocol option is configured with a non-callable value' do
274+
it 'accepts a symbol' do
275+
Doorkeeper::OpenidConnect.configure do
276+
protocol :testing
277+
end
278+
279+
get :provider
280+
data = JSON.parse(response.body)
281+
282+
expect(response).to have_http_status(:ok)
283+
expect(data['authorization_endpoint']).to eq 'testing://test.host/oauth/authorize'
284+
end
285+
286+
it 'accepts a string' do
287+
Doorkeeper::OpenidConnect.configure do
288+
protocol 'testing'
289+
end
290+
291+
get :provider
292+
data = JSON.parse(response.body)
293+
294+
expect(response).to have_http_status(:ok)
295+
expect(data['authorization_endpoint']).to eq 'testing://test.host/oauth/authorize'
296+
end
297+
end
298+
273299
context 'when the discovery_url_options option is set for all endpoints' do
274300
before do
275301
Doorkeeper::OpenidConnect.configure do

0 commit comments

Comments
 (0)