rodauth-oauth 1.7.0 → 1.7.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 +4 -4
- data/doc/release_notes/1_7_1.md +11 -0
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/new_oauth_application.html.erb +8 -1
- data/lib/generators/rodauth/oauth/templates/app/views/rodauth/oauth_application.html.erb +2 -0
- data/lib/rodauth/features/oauth_application_management.rb +19 -5
- data/lib/rodauth/features/oauth_authorize_base.rb +0 -5
- data/lib/rodauth/features/oauth_base.rb +2 -2
- data/lib/rodauth/features/oauth_pkce.rb +9 -2
- data/lib/rodauth/features/oauth_saml_bearer_grant.rb +1 -1
- data/lib/rodauth/features/oidc.rb +6 -6
- data/lib/rodauth/features/oidc_self_issued.rb +4 -4
- data/lib/rodauth/oauth/version.rb +1 -1
- data/locales/en.yml +2 -0
- data/locales/pt.yml +2 -0
- data/templates/new_oauth_application.str +1 -0
- data/templates/oauth_application.str +3 -1
- data/templates/token_endpoint_auth_method_field.str +11 -0
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d761a48ee8be007c6187f9ca5a5f0f0841bdca69e4073bec8dd2e5531b142f78
|
|
4
|
+
data.tar.gz: a2947b276b22823d0ba2bd0591afb39f94140809b13cdb5056adecc2941d16ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2ac23c7f202b800cb9ef6d9c0f51861dce374ddadb3b23d8d360abff304631b8752bd426fdb046cececccdf37b3c20253261bc2a2c4c047da4823f20f63b44f
|
|
7
|
+
data.tar.gz: 86461d2cbb0a16fe0d692d18fd1ce68ab7ef17d6a5051553ee6871904ee14236d0a0392dbb9d1a8c7881f63cc86e8b479efceafd2e75ca6290c0dcbd7073844a
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 1.7.1
|
|
2
|
+
|
|
3
|
+
## Improvements
|
|
4
|
+
|
|
5
|
+
* `oauth_application_management`: added `token_endpoint_auth_method` to the default supported fields
|
|
6
|
+
|
|
7
|
+
## Bugfixes
|
|
8
|
+
|
|
9
|
+
* `oauth_pkce`: authenticate client application using token endpoint auth method in endpoints other than the token endpoint (when the PKCE code is present).
|
|
10
|
+
* `oidc`: fixed signing/encryption alg fields exposed from the `"/.well-known/openid-configuration"` suched that overridden values from dependent features are taken into account (one consequence of that not happening was the `oidc_self_issued` feature not advertising *only* support for `RS256` in the mentioned fields).
|
|
11
|
+
* `oauth_saml_bearer_grant`: do not override, but add, `"urn:ietf:params:oauth:client-assertion-type:saml2-bearer"` as a supported `token_endpoint_auth_method` in the metadata payload.
|
data/lib/generators/rodauth/oauth/templates/app/views/rodauth/new_oauth_application.html.erb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<h2><%= rodauth.new_oauth_application_page_title %></h2>
|
|
2
2
|
<%= form_tag rodauth.oauth_applications_path, method: :post, class: "form-horizontal" do %>
|
|
3
3
|
<%= rodauth.field_error('scope') %>
|
|
4
|
+
<%= rodauth.field_error('token_endpoint_auth_method') %>
|
|
4
5
|
<div class="form-group">
|
|
5
6
|
<%= label_tag "name", rodauth.oauth_applications_name_label %>
|
|
6
7
|
<%= text_field_tag "name", rodauth.param('name'), class: "form-control#{' is-invalid' if rodauth.field_error('name')}" %>
|
|
@@ -38,9 +39,15 @@
|
|
|
38
39
|
<%= rodauth.field_error('jwks_uri') %>
|
|
39
40
|
</div>
|
|
40
41
|
<% end %>
|
|
42
|
+
<% rodauth.oauth_token_endpoint_auth_methods_supported.each do |auth_method| %>
|
|
43
|
+
<div class="form-check">
|
|
44
|
+
<%= check_box_tag "#{rodauth.oauth_application_token_endpoint_auth_method_param}[]", auth_method, false, id: auth_method, class: "form-check-input" %>
|
|
45
|
+
<%= auth_method %>
|
|
46
|
+
</div>
|
|
47
|
+
<% end %>
|
|
41
48
|
<% rodauth.oauth_application_scopes.each do |scope| %>
|
|
42
49
|
<div class="form-check">
|
|
43
|
-
<%= check_box_tag "
|
|
50
|
+
<%= check_box_tag "#{rodauth.oauth_application_scopes_param}[]", scope, false, id: scope, class: "form-check-input" %>
|
|
44
51
|
<%= scope %>
|
|
45
52
|
</div>
|
|
46
53
|
<% end %>
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
<dt><%= rodauth.oauth_applications_homepage_url_label %>: </dt>
|
|
9
9
|
<dd><%= oauth_application[rodauth.oauth_applications_homepage_url_column] %></dd>
|
|
10
10
|
<dt><%= rodauth.oauth_applications_client_type_label %>: </dt>
|
|
11
|
+
<dt><%= rodauth.oauth_applications_token_endpoint_auth_method_label %>: </dt>
|
|
12
|
+
<dd><%= oauth_application[rodauth.oauth_applications_token_endpoint_auth_method_column] %></dd>
|
|
11
13
|
<dd><%= rodauth.oauth_application_client_type_label(oauth_application) %></dd>
|
|
12
14
|
<dt><%= rodauth.oauth_applications_client_id_label %>: </dt>
|
|
13
15
|
<dd><%= oauth_application[rodauth.oauth_applications_client_id_column] %></dd>
|
|
@@ -21,7 +21,7 @@ module Rodauth
|
|
|
21
21
|
APPLICATION_REQUIRED_PARAMS = %w[name scopes homepage_url redirect_uri client_secret].freeze
|
|
22
22
|
auth_value_method :oauth_application_required_params, APPLICATION_REQUIRED_PARAMS
|
|
23
23
|
|
|
24
|
-
(APPLICATION_REQUIRED_PARAMS + %w[description client_id]).each do |param|
|
|
24
|
+
(APPLICATION_REQUIRED_PARAMS + %w[description client_id token_endpoint_auth_method]).each do |param|
|
|
25
25
|
auth_value_method :"oauth_application_#{param}_param", param
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -40,6 +40,7 @@ module Rodauth
|
|
|
40
40
|
translatable_method :oauth_applications_client_type_label, "Client Type"
|
|
41
41
|
translatable_method :oauth_applications_confidential_label, "Confidential"
|
|
42
42
|
translatable_method :oauth_applications_public_label, "Public"
|
|
43
|
+
translatable_method :oauth_applications_token_endpoint_auth_method_label, "Token Endpoint Authentication Methods"
|
|
43
44
|
|
|
44
45
|
%w[type token refresh_token expires_in revoked_at].each do |param|
|
|
45
46
|
translatable_method :"oauth_grants_#{param}_label", param.gsub("_", " ").capitalize
|
|
@@ -55,6 +56,7 @@ module Rodauth
|
|
|
55
56
|
auth_value_method :oauth_grants_per_page, 20
|
|
56
57
|
|
|
57
58
|
translatable_method :invalid_url_message, "Invalid URL"
|
|
59
|
+
translatable_method :oauth_invalid_token_endpoint_auth_method_message, "Invalid Token Endpoint Authentication Method"
|
|
58
60
|
translatable_method :null_error_message, "is not filled"
|
|
59
61
|
|
|
60
62
|
translatable_method :oauth_no_applications_text, "No oauth applications yet!"
|
|
@@ -174,12 +176,14 @@ module Rodauth
|
|
|
174
176
|
end
|
|
175
177
|
|
|
176
178
|
def validate_oauth_application_params
|
|
177
|
-
oauth_application_params
|
|
178
|
-
|
|
179
|
+
oauth_application_params # eager load and validate
|
|
180
|
+
request.params.each do |key, value|
|
|
181
|
+
case key
|
|
182
|
+
when oauth_application_homepage_url_param
|
|
179
183
|
|
|
180
184
|
set_field_error(key, invalid_url_message) unless check_valid_uri?(value)
|
|
181
185
|
|
|
182
|
-
|
|
186
|
+
when oauth_application_redirect_uri_param
|
|
183
187
|
|
|
184
188
|
if value.respond_to?(:each)
|
|
185
189
|
value.each do |uri|
|
|
@@ -190,11 +194,18 @@ module Rodauth
|
|
|
190
194
|
else
|
|
191
195
|
set_field_error(key, invalid_url_message) unless check_valid_no_fragment_uri?(value)
|
|
192
196
|
end
|
|
193
|
-
|
|
197
|
+
when oauth_application_scopes_param
|
|
194
198
|
|
|
195
199
|
value.each do |scope|
|
|
196
200
|
set_field_error(key, oauth_invalid_scope_message) unless oauth_application_scopes.include?(scope)
|
|
197
201
|
end
|
|
202
|
+
when oauth_application_token_endpoint_auth_method_param
|
|
203
|
+
value.each do |auth_method|
|
|
204
|
+
unless oauth_token_endpoint_auth_methods_supported.include?(auth_method)
|
|
205
|
+
set_field_error(key,
|
|
206
|
+
oauth_invalid_token_endpoint_auth_method_message)
|
|
207
|
+
end
|
|
208
|
+
end
|
|
198
209
|
end
|
|
199
210
|
end
|
|
200
211
|
|
|
@@ -210,6 +221,9 @@ module Rodauth
|
|
|
210
221
|
oauth_applications_homepage_url_column => oauth_application_params[oauth_application_homepage_url_param]
|
|
211
222
|
}
|
|
212
223
|
|
|
224
|
+
auth_methods = request.params.fetch(oauth_application_token_endpoint_auth_method_param, oauth_token_endpoint_auth_methods_supported)
|
|
225
|
+
create_params[oauth_applications_token_endpoint_auth_method_column] = auth_methods.join(oauth_scope_separator)
|
|
226
|
+
|
|
213
227
|
redirect_uris = oauth_application_params[oauth_application_redirect_uri_param]
|
|
214
228
|
redirect_uris = redirect_uris.to_a.reject(&:empty?).join(" ") if redirect_uris.respond_to?(:each)
|
|
215
229
|
create_params[oauth_applications_redirect_uri_column] = redirect_uris unless redirect_uris.empty?
|
|
@@ -30,7 +30,6 @@ module Rodauth
|
|
|
30
30
|
|
|
31
31
|
auth_methods(
|
|
32
32
|
:resource_owner_params,
|
|
33
|
-
:oauth_grants_resource_owner_columns,
|
|
34
33
|
:authorize_form_params
|
|
35
34
|
)
|
|
36
35
|
|
|
@@ -154,10 +153,6 @@ module Rodauth
|
|
|
154
153
|
{ oauth_grants_account_id_column => account_id }
|
|
155
154
|
end
|
|
156
155
|
|
|
157
|
-
def oauth_grants_resource_owner_columns
|
|
158
|
-
[oauth_grants_account_id_column]
|
|
159
|
-
end
|
|
160
|
-
|
|
161
156
|
def try_approval_prompt
|
|
162
157
|
approval_prompt = param_or_nil("approval_prompt")
|
|
163
158
|
|
|
@@ -441,13 +441,13 @@ module Rodauth
|
|
|
441
441
|
oauth_application
|
|
442
442
|
end
|
|
443
443
|
|
|
444
|
-
def supports_auth_method?(oauth_application, auth_method)
|
|
444
|
+
def supports_auth_method?(oauth_application, auth_method, default_supported_auth_methods = oauth_default_token_endpoint_auth_methods)
|
|
445
445
|
return false unless oauth_application
|
|
446
446
|
|
|
447
447
|
supported_auth_methods = if (auth_methods = oauth_application[oauth_applications_token_endpoint_auth_method_column])
|
|
448
448
|
auth_methods.split(/ +/)
|
|
449
449
|
else
|
|
450
|
-
|
|
450
|
+
default_supported_auth_methods
|
|
451
451
|
end
|
|
452
452
|
|
|
453
453
|
supported_auth_methods.include?(auth_method)
|
|
@@ -34,10 +34,17 @@ module Rodauth
|
|
|
34
34
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
|
+
# PKCE lets public clients redeem authorization codes without client credentials.
|
|
38
|
+
# The relaxation only applies to the authorization code grant, and not to applications which
|
|
39
|
+
# registered a token endpoint auth method other than "none" (RFC 6749 section 3.2.1).
|
|
37
40
|
def supports_auth_method?(oauth_application, auth_method)
|
|
38
|
-
return super unless auth_method == "none"
|
|
41
|
+
return super unless auth_method == "none" &&
|
|
42
|
+
# check if it's a /token request with PKCE params
|
|
43
|
+
request.path == token_path &&
|
|
44
|
+
request.params.key?("code_verifier") &&
|
|
45
|
+
param_or_nil("grant_type") == "authorization_code"
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
super(oauth_application, auth_method, %w[none])
|
|
41
48
|
end
|
|
42
49
|
|
|
43
50
|
def validate_authorize_params
|
|
@@ -138,7 +138,7 @@ module Rodauth
|
|
|
138
138
|
|
|
139
139
|
def oauth_server_metadata_body(*)
|
|
140
140
|
super.tap do |data|
|
|
141
|
-
data[:token_endpoint_auth_methods_supported]
|
|
141
|
+
data[:token_endpoint_auth_methods_supported] += %w[urn:ietf:params:oauth:client-assertion-type:saml2-bearer]
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
end
|
|
@@ -833,13 +833,13 @@ module Rodauth
|
|
|
833
833
|
id_token_encryption_alg_values_supported: oauth_jwt_jwe_algorithms_supported,
|
|
834
834
|
id_token_encryption_enc_values_supported: oauth_jwt_jwe_encryption_methods_supported,
|
|
835
835
|
|
|
836
|
-
userinfo_signing_alg_values_supported:
|
|
837
|
-
userinfo_encryption_alg_values_supported:
|
|
838
|
-
userinfo_encryption_enc_values_supported:
|
|
836
|
+
userinfo_signing_alg_values_supported: userinfo_signing_alg_values_supported,
|
|
837
|
+
userinfo_encryption_alg_values_supported: userinfo_encryption_alg_values_supported,
|
|
838
|
+
userinfo_encryption_enc_values_supported: userinfo_encryption_enc_values_supported,
|
|
839
839
|
|
|
840
|
-
request_object_signing_alg_values_supported:
|
|
841
|
-
request_object_encryption_alg_values_supported:
|
|
842
|
-
request_object_encryption_enc_values_supported:
|
|
840
|
+
request_object_signing_alg_values_supported: request_object_signing_alg_values_supported,
|
|
841
|
+
request_object_encryption_alg_values_supported: request_object_encryption_alg_values_supported,
|
|
842
|
+
request_object_encryption_enc_values_supported: request_object_encryption_enc_values_supported,
|
|
843
843
|
|
|
844
844
|
# These Claim Types are described in Section 5.6 of OpenID Connect Core 1.0 [OpenID.Core].
|
|
845
845
|
# Values defined by this specification are normal, aggregated, and distributed.
|
|
@@ -46,15 +46,15 @@ module Rodauth
|
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
def request_object_signing_alg_values_supported
|
|
50
|
+
%w[none RS256]
|
|
51
|
+
end
|
|
50
52
|
|
|
51
53
|
def oauth_response_types_supported
|
|
52
54
|
%w[id_token]
|
|
53
55
|
end
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
%w[none RS256]
|
|
57
|
-
end
|
|
57
|
+
private
|
|
58
58
|
|
|
59
59
|
def id_token_claims(oauth_grant, signing_algorithm)
|
|
60
60
|
claims = super
|
data/locales/en.yml
CHANGED
|
@@ -43,6 +43,7 @@ en:
|
|
|
43
43
|
oauth_applications_client_type_label: "Client Type"
|
|
44
44
|
oauth_applications_confidential_label: "Confidential"
|
|
45
45
|
oauth_applications_public_label: "Public"
|
|
46
|
+
oauth_applications_token_endpoint_auth_method_label: "Token Endpoint Authentication Method"
|
|
46
47
|
oauth_no_applications_text: "No oauth applications yet!"
|
|
47
48
|
oauth_grant_user_code_label: "User code"
|
|
48
49
|
oauth_grant_user_jws_jwk_label: "JSON Web Keys"
|
|
@@ -62,6 +63,7 @@ en:
|
|
|
62
63
|
oauth_invalid_grant_message: "Invalid grant"
|
|
63
64
|
oauth_invalid_scope_message: "Invalid scope"
|
|
64
65
|
invalid_url_message: "Invalid URL"
|
|
66
|
+
oauth_invalid_token_endpoint_auth_method_message: "Invalid Token Endpoint Authentication Method"
|
|
65
67
|
oauth_unsupported_token_type_message: "Invalid token type hint"
|
|
66
68
|
null_error_message: "is not filled"
|
|
67
69
|
oauth_unsupported_response_type_message: "Unsupported response type"
|
data/locales/pt.yml
CHANGED
|
@@ -43,6 +43,7 @@ pt:
|
|
|
43
43
|
oauth_applications_client_type_label: "Tipo de cliente"
|
|
44
44
|
oauth_applications_confidential_label: "Confidencial"
|
|
45
45
|
oauth_applications_public_label: "Público"
|
|
46
|
+
oauth_applications_token_endpoint_auth_method_label: "Método de Autenticação da rota de geração do token"
|
|
46
47
|
oauth_no_applications_text: "Nenhum aplicativo OAuth ainda!"
|
|
47
48
|
oauth_grant_user_code_label: "Código do usuário"
|
|
48
49
|
oauth_grant_user_jws_jwk_label: "Chaves JSON Web"
|
|
@@ -62,6 +63,7 @@ pt:
|
|
|
62
63
|
oauth_invalid_grant_message: "Atribuição inválida"
|
|
63
64
|
oauth_invalid_scope_message: "Escopo inválido"
|
|
64
65
|
invalid_url_message: "URL inválido"
|
|
66
|
+
oauth_invalid_token_endpoint_auth_method_message: "Método de Autenticação da rota de geração do token inválido"
|
|
65
67
|
oauth_unsupported_token_type_message: "Sugestão de tipo de token inválida"
|
|
66
68
|
null_error_message: "não está preenchido"
|
|
67
69
|
oauth_unsupported_response_type_message: "Tipo de resposta inválido"
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#{rodauth.render('homepage_url_field')}
|
|
7
7
|
#{rodauth.render('redirect_uri_field')}
|
|
8
8
|
#{rodauth.render('client_secret_field')}
|
|
9
|
+
#{rodauth.render('token_endpoint_auth_method_field')}
|
|
9
10
|
#{rodauth.render('scope_field')}
|
|
10
11
|
#{
|
|
11
12
|
if rodauth.features.include?(:oauth_jwt)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<div id="oauth-application">
|
|
2
2
|
<dl>
|
|
3
|
-
<dt class="
|
|
3
|
+
<dt class="token_endpoint_auth_method">#{rodauth.oauth_applications_token_endpoint_auth_method_label}: </dt>
|
|
4
|
+
<dd class="token_endpoint_auth_method">#{@oauth_application[rodauth.oauth_applications_token_endpoint_auth_method_column]}</dd>
|
|
5
|
+
<dt class="confidential">#{rodauth.oauth_applications_client_type_label}: </dt>
|
|
4
6
|
<dd class="confidential">#{rodauth.oauth_application_client_type_label(@oauth_application)}</dd>
|
|
5
7
|
#{
|
|
6
8
|
params = [*rodauth.oauth_application_required_params, "client_id"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<fieldset class="form-group">
|
|
2
|
+
<legend>#{rodauth.oauth_applications_token_endpoint_auth_method_label}</legend>
|
|
3
|
+
#{
|
|
4
|
+
rodauth.oauth_token_endpoint_auth_methods_supported.map do |auth_method|
|
|
5
|
+
"<div class=\"form-group form-check\">" +
|
|
6
|
+
"<input id=\"#{auth_method}\" type=\"checkbox\" class=\"form-check-input\" name=\"#{rodauth.oauth_application_token_endpoint_auth_method_param}[]\" value=\"#{auth_method}\">" +
|
|
7
|
+
"<label for=\"#{auth_method}\">#{auth_method}</label>" +
|
|
8
|
+
"</div>"
|
|
9
|
+
end.join
|
|
10
|
+
}
|
|
11
|
+
</fieldset>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rodauth-oauth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tiago Cardoso
|
|
@@ -96,6 +96,7 @@ extra_rdoc_files:
|
|
|
96
96
|
- doc/release_notes/1_6_6.md
|
|
97
97
|
- doc/release_notes/1_6_7.md
|
|
98
98
|
- doc/release_notes/1_7_0.md
|
|
99
|
+
- doc/release_notes/1_7_1.md
|
|
99
100
|
files:
|
|
100
101
|
- CHANGELOG.md
|
|
101
102
|
- LICENSE.txt
|
|
@@ -150,6 +151,7 @@ files:
|
|
|
150
151
|
- doc/release_notes/1_6_6.md
|
|
151
152
|
- doc/release_notes/1_6_7.md
|
|
152
153
|
- doc/release_notes/1_7_0.md
|
|
154
|
+
- doc/release_notes/1_7_1.md
|
|
153
155
|
- lib/generators/rodauth/oauth/install_generator.rb
|
|
154
156
|
- lib/generators/rodauth/oauth/templates/app/models/oauth_application.rb
|
|
155
157
|
- lib/generators/rodauth/oauth/templates/app/models/oauth_grant.rb
|
|
@@ -227,6 +229,7 @@ files:
|
|
|
227
229
|
- templates/oauth_grants.str
|
|
228
230
|
- templates/redirect_uri_field.str
|
|
229
231
|
- templates/scope_field.str
|
|
232
|
+
- templates/token_endpoint_auth_method_field.str
|
|
230
233
|
homepage: https://gitlab.com/os85/rodauth-oauth
|
|
231
234
|
licenses:
|
|
232
235
|
- Apache-2.0
|