rodauth 2.6.0 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +42 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +21 -6
  5. data/doc/argon2.rdoc +49 -0
  6. data/doc/base.rdoc +1 -1
  7. data/doc/change_login.rdoc +1 -0
  8. data/doc/guides/migrate_password_hash_algorithm.rdoc +15 -0
  9. data/doc/json.rdoc +47 -0
  10. data/doc/jwt.rdoc +1 -28
  11. data/doc/jwt_refresh.rdoc +2 -0
  12. data/doc/login_password_requirements_base.rdoc +2 -1
  13. data/doc/recovery_codes.rdoc +2 -1
  14. data/doc/release_notes/2.10.0.txt +47 -0
  15. data/doc/release_notes/2.11.0.txt +31 -0
  16. data/doc/release_notes/2.7.0.txt +33 -0
  17. data/doc/release_notes/2.8.0.txt +20 -0
  18. data/doc/release_notes/2.9.0.txt +21 -0
  19. data/doc/remember.rdoc +1 -1
  20. data/lib/rodauth.rb +17 -4
  21. data/lib/rodauth/features/argon2.rb +69 -0
  22. data/lib/rodauth/features/base.rb +6 -2
  23. data/lib/rodauth/features/change_login.rb +2 -1
  24. data/lib/rodauth/features/disallow_password_reuse.rb +20 -7
  25. data/lib/rodauth/features/email_base.rb +5 -2
  26. data/lib/rodauth/features/json.rb +189 -0
  27. data/lib/rodauth/features/jwt.rb +19 -171
  28. data/lib/rodauth/features/jwt_refresh.rb +23 -10
  29. data/lib/rodauth/features/login_password_requirements_base.rb +6 -1
  30. data/lib/rodauth/features/otp.rb +0 -2
  31. data/lib/rodauth/features/recovery_codes.rb +22 -1
  32. data/lib/rodauth/features/remember.rb +6 -1
  33. data/lib/rodauth/features/reset_password.rb +1 -0
  34. data/lib/rodauth/features/update_password_hash.rb +1 -1
  35. data/lib/rodauth/features/verify_account.rb +0 -1
  36. data/lib/rodauth/features/webauthn_verify_account.rb +1 -1
  37. data/lib/rodauth/migrations.rb +31 -5
  38. data/lib/rodauth/version.rb +1 -1
  39. metadata +55 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82585797ff882cb56340e2145b05b74da1e10c428413b02e1656604fa8209c93
4
- data.tar.gz: 7148d04c255f4310a21c6373d9ab20888e8fe46d3a07c090576385890ea82858
3
+ metadata.gz: 52cc814306a88708a5ade63bfa8288521db20517fdac543217e86a084e8e189f
4
+ data.tar.gz: ebd02824ee15ede1c58a5ca93c092d2372e953790f7535d0889521bc95b9dfd3
5
5
  SHA512:
6
- metadata.gz: be8a3bffa982ca9730dafdefb8a8a874c2a2cb8fa62c84d4b0467928fc2164251ba28bb88948274316d7870473f0a602b8ac69eef8b48b70b27584ed7a443ded
7
- data.tar.gz: afaf45ddda1073eaba697035700ec9108bebd1fc18998af9245fd86f532f497e6723fa532624aae426dac7e1600556af7b7369b2e7203e387be26dcbdfc22e3d
6
+ metadata.gz: 435b51b083c4509626c0699c2298c641134b132e0c08fae0c738823f4230d35d2a714761b7afdb2c9a48bb7c025e653a2bce84ae88b07f21a2bd5b494b52e6cc
7
+ data.tar.gz: 179b131a07064033a1c934360578f8b7a8703421133179255078063d9bde7621f9865c3bb00f51dceb313255e4d685804ba2f1a0ba2d109198f660802d6eda61
data/CHANGELOG CHANGED
@@ -1,3 +1,45 @@
1
+ === 2.11.0 (2021-03-22)
2
+
3
+ * Add same_as_current_login_message and contains_null_byte_message configuration methods to increase translatability (dmitryzuev) (#158)
4
+
5
+ * Allow the rodauth plugin to be loaded without a block (janko) (#157)
6
+
7
+ * Use new-password autocomplete value for the password fields on the reset password form (basabin54) (#155)
8
+
9
+ * Support :auth_class plugin option, to use a specific class instead of creating a Rodauth::Auth subclass (janko) (#153)
10
+
11
+ * Make Rodauth configuration work correctly if the rodauth plugin is loaded more than once (janko) (#152)
12
+
13
+ === 2.10.0 (2021-02-22)
14
+
15
+ * Add argon2 feature to allow use of the argon2 password hash algorithm instead of bcrypt (AlexeyMatskevich, jeremyevans) (#147)
16
+
17
+ * Avoid unnecessary previous password queries when using disallow_password_reuse feature with create_account or verify_account features (AlexeyMatskevich, jeremyevans) (#148)
18
+
19
+ === 2.9.0 (2021-01-22)
20
+
21
+ * Split jwt feature into json and jwt features, with the json feature using standard session support (janko, jeremyevans) (#145)
22
+
23
+ * Mark remember cookie as only transmitted over HTTPS by default if created via an HTTPS request (janko) (#144)
24
+
25
+ === 2.8.0 (2021-01-06)
26
+
27
+ * [SECURITY] Set HttpOnly on remember cookie by default so it cannot be accessed by Javascript (janko) (#142)
28
+
29
+ * Clear JWT session when rodauth.clear_session is called if the Roda sessions plugin is used (janko) (#140)
30
+
31
+ === 2.7.0 (2020-12-22)
32
+
33
+ * Avoid method redefinition warnings in verbose warning mode (jeremyevans)
34
+
35
+ * Return expired access token error message in the JWT refresh feature when using an expired token when it isn't allowed (AlexyMatskevich) (#133)
36
+
37
+ * Allow Rodauth features to be preloaded, instead of always trying to require them (janko) (#136)
38
+
39
+ * Use a default remember cookie path of '/', though this may cause problem with multiple Rodauth configurations on the same domain (janko) (#134)
40
+
41
+ * Add auto_remove_recovery_codes? to the recovery_codes feature, for automatically removing the codes when disabling multifactor authentication (SilasSpet, jeremyevans) (#135)
42
+
1
43
  === 2.6.0 (2020-11-20)
2
44
 
3
45
  * Avoid loading features multiple times (janko) (#131)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2020 Jeremy Evans
1
+ Copyright (c) 2015-2021 Jeremy Evans
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to
data/README.rdoc CHANGED
@@ -52,10 +52,12 @@ HTML and JSON API for all supported features.
52
52
  * Session Expiration
53
53
  * Active Sessions (Prevent session reuse after logout, allow logout of all sessions)
54
54
  * Single Session (Only one active session per account)
55
- * JWT (JSON API support for all other features)
55
+ * JSON (JSON API support for all other features)
56
+ * JWT (JSON Web Token support for all other features)
56
57
  * JWT Refresh (Access & Refresh Token)
57
58
  * JWT CORS (Cross-Origin Resource Sharing)
58
59
  * Update Password Hash (when hash cost changes)
60
+ * Argon2
59
61
  * HTTP Basic Auth
60
62
  * Change Password Notify
61
63
 
@@ -79,8 +81,10 @@ rack_csrf :: Used for CSRF support if the :csrf=>:rack_csrf plugin
79
81
  option is given (the default is to use Roda's route_csrf
80
82
  plugin, as that allows for more secure request-specific
81
83
  tokens).
82
- bcrypt :: Used by default for password matching, can be skipped
84
+ bcrypt :: Used by default for password hashing, can be skipped
83
85
  if password_match? is overridden for custom authentication.
86
+ argon2 :: Used by the argon2 feature as alternative to bcrypt for
87
+ password hashing.
84
88
  mail :: Used by default for mailing in the reset password, verify
85
89
  account, verify_login_change, change_password_notify,
86
90
  lockout, and email_auth features.
@@ -105,7 +109,7 @@ correctly without it. There may be cases where you cannot use
105
109
  this feature, such as when using a different database or when you
106
110
  do not have full control over the database you are using.
107
111
 
108
- Passwords are hashed using bcrypt, and the password hashes are
112
+ Passwords are hashed using bcrypt by default, and the password hashes are
109
113
  kept in a separate table from the accounts table, with a foreign key
110
114
  referencing the accounts table. Two database functions are added,
111
115
  one to retrieve the salt for a password, and the other to check
@@ -332,7 +336,7 @@ things for the schema changes:
332
336
  foreign_key :id, Sequel[:${DATABASE_NAME}][:accounts], :primary_key=>true, :type=>:Bignum
333
337
  String :password_hash, :null=>false
334
338
  end
335
- Rodauth.create_database_authentication_functions(self, :table_name=>"${DATABASE_NAME}_password.account_password_hashes")
339
+ Rodauth.create_database_authentication_functions(self, :table_name=>Sequel[:${DATABASE_NAME}_password][:account_password_hashes])
336
340
 
337
341
  # if using the disallow_password_reuse feature:
338
342
  create_table(:account_previous_password_hashes) do
@@ -340,7 +344,7 @@ things for the schema changes:
340
344
  foreign_key :account_id, Sequel[:${DATABASE_NAME}][:accounts], :type=>:Bignum
341
345
  String :password_hash, :null=>false
342
346
  end
343
- Rodauth.create_database_previous_password_check_functions(self, :table_name=>"${DATABASE_NAME}_password.account_previous_password_hashes")
347
+ Rodauth.create_database_previous_password_check_functions(self, :table_name=>Sequel[:${DATABASE_NAME}_password][:account_previous_password_hashes])
344
348
 
345
349
  You'll also need to use the following Rodauth configuration methods so that the
346
350
  app account calls functions in a separate schema:
@@ -848,6 +852,9 @@ which configures which dependent plugins should be loaded. Options:
848
852
  still need to load the render plugin manually.
849
853
  :name :: Provide a name for the given Rodauth configuration, used to
850
854
  support multiple Rodauth configurations in a given Roda application.
855
+ :auth_class :: Provide a specific Rodauth::Auth subclass that should be set
856
+ on the Roda application. By default, an anonymous
857
+ Rodauth::Auth subclass is created.
851
858
 
852
859
  === Feature Documentation
853
860
 
@@ -862,6 +869,7 @@ view the appropriate file in the doc directory.
862
869
  * {Account Expiration}[rdoc-ref:doc/account_expiration.rdoc]
863
870
  * {Active Sessions}[rdoc-ref:doc/active_sessions.rdoc]
864
871
  * {Audit Logging}[rdoc-ref:doc/audit_logging.rdoc]
872
+ * {Argon2}[rdoc-ref:doc/argon2.rdoc]
865
873
  * {Change Login}[rdoc-ref:doc/change_login.rdoc]
866
874
  * {Change Password}[rdoc-ref:doc/change_password.rdoc]
867
875
  * {Change Password Notify}[rdoc-ref:doc/change_password_notify.rdoc]
@@ -872,6 +880,7 @@ view the appropriate file in the doc directory.
872
880
  * {Disallow Password Reuse}[rdoc-ref:doc/disallow_password_reuse.rdoc]
873
881
  * {Email Authentication}[rdoc-ref:doc/email_auth.rdoc]
874
882
  * {HTTP Basic Auth}[rdoc-ref:doc/http_basic_auth.rdoc]
883
+ * {JSON}[rdoc-ref:doc/json.rdoc]
875
884
  * {JWT CORS}[rdoc-ref:doc/jwt_cors.rdoc]
876
885
  * {JWT Refresh}[rdoc-ref:doc/jwt_refresh.rdoc]
877
886
  * {JWT}[rdoc-ref:doc/jwt.rdoc]
@@ -1320,7 +1329,13 @@ use the necessary *_email_body configuration options to specify
1320
1329
  the body of the emails.
1321
1330
 
1322
1331
  The JWT feature enables JSON API support for all of the other features
1323
- that Rodauth ships with.
1332
+ that Rodauth ships with. If you would like JSON API access that still uses
1333
+ rack session for storing session data, enable the JSON feature instead:
1334
+
1335
+ plugin :rodauth, :json=>true do
1336
+ enable :login, :logout, :json
1337
+ only_json? true # if you want to only handle JSON requests
1338
+ end
1324
1339
 
1325
1340
  === Adding Custom Methods to the +rodauth+ Object
1326
1341
 
data/doc/argon2.rdoc ADDED
@@ -0,0 +1,49 @@
1
+ = Documentation for Argon2 Feature
2
+
3
+ The argon2 feature adds the ability to replace the bcrypt password hash
4
+ algorithm with argon2 (specifically, argon2id). Argon2 is an alternative to
5
+ bcrypt that offers the ability to be memory-hard. However, if you are storing
6
+ password hashes in a table that the database user does not have access to
7
+ (the recommended way to use Rodauth), argon2 does not offer significant
8
+ security advantages over bcrypt.
9
+
10
+ If you are using this feature with Rodauth's database authentication functions,
11
+ you need to make sure that the database authentication functions are configured
12
+ to support argon2 in addition to bcrypt. You can do this by passing the
13
+ +:argon2+ option when calling the method to define the database functions.
14
+ In this example, +DB+ should be your Sequel::Database object:
15
+
16
+ require 'rodauth/migrations'
17
+
18
+ # If the functions are already defined and you are not using PostgreSQL,
19
+ # you need to drop the existing functions.
20
+ Rodauth.drop_database_authentication_functions(DB)
21
+
22
+ # If you are using the disallow_password_reuse feature, also drop the
23
+ # database functions related to that if not using PostgreSQL:
24
+ Rodauth.drop_database_previous_password_check_functions(DB)
25
+
26
+ # Define new functions that support argon2:
27
+ Rodauth.create_database_authentication_functions(DB, argon2: true)
28
+
29
+ # If you are using the disallow_password_reuse feature, also define
30
+ # new functions that support argon2 for that:
31
+ Rodauth.create_database_previous_password_check_functions(DB, argon2: true)
32
+
33
+ The argon2 feature provides the ability to allow for a gradual migration
34
+ from transitioning from bcrypt to argon2 and vice-versa, if you are using the
35
+ update_password_hash.
36
+
37
+ Argon2 is more configurable than bcrypt in terms of password hash cost
38
+ speficiation. Instead of specifying the password_hash_cost value as
39
+ an integer, you must specify the password hash cost as a hash, such as
40
+ (<tt>{t_cost: 2, m_cost: 16}</tt>).
41
+
42
+ If you are using the argon2 feature and if you have no bcrypt passwords in
43
+ your database, you should use <tt>require_bcrypt? false</tt> in your
44
+ Rodauth configuration to prevent loading the bcrypt library, which will save
45
+ memory.
46
+
47
+ == Auth Value Methods
48
+
49
+ use_argon2? :: Whether to use the argon2 password hash algorithm for new passwords (true by default). The only reason to set this to false is if you have existing passwords using argon2 that you want to support, but want to use bcrypt for new passwords.
data/doc/base.rdoc CHANGED
@@ -15,7 +15,7 @@ domain :: The domain to use, required by some other features. It is recommended
15
15
  hmac_secret :: This sets the secret to use for all of Rodauth's HMACs. This is not set by default, in which case Rodauth does not use HMACs for additional security. However, it is highly recommended that you set this, and some features require it.
16
16
  mark_input_fields_as_required? :: Whether input fields should be marked as required, so browsers will not allow submission without filling out the field (default: true).
17
17
  prefix :: The routing prefix used for Rodauth routes. If you are calling in a routing subtree, this should be set to the root path of the subtree. This should include a leading slash if set, but not a trailing slash.
18
- require_bcrypt? :: Set to false to not require bcrypt, useful if using custom authentication.
18
+ require_bcrypt? :: Set to false to not require bcrypt, useful if using custom authentication or when using the argon2 feature without existing bcrypt password hashes.
19
19
  session_key :: The key in the session hash storing the primary key of the logged in account.
20
20
  session_key_prefix :: The string that will be prepended to the default value for all session keys.
21
21
  skip_status_checks? :: Whether status checks should be skipped for accounts. Defaults to true unless enabling the verify_account or close_account features.
@@ -13,6 +13,7 @@ change_login_page_title :: The page title to use on the change login form.
13
13
  change_login_redirect :: Where to redirect after a sucessful login change.
14
14
  change_login_requires_password? :: Whether a password is required when changing logins.
15
15
  change_login_route :: The route to the change login action. Defaults to +change-login+.
16
+ same_as_current_login_message :: The error message to display if using the same value as the current login when changing the login.
16
17
 
17
18
  == Auth Methods
18
19
 
@@ -0,0 +1,15 @@
1
+ = Migrate users passwords from bcrypt to argon2 or back
2
+
3
+ If you are currently using the default bcrypt password hash algorithm, and want to
4
+ gradually migrate to the argon2 password hash algorithm, you can use both the argon2
5
+ and update_password_hash features:
6
+
7
+ plugin :rodauth do
8
+ enable :login, :update_password_hash, :argon2
9
+ end
10
+
11
+ When a user with a current bcrypt password hash next successfully uses their
12
+ password, their password hash will be migrated to argon2.
13
+
14
+ If for some reason you want to migrate back from argon2 to bcrypt, you can set
15
+ <tt>use_argon2? false</tt> in your Rodauth configuration.
data/doc/json.rdoc ADDED
@@ -0,0 +1,47 @@
1
+ = Documentation for JSON Feature
2
+
3
+ The json feature adds support for JSON API access for all other
4
+ features that ship with Rodauth.
5
+
6
+ When this feature is used, all other features become accessible via a
7
+ JSON API. The JSON API uses the POST method for all requests, using
8
+ the same parameter names as the features uses. JSON API requests to
9
+ Rodauth endpoints that use a method other than POST will result in a
10
+ 405 Method Not Allowed response.
11
+
12
+ Responses are returned as JSON hashes. In case of an error, the +error+
13
+ entry is set to an error message, and the <tt>field-error</tt> entry is set to
14
+ an array containing the field name and the error message for that field.
15
+ Successful requests by default store a +success+ entry with a success
16
+ message, though that can be disabled.
17
+
18
+ The session state is managed in the rack session, so make sure that
19
+ CSRF protection is enabled. This will be the case when passing the
20
+ <tt>json: true</tt> option when loading the rodauth plugin. If you
21
+ want to only handle JSON requests, set <tt>only_json? true</tt> in
22
+ your rodauth configuration.
23
+
24
+ If you want token-based authentication sent via the Authorization
25
+ header, consider using the jwt feature.
26
+
27
+ == Auth Value Methods
28
+
29
+ json_accept_regexp :: The regexp to use to check the Accept header for JSON if +json_check_accept?+ is true.
30
+ json_check_accept? :: Whether to check the Accept header to see if the client supports JSON responses, true by default.
31
+ json_non_post_error_message :: The error message to use when a JSON non-POST request is sent.
32
+ json_not_accepted_error_message :: The error message to display if +json_check_accept?+ is true and the Accept header is present but does not match +json_request_content_type_regexp+.
33
+ json_request_content_type_regexp :: The regexp to use to recognize a request as a json request.
34
+ json_response_content_type :: The content type to set for json responses, <tt>application/json</tt> by default.
35
+ json_response_custom_error_status? :: Whether to use custom error statuses, instead of always using +json_response_error_status+, true by default, can be set to false for backwards compatibility with Rodauth 1.
36
+ json_response_error_key :: The JSON result key containing an error message, +error+ by default.
37
+ json_response_error_status :: The HTTP status code to use for JSON error responses if not using custom error statuses, 400 by default.
38
+ json_response_field_error_key :: The JSON result key containing an field error message, <tt>field-error</tt> by default.
39
+ json_response_success_key :: The JSON result key containing a success message for successful request, if set. +success+ by default.
40
+ non_json_request_error_message :: The error message to use when a non-JSON request is sent and +only_json?+ is set.
41
+ only_json? :: Whether to have Rodauth only allow JSON requests. True by default if <tt>json: :only</tt> option was given when loading the plugin. If set, rodauth endpoints will issue an error for non-JSON requests.
42
+ use_json? :: Whether to return a JSON response. By default, a JSON response is returned if +only_json?+ is true, or if the request uses a json content type.
43
+
44
+ == Auth Methods
45
+
46
+ json_request? :: Whether the current request is a JSON request, looks at the Content-Type request header by default.
47
+ json_response_body(hash) :: The body to use for JSON response. By default just converts hash to JSON. Can be used to reformat JSON output in arbitrary ways.
data/doc/jwt.rdoc CHANGED
@@ -2,19 +2,7 @@
2
2
 
3
3
  The jwt feature adds support for JSON API access for all other features
4
4
  that ship with Rodauth, using JWT (JSON Web Tokens) to hold the
5
- session information.
6
-
7
- When this feature is used, all other features become accessible via a
8
- JSON API. The JSON API uses the POST method for all requests, using
9
- the same parameter names as the features uses. JSON API requests to
10
- Rodauth endpoints that use a method other than POST will result in a
11
- 405 Method Not Allowed response.
12
-
13
- Responses are returned as JSON hashes. In case of an error, the +error+
14
- entry is set to an error message, and the <tt>field-error</tt> entry is set to
15
- an array containing the field name and the error message for that field.
16
- Successful requests by default store a +success+ entry with a success
17
- message, though that can be disabled.
5
+ session information. It depends on the json feature.
18
6
 
19
7
  In order to use this feature, you have to set the +jwt_secret+ configuration
20
8
  option the secret used to cryptographically protect the token.
@@ -41,32 +29,17 @@ from +rodauth.session+.
41
29
  == Auth Value Methods
42
30
 
43
31
  invalid_jwt_format_error_message :: The error message to use when a JWT with an invalid format is submitted in the Authorization header.
44
- json_accept_regexp :: The regexp to use to check the Accept header for JSON if +jwt_check_accept?+ is true.
45
- json_non_post_error_message :: The error message to use when a JSON non-POST request is sent.
46
- json_not_accepted_error_message :: The error message to display if +jwt_check_accept?+ is true and the Accept header is present but does not match +json_request_content_type_regexp+.
47
- json_request_content_type_regexp :: The regexp to use to recognize a request as a json request.
48
- json_response_content_type :: The content type to set for json responses, <tt>application/json</tt> by default.
49
- json_response_custom_error_status? :: Whether to use custom error statuses, instead of always using +json_response_error_status+, true by default, can be set to false for backwards compatibility with Rodauth 1.
50
- json_response_error_key :: The JSON result key containing an error message, +error+ by default.
51
- json_response_error_status :: The HTTP status code to use for JSON error responses if not using custom error statuses, 400 by default.
52
- json_response_field_error_key :: The JSON result key containing an field error message, <tt>field-error</tt> by default.
53
- json_response_success_key :: The JSON result key containing a success message for successful request, if set. +success+ by default.
54
32
  jwt_algorithm :: The JWT algorithm to use, +HS256+ by default.
55
33
  jwt_authorization_ignore :: A regexp matched against the Authorization header, which skips JWT processing if it matches. By default, HTTP Basic and Digest authentication are ignored.
56
34
  jwt_authorization_remove :: A regexp to remove from the Authorization header before processing the JWT. By default, a Bearer prefix is removed.
57
- jwt_check_accept? :: Whether to check the Accept header to see if the client supports JSON responses, true by default, can be set to false for backwards compatibility with Rodauth 1.
58
35
  jwt_decode_opts :: An optional hash to pass to +JWT.decode+. Can be used to set JWT verifiers.
59
36
  jwt_secret :: The JWT secret to use. Access to this should be protected the same as a session secret.
60
37
  jwt_session_key :: A key to nest the session hash under in the JWT payload. nil by default, for no nesting.
61
38
  jwt_symbolize_deeply? :: Whether to symbolize the session hash deeply. false by default.
62
- non_json_request_error_message :: The error message to use when a non-JSON request is sent and +only_json?+ is set.
63
- only_json? :: Whether to have Rodauth only allow JSON requests. True by default if <tt>json: :only</tt> option was given when loading the plugin. If set, rodauth endpoints will issue an error for non-JSON requests.
64
39
  use_jwt? :: Whether to use the JWT in the Authorization header for authentication information. If false, falls back to using the rack session. By default, the Authorization header is used if it is present, if +only_json?+ is true, or if the request uses a json content type.
65
40
 
66
41
  == Auth Methods
67
42
 
68
- json_request? :: Whether the current request is a JSON request, looks at the Content-Type request header by default.
69
- json_response_body(hash) :: The body to use for JSON response. By default just converts hash to JSON. Can be used to reformat JSON output in arbitrary ways.
70
43
  jwt_session_hash :: The session hash used to create the session_jwt. Can be used to set JWT claims.
71
44
  jwt_token :: Retrieve the JWT token from the request, by default taking it from the Authorization header.
72
45
  session_jwt :: An encoded JWT for the current session.
data/doc/jwt_refresh.rdoc CHANGED
@@ -30,6 +30,8 @@ This feature depends on the jwt feature.
30
30
  == Auth Value Methods
31
31
 
32
32
  allow_refresh_with_expired_jwt_access_token? :: Whether refreshing should be allowed with an expired access token. Default is +false+. You must set an +hmac_secret+ if setting this value to +true+.
33
+ expired_jwt_access_token_status :: The HTTP status code to use when a access token (JWT) is expired is submitted in the Authorization header. Default is 400 for backwards compatibility, and it is recommended to set it to 401.
34
+ expired_jwt_access_token_message :: The error message to use when a access token (JWT) is expired is submitted in the Authorization header.
33
35
  jwt_access_token_key :: Name of the key in the response json holding the access token. Default is +access_token+.
34
36
  jwt_access_token_not_before_period :: How many seconds before the current time will the jwt be considered valid (to account for inaccurate clocks). Default is 5.
35
37
  jwt_access_token_period :: Validity of an access token in seconds, default is 1800 (30 minutes).
@@ -6,6 +6,7 @@ use a Rodauth feature that requires setting logins or passwords.
6
6
  == Auth Value Methods
7
7
 
8
8
  already_an_account_with_this_login_message :: The error message to display when there already exists an account with the same login.
9
+ contains_null_byte_message :: The error message to display when the password contains a null byte.
9
10
  login_confirm_label :: The label to use for login confirmations.
10
11
  login_confirm_param :: The parameter name to use for login confirmations.
11
12
  login_does_not_meet_requirements_message :: The error message to display when the login does not meet the requirements you have set.
@@ -19,7 +20,7 @@ logins_do_not_match_message :: The error message to display when login and login
19
20
  password_confirm_label :: The label to use for password confirmations.
20
21
  password_confirm_param :: The parameter name to use for password confirmations.
21
22
  password_does_not_meet_requirements_message :: The error message to display when the password does not meet the requirements you have set.
22
- password_hash_cost :: The bcrypt cost to use for the password hash.
23
+ password_hash_cost :: The cost to use for the password hash algorithm. This should be an integer when using bcrypt (the default), and a hash if using argon2 (supported by the argon2 feature).
23
24
  password_minimum_length :: The minimum length for passwords, 6 by default.
24
25
  password_too_short_message :: The error message fragment to show if the password is too short.
25
26
  passwords_do_not_match_message :: The error message to display when password and password confirmation do not match.
@@ -17,7 +17,8 @@ add_recovery_codes_error_flash :: The flash error to show when adding recovery c
17
17
  add_recovery_codes_heading :: Text to use for heading above the form to add recovery codes.
18
18
  add_recovery_codes_page_title :: The page title to use on the add recovery codes form.
19
19
  add_recovery_codes_param :: The parameter name to use for adding recovery codes.
20
- auto_add_recovery_codes? :: Whether to automatically add recovery codes (or any missing recovery codes) when another multifactor authentication type is enabled (false by default).
20
+ auto_add_recovery_codes? :: Whether to automatically add recovery codes (or any missing recovery codes) when enabling otp, webauthn, or sms authentication (false by default).
21
+ auto_remove_recovery_codes? :: Whether to automatically remove recovery codes when disabling otp, webauthn, or sms authentication and not having one of the other two authentication methods enabled (false by default).
21
22
  invalid_recovery_code_error_flash :: The flash error to show when an invalid recovery code is used.
22
23
  invalid_recovery_code_message :: The error message to show when an invalid recovery code is used.
23
24
  recovery_auth_additional_form_tags :: HTML fragment containing additional form tags when authenticating via a recovery code.
@@ -0,0 +1,47 @@
1
+ = New Features
2
+
3
+ * An argon2 feature has been added that supports using the argon2
4
+ password hashing algorithm instead of the bcrypt password hashing
5
+ algorithm. While argon2 does not provide an advantage over bcrypt
6
+ if the attacker cannot access the password hashes directly (which
7
+ is how Rodauth is recommended to be used), in cases where attackers
8
+ can access the password hashes directly, argon2 is thought to be
9
+ more difficult or expensive to crack due to requiring more memory
10
+ (bcrypt is not a memory-hard password hash algorithm).
11
+
12
+ If you are using this feature with Rodauth's database authentication
13
+ functions, you need to make sure that the database authentication
14
+ functions are configured to support argon2 in addition to bcrypt.
15
+ You can do this by passing the :argon2 option when calling the
16
+ method to define the database functions. In this example, DB should
17
+ be your Sequel::Database object (this could be self if used in a
18
+ Sequel migration):
19
+
20
+ require 'rodauth/migrations'
21
+
22
+ # If the functions are already defined and you are not using PostgreSQL,
23
+ # you need to drop the existing functions.
24
+ Rodauth.drop_database_authentication_functions(DB)
25
+
26
+ # If you are using the disallow_password_reuse feature, also drop the
27
+ # database functions related to that if you are not using PostgreSQL:
28
+ Rodauth.drop_database_previous_password_check_functions(DB)
29
+
30
+ # Define new functions that support argon2:
31
+ Rodauth.create_database_authentication_functions(DB, argon2: true)
32
+
33
+ # If you are using the disallow_password_reuse feature, also define
34
+ # new functions that support argon2 for that:
35
+ Rodauth.create_database_previous_password_check_functions(DB, argon2: true)
36
+
37
+ You can transparently migrate bcrypt password hashes to argon2
38
+ password hashes whenever a user successfully uses their password
39
+ by using the argon2 feature in combination with the
40
+ update_password_hash feature.
41
+
42
+ = Other Improvements
43
+
44
+ * Unnecessary queries to determine whether the new password matches
45
+ a previous password are now skipped when using the create_account
46
+ or verify_account features with the disallow_password_reuse
47
+ feature.
@@ -0,0 +1,31 @@
1
+ = New Features
2
+
3
+ * An :auth_class rodauth plugin option has been added, allowing a user
4
+ to specify a specific Rodauth::Auth subclass to use, instead of
5
+ always using a new subclass of Rodauth::Auth. This is designed for
6
+ advanced configurations or other frameworks that build on top of
7
+ Rodauth, which may want to customize the Rodauth::Auth subclasses to
8
+ use.
9
+
10
+ * Two additional configuration methods have been added for easier
11
+ translatability, fixing issues where English text was hardcoded:
12
+
13
+ * same_as_current_login_message (change_login feature)
14
+ * contains_null_byte_message (login_password_requirements_base
15
+ feature)
16
+
17
+ = Other Improvements
18
+
19
+ * Loading the rodauth plugin multiple times in the same application
20
+ with different blocks now works better. The same context is now
21
+ shared between the blocks, so you can load features in one block
22
+ and call configuration methods added by the feature in the other
23
+ block. Previously, you could only call configuration methods in
24
+ the block that added the feature, and enabling a feature in a
25
+ block that was already enabled in a previous block did not allow
26
+ the use of configuraton methods related to the feature.
27
+
28
+ * Passing a block when loading the rodauth plugin is now optional.
29
+
30
+ * The autocomplete attribute on the reset password form now uses
31
+ new-password instead of current-password.