File tree Expand file tree Collapse file tree
app/controllers/doorkeeper/openid_connect Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/.bundle
2+ /vendor /bundle
23/Gemfile.lock
34/spec /dummy /db /* .sqlite3 *
45/spec /dummy /db /migrate /* doorkeeper_openid_connect *
Original file line number Diff line number Diff line change 44- [ #230 ] Add dynamic client registration
55- [ #233 ] fix: handle DoubleRenderError in library instead of requiring consumer workaround
66- [ #232 ] Implements customizable OpenID request class
7+ - [ #236 ] Derive token_endpoint_auth_methods_supported from Doorkeeper's client_credentials config
78
89## v1.8.11 (2025-02-10)
910
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def provider_response
4747 # TODO: look into doorkeeper-jwt_assertion for these
4848 # 'client_secret_jwt',
4949 # 'private_key_jwt'
50- token_endpoint_auth_methods_supported : %w[ client_secret_basic client_secret_post ] ,
50+ token_endpoint_auth_methods_supported : token_endpoint_auth_methods_supported ( doorkeeper ) ,
5151
5252 subject_types_supported : openid_connect . subject_types_supported ,
5353
@@ -79,6 +79,11 @@ def response_modes_supported(doorkeeper)
7979 doorkeeper . authorization_response_flows . flat_map ( &:response_mode_matches ) . uniq
8080 end
8181
82+ def token_endpoint_auth_methods_supported ( doorkeeper )
83+ mapping = { from_basic : 'client_secret_basic' , from_params : 'client_secret_post' }
84+ doorkeeper . client_credentials_methods . filter_map { |method | mapping [ method ] }
85+ end
86+
8287 def code_challenge_methods_supported ( doorkeeper )
8388 return unless doorkeeper . access_grant_model . pkce_supported?
8489
Original file line number Diff line number Diff line change 158158 end
159159 end
160160
161+ context 'when client_credentials is configured with only from_basic' do
162+ before { Doorkeeper . configure { client_credentials :from_basic } }
163+
164+ it 'returns only client_secret_basic in token_endpoint_auth_methods_supported' do
165+ get :provider
166+ data = JSON . parse ( response . body )
167+
168+ expect ( data [ 'token_endpoint_auth_methods_supported' ] ) . to eq %w[ client_secret_basic ]
169+ end
170+ end
171+
172+ context 'when client_credentials is configured with only from_params' do
173+ before { Doorkeeper . configure { client_credentials :from_params } }
174+
175+ it 'returns only client_secret_post in token_endpoint_auth_methods_supported' do
176+ get :provider
177+ data = JSON . parse ( response . body )
178+
179+ expect ( data [ 'token_endpoint_auth_methods_supported' ] ) . to eq %w[ client_secret_post ]
180+ end
181+ end
182+
183+ context 'when client_credentials is configured with both from_basic and from_params' do
184+ before { Doorkeeper . configure { client_credentials :from_basic , :from_params } }
185+
186+ it 'returns both client_secret_basic and client_secret_post in token_endpoint_auth_methods_supported' do
187+ get :provider
188+ data = JSON . parse ( response . body )
189+
190+ expect ( data [ 'token_endpoint_auth_methods_supported' ] ) . to eq %w[ client_secret_basic client_secret_post ]
191+ end
192+ end
193+
161194 context 'when grant_flows is configed with authorization_code and implicit flow' do
162195 before { Doorkeeper . configure { grant_flows %w[ authorization_code implicit_oidc ] } }
163196
You can’t perform that action at this time.
0 commit comments