rodauth 2.38.0 → 2.39.0
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/lib/rodauth/features/base.rb +36 -0
- data/lib/rodauth/features/http_basic_auth.rb +1 -1
- data/lib/rodauth/features/json.rb +2 -2
- data/lib/rodauth/features/jwt.rb +2 -2
- data/lib/rodauth/features/jwt_cors.rb +5 -5
- data/lib/rodauth/features/login.rb +2 -1
- data/lib/rodauth/features/webauthn.rb +21 -9
- data/lib/rodauth/features/webauthn_autofill.rb +1 -1
- data/lib/rodauth/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b8c2b404f5a8fad1607ba2bfd64ec4e03579a909ea324a0c9cda7705d9e79f7
|
4
|
+
data.tar.gz: bb2e8dcf2c4afa1d855379b69845c6d5efff8e097b5e95b38a11948c8d381d5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4316cb199e760aaa144e7c1b154f974f514abdea83b5a18d4f85dd01ff64a9d8c030fd028cee8c27c00d3402a951571b3ae1379ca7ef8653c991df47035ef5c7
|
7
|
+
data.tar.gz: 0f1fa083577edf23a8db579ab5df5c9ef0d6087c97a7d2cea2c1ef7071049e495d3f374f5657194db4d6feef2252bb708f85af3a1a66e7f116185406db488984
|
@@ -563,6 +563,42 @@ module Rodauth
|
|
563
563
|
s
|
564
564
|
end
|
565
565
|
|
566
|
+
if Rack.release >= '3'
|
567
|
+
def set_response_header(key, value)
|
568
|
+
response.headers[key] = value
|
569
|
+
end
|
570
|
+
|
571
|
+
def convert_response_header_key(key)
|
572
|
+
key
|
573
|
+
end
|
574
|
+
# :nocov:
|
575
|
+
else
|
576
|
+
def set_response_header(key, value)
|
577
|
+
response.headers[convert_response_header_key(key)] = value
|
578
|
+
end
|
579
|
+
|
580
|
+
# Attempt backwards compatibility on Rack < 3 by changing
|
581
|
+
# known cases from lower case to mixed case.
|
582
|
+
mixed_case_headers = {}
|
583
|
+
(<<-END).split.each { |k| mixed_case_headers[k.downcase.freeze] = k.freeze }
|
584
|
+
Access-Control-Allow-Headers
|
585
|
+
Access-Control-Allow-Methods
|
586
|
+
Access-Control-Allow-Origin
|
587
|
+
Access-Control-Expose-Headers
|
588
|
+
Access-Control-Max-Age
|
589
|
+
Allow
|
590
|
+
Authorization
|
591
|
+
Content-Type
|
592
|
+
Content-Length
|
593
|
+
WWW-Authenticate
|
594
|
+
END
|
595
|
+
mixed_case_headers.freeze
|
596
|
+
define_method(:convert_response_header_key) do |key|
|
597
|
+
mixed_case_headers.fetch(key, key)
|
598
|
+
end
|
599
|
+
end
|
600
|
+
# :nocov:
|
601
|
+
|
566
602
|
if RUBY_VERSION >= '2.1'
|
567
603
|
def button_fixed_locals
|
568
604
|
'(value:, opts:)'
|
@@ -73,7 +73,7 @@ module Rodauth
|
|
73
73
|
|
74
74
|
def set_http_basic_auth_error_response
|
75
75
|
response.status = 401
|
76
|
-
|
76
|
+
set_response_header("www-authenticate", "Basic realm=\"#{http_basic_auth_realm}\"")
|
77
77
|
end
|
78
78
|
|
79
79
|
def throw_basic_auth_error(*args)
|
@@ -186,7 +186,7 @@ module Rodauth
|
|
186
186
|
|
187
187
|
unless request.post?
|
188
188
|
response.status = 405
|
189
|
-
|
189
|
+
set_response_header('allow', 'POST')
|
190
190
|
json_response[json_response_error_key] = json_non_post_error_message
|
191
191
|
return_json_response
|
192
192
|
end
|
@@ -209,7 +209,7 @@ module Rodauth
|
|
209
209
|
|
210
210
|
def _return_json_response
|
211
211
|
response.status ||= json_response_error_status if json_response_error?
|
212
|
-
response['
|
212
|
+
response.headers[convert_response_header_key('content-type')] ||= json_response_content_type
|
213
213
|
return_response _json_response_body(json_response)
|
214
214
|
end
|
215
215
|
|
data/lib/rodauth/features/jwt.rb
CHANGED
@@ -47,7 +47,7 @@ module Rodauth
|
|
47
47
|
|
48
48
|
if session_data
|
49
49
|
if jwt_symbolize_deeply?
|
50
|
-
s = JSON.parse(JSON.
|
50
|
+
s = JSON.parse(JSON.generate(session_data), :symbolize_names=>true)
|
51
51
|
elsif scope.opts[:sessions_convert_symbols]
|
52
52
|
s = session_data
|
53
53
|
else
|
@@ -84,7 +84,7 @@ module Rodauth
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def set_jwt_token(token)
|
87
|
-
|
87
|
+
set_response_header('authorization', token)
|
88
88
|
end
|
89
89
|
|
90
90
|
def use_jwt?
|
@@ -33,18 +33,18 @@ module Rodauth
|
|
33
33
|
|
34
34
|
def before_rodauth
|
35
35
|
if jwt_cors_allow?
|
36
|
-
|
36
|
+
set_response_header('access-control-allow-origin', request.env['HTTP_ORIGIN'])
|
37
37
|
|
38
38
|
# Handle CORS preflight request
|
39
39
|
if request.request_method == 'OPTIONS'
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
set_response_header('access-control-allow-methods', jwt_cors_allow_methods)
|
41
|
+
set_response_header('access-control-allow-headers', jwt_cors_allow_headers)
|
42
|
+
set_response_header('access-control-max-age', jwt_cors_max_age.to_s)
|
43
43
|
response.status = 204
|
44
44
|
return_response
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
set_response_header('access-control-expose-headers', jwt_cors_expose_headers)
|
48
48
|
end
|
49
49
|
|
50
50
|
super
|
@@ -15,6 +15,7 @@ module Rodauth
|
|
15
15
|
auth_value_method :login_error_status, 401
|
16
16
|
translatable_method :login_form_footer_links_heading, '<h2 class="rodauth-login-form-footer-links-heading">Other Options</h2>'
|
17
17
|
auth_value_method :login_return_to_requested_location?, false
|
18
|
+
auth_value_method :login_return_to_requested_location_max_path_size, 2048
|
18
19
|
auth_value_method :use_multi_phase_login?, false
|
19
20
|
|
20
21
|
session_key :login_redirect_session_key, :login_redirect
|
@@ -95,7 +96,7 @@ module Rodauth
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def login_required
|
98
|
-
if login_return_to_requested_location? && (path = login_return_to_requested_location_path)
|
99
|
+
if login_return_to_requested_location? && (path = login_return_to_requested_location_path) && path.bytesize <= login_return_to_requested_location_max_path_size
|
99
100
|
set_session_value(login_redirect_session_key, path)
|
100
101
|
end
|
101
102
|
super
|
@@ -123,7 +123,7 @@ module Rodauth
|
|
123
123
|
route(:webauthn_auth_js) do |r|
|
124
124
|
before_webauthn_auth_js_route
|
125
125
|
r.get do
|
126
|
-
|
126
|
+
set_response_header('content-type', 'text/javascript')
|
127
127
|
webauthn_auth_js
|
128
128
|
end
|
129
129
|
end
|
@@ -158,7 +158,7 @@ module Rodauth
|
|
158
158
|
route(:webauthn_setup_js) do |r|
|
159
159
|
before_webauthn_setup_js_route
|
160
160
|
r.get do
|
161
|
-
|
161
|
+
set_response_header('content-type', 'text/javascript')
|
162
162
|
webauthn_setup_js
|
163
163
|
end
|
164
164
|
end
|
@@ -410,13 +410,25 @@ module Rodauth
|
|
410
410
|
private
|
411
411
|
|
412
412
|
if WebAuthn::VERSION >= '3'
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
413
|
+
if WebAuthn::RelyingParty.instance_method(:initialize).parameters.include?([:key, :allowed_origins])
|
414
|
+
def webauthn_relying_party
|
415
|
+
# No need to memoize, only called once per request
|
416
|
+
WebAuthn::RelyingParty.new(
|
417
|
+
allowed_origins: [webauthn_origin],
|
418
|
+
id: webauthn_rp_id,
|
419
|
+
name: webauthn_rp_name,
|
420
|
+
)
|
421
|
+
end
|
422
|
+
# :nocov:
|
423
|
+
else
|
424
|
+
def webauthn_relying_party
|
425
|
+
WebAuthn::RelyingParty.new(
|
426
|
+
origin: webauthn_origin,
|
427
|
+
id: webauthn_rp_id,
|
428
|
+
name: webauthn_rp_name,
|
429
|
+
)
|
430
|
+
end
|
431
|
+
# :nocov:
|
420
432
|
end
|
421
433
|
|
422
434
|
def webauthn_create_relying_party_opts
|
data/lib/rodauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: sequel
|
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
402
402
|
- !ruby/object:Gem::Version
|
403
403
|
version: '0'
|
404
404
|
requirements: []
|
405
|
-
rubygems_version: 3.6.
|
405
|
+
rubygems_version: 3.6.7
|
406
406
|
specification_version: 4
|
407
407
|
summary: Authentication and Account Management Framework for Rack Applications
|
408
408
|
test_files: []
|