rodauth 2.36.0 → 2.37.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rodauth/features/base.rb +15 -1
  3. data/lib/rodauth/features/change_login.rb +2 -2
  4. data/lib/rodauth/features/create_account.rb +2 -2
  5. data/lib/rodauth/features/email_auth.rb +1 -1
  6. data/lib/rodauth/features/internal_request.rb +4 -4
  7. data/lib/rodauth/features/json.rb +5 -0
  8. data/lib/rodauth/features/jwt.rb +5 -9
  9. data/lib/rodauth/features/lockout.rb +1 -1
  10. data/lib/rodauth/features/login.rb +1 -1
  11. data/lib/rodauth/features/login_password_requirements_base.rb +13 -0
  12. data/lib/rodauth/features/reset_password.rb +1 -1
  13. data/lib/rodauth/features/two_factor_base.rb +6 -13
  14. data/lib/rodauth/features/verify_account.rb +2 -2
  15. data/lib/rodauth/features/webauthn_autofill.rb +2 -1
  16. data/lib/rodauth/features/webauthn_login.rb +1 -1
  17. data/lib/rodauth/version.rb +1 -1
  18. data/lib/rodauth.rb +6 -2
  19. metadata +3 -258
  20. data/CHANGELOG +0 -521
  21. data/README.rdoc +0 -1555
  22. data/doc/account_expiration.rdoc +0 -41
  23. data/doc/active_sessions.rdoc +0 -56
  24. data/doc/argon2.rdoc +0 -54
  25. data/doc/audit_logging.rdoc +0 -44
  26. data/doc/base.rdoc +0 -123
  27. data/doc/change_login.rdoc +0 -25
  28. data/doc/change_password.rdoc +0 -26
  29. data/doc/change_password_notify.rdoc +0 -14
  30. data/doc/close_account.rdoc +0 -26
  31. data/doc/confirm_password.rdoc +0 -32
  32. data/doc/create_account.rdoc +0 -27
  33. data/doc/disallow_common_passwords.rdoc +0 -17
  34. data/doc/disallow_password_reuse.rdoc +0 -30
  35. data/doc/email_auth.rdoc +0 -55
  36. data/doc/email_base.rdoc +0 -18
  37. data/doc/error_reasons.rdoc +0 -77
  38. data/doc/guides/admin_activation.rdoc +0 -46
  39. data/doc/guides/already_authenticated.rdoc +0 -10
  40. data/doc/guides/alternative_login.rdoc +0 -46
  41. data/doc/guides/change_table_and_column_names.rdoc +0 -19
  42. data/doc/guides/create_account_programmatically.rdoc +0 -38
  43. data/doc/guides/delay_password.rdoc +0 -25
  44. data/doc/guides/email_only.rdoc +0 -16
  45. data/doc/guides/i18n.rdoc +0 -29
  46. data/doc/guides/internals.rdoc +0 -233
  47. data/doc/guides/links.rdoc +0 -12
  48. data/doc/guides/login_return.rdoc +0 -37
  49. data/doc/guides/migrate_password_hash_algorithm.rdoc +0 -15
  50. data/doc/guides/password_column.rdoc +0 -25
  51. data/doc/guides/password_confirmation.rdoc +0 -37
  52. data/doc/guides/password_requirements.rdoc +0 -43
  53. data/doc/guides/paths.rdoc +0 -51
  54. data/doc/guides/query_params.rdoc +0 -9
  55. data/doc/guides/redirects.rdoc +0 -17
  56. data/doc/guides/registration_field.rdoc +0 -68
  57. data/doc/guides/render_confirmation.rdoc +0 -17
  58. data/doc/guides/require_mfa.rdoc +0 -30
  59. data/doc/guides/reset_password_autologin.rdoc +0 -21
  60. data/doc/guides/share_configuration.rdoc +0 -34
  61. data/doc/guides/status_column.rdoc +0 -28
  62. data/doc/guides/totp_or_recovery.rdoc +0 -16
  63. data/doc/http_basic_auth.rdoc +0 -18
  64. data/doc/internal_request.rdoc +0 -539
  65. data/doc/json.rdoc +0 -56
  66. data/doc/jwt.rdoc +0 -52
  67. data/doc/jwt_cors.rdoc +0 -22
  68. data/doc/jwt_refresh.rdoc +0 -58
  69. data/doc/lockout.rdoc +0 -73
  70. data/doc/login.rdoc +0 -39
  71. data/doc/login_password_requirements_base.rdoc +0 -44
  72. data/doc/logout.rdoc +0 -22
  73. data/doc/otp.rdoc +0 -93
  74. data/doc/otp_lockout_email.rdoc +0 -30
  75. data/doc/otp_modify_email.rdoc +0 -19
  76. data/doc/otp_unlock.rdoc +0 -58
  77. data/doc/password_complexity.rdoc +0 -34
  78. data/doc/password_expiration.rdoc +0 -38
  79. data/doc/password_grace_period.rdoc +0 -24
  80. data/doc/password_pepper.rdoc +0 -52
  81. data/doc/path_class_methods.rdoc +0 -10
  82. data/doc/recovery_codes.rdoc +0 -61
  83. data/doc/release_notes/1.0.0.txt +0 -443
  84. data/doc/release_notes/1.1.0.txt +0 -8
  85. data/doc/release_notes/1.10.0.txt +0 -80
  86. data/doc/release_notes/1.11.0.txt +0 -32
  87. data/doc/release_notes/1.12.0.txt +0 -61
  88. data/doc/release_notes/1.13.0.txt +0 -34
  89. data/doc/release_notes/1.14.0.txt +0 -19
  90. data/doc/release_notes/1.15.0.txt +0 -21
  91. data/doc/release_notes/1.16.0.txt +0 -31
  92. data/doc/release_notes/1.17.0.txt +0 -23
  93. data/doc/release_notes/1.18.0.txt +0 -26
  94. data/doc/release_notes/1.19.0.txt +0 -116
  95. data/doc/release_notes/1.2.0.txt +0 -18
  96. data/doc/release_notes/1.20.0.txt +0 -175
  97. data/doc/release_notes/1.21.0.txt +0 -12
  98. data/doc/release_notes/1.22.0.txt +0 -11
  99. data/doc/release_notes/1.23.0.txt +0 -32
  100. data/doc/release_notes/1.3.0.txt +0 -21
  101. data/doc/release_notes/1.4.0.txt +0 -11
  102. data/doc/release_notes/1.5.0.txt +0 -74
  103. data/doc/release_notes/1.6.0.txt +0 -37
  104. data/doc/release_notes/1.7.0.txt +0 -6
  105. data/doc/release_notes/1.8.0.txt +0 -14
  106. data/doc/release_notes/1.9.0.txt +0 -15
  107. data/doc/release_notes/2.0.0.txt +0 -361
  108. data/doc/release_notes/2.1.0.txt +0 -31
  109. data/doc/release_notes/2.10.0.txt +0 -47
  110. data/doc/release_notes/2.11.0.txt +0 -31
  111. data/doc/release_notes/2.12.0.txt +0 -17
  112. data/doc/release_notes/2.13.0.txt +0 -19
  113. data/doc/release_notes/2.14.0.txt +0 -17
  114. data/doc/release_notes/2.15.0.txt +0 -48
  115. data/doc/release_notes/2.16.0.txt +0 -20
  116. data/doc/release_notes/2.17.0.txt +0 -10
  117. data/doc/release_notes/2.18.0.txt +0 -27
  118. data/doc/release_notes/2.19.0.txt +0 -61
  119. data/doc/release_notes/2.2.0.txt +0 -39
  120. data/doc/release_notes/2.20.0.txt +0 -10
  121. data/doc/release_notes/2.21.0.txt +0 -28
  122. data/doc/release_notes/2.22.0.txt +0 -43
  123. data/doc/release_notes/2.23.0.txt +0 -15
  124. data/doc/release_notes/2.24.0.txt +0 -15
  125. data/doc/release_notes/2.25.0.txt +0 -8
  126. data/doc/release_notes/2.26.0.txt +0 -45
  127. data/doc/release_notes/2.27.0.txt +0 -35
  128. data/doc/release_notes/2.28.0.txt +0 -16
  129. data/doc/release_notes/2.29.0.txt +0 -27
  130. data/doc/release_notes/2.3.0.txt +0 -37
  131. data/doc/release_notes/2.30.0.txt +0 -15
  132. data/doc/release_notes/2.31.0.txt +0 -47
  133. data/doc/release_notes/2.32.0.txt +0 -65
  134. data/doc/release_notes/2.33.0.txt +0 -18
  135. data/doc/release_notes/2.34.0.txt +0 -36
  136. data/doc/release_notes/2.35.0.txt +0 -22
  137. data/doc/release_notes/2.36.0.txt +0 -35
  138. data/doc/release_notes/2.4.0.txt +0 -22
  139. data/doc/release_notes/2.5.0.txt +0 -20
  140. data/doc/release_notes/2.6.0.txt +0 -37
  141. data/doc/release_notes/2.7.0.txt +0 -33
  142. data/doc/release_notes/2.8.0.txt +0 -20
  143. data/doc/release_notes/2.9.0.txt +0 -21
  144. data/doc/remember.rdoc +0 -79
  145. data/doc/reset_password.rdoc +0 -66
  146. data/doc/reset_password_notify.rdoc +0 -17
  147. data/doc/session_expiration.rdoc +0 -28
  148. data/doc/single_session.rdoc +0 -37
  149. data/doc/sms_codes.rdoc +0 -138
  150. data/doc/two_factor_base.rdoc +0 -70
  151. data/doc/update_password_hash.rdoc +0 -7
  152. data/doc/verify_account.rdoc +0 -67
  153. data/doc/verify_account_grace_period.rdoc +0 -19
  154. data/doc/verify_login_change.rdoc +0 -59
  155. data/doc/webauthn.rdoc +0 -118
  156. data/doc/webauthn_autofill.rdoc +0 -19
  157. data/doc/webauthn_login.rdoc +0 -16
  158. data/doc/webauthn_modify_email.rdoc +0 -19
  159. data/doc/webauthn_verify_account.rdoc +0 -9
@@ -1,539 +0,0 @@
1
- = Documentation for Internal Request Feature
2
-
3
- The internal request feature allows interacting with Rodauth by
4
- calling methods, and is expected to be used mostly for administrative
5
- purposes. It allows for things like an changing a login or password
6
- for an existing user, without requiring that the user login to the
7
- system. The reason the feature is named +internal_request+ is that
8
- it internally submits requests to Rodauth, which are handled almost
9
- identically to how actual web requests will be handled by Rodauth.
10
-
11
- The general form of calling these methods is:
12
-
13
- App.rodauth.internal_request_method(hash)
14
-
15
- Where +App+ is the Roda class, and +internal_request_method+ is the
16
- method you are calling. For example:
17
-
18
- App.rodauth.change_password(account_id: 1, password: 'foobar')
19
-
20
- Will change the password for the account with id 1 to +foobar+.
21
-
22
- All internal request methods support the following options. For
23
- internal requests that require an existing account, you should
24
- generally use one of the two following options:
25
-
26
- :account_id :: The id of the account to be considered as logged in when the internal request is submitted (most internal requests require a logged in account). This value is assumed to represent an existing account, the database is not checked to confirm that.
27
- :account_login :: The login of the account to be considered as logged in when the internal request is submitted (most internal requests require a login). This will query the database to determine the account's id before submitting the request. If there is no non-closed account for the login, this will raise an exception.
28
-
29
- There are additional options available, that you should only use
30
- if you have special requirements:
31
-
32
- :authenticated_by :: The array of strings to use for how the internal request's session was authenticated.
33
- :env :: A hash to merge into the internal request environment hash. Keys given will override default values, so you will probably have problems if you directly use an existing request environment.
34
- :session :: A hash for the session to use.
35
- :params :: A hash of custom parameters.
36
-
37
- All remaining options are considered parameters. Using the
38
- previous example:
39
-
40
- App.rodauth.change_password(account_id: 1, password: 'foobar')
41
-
42
- The <tt>password: 'foobar'</tt> part means that the parameters
43
- for the request will be <tt>{rodauth.password_param => 'foobar'}</tt>,
44
- where +rodauth.password_param+ is the value of +password_param+ in
45
- your Rodauth configuration (this defaults to <tt>"password"</tt>).
46
-
47
- Passing any options not mentioned above that are not valid Rodauth
48
- parameters will result in a warning.
49
-
50
- == Configuration
51
-
52
- In general, the configuration for internal requests is almost
53
- the same as for regular requests. There are some minor changes
54
- for easier usability. +modifications_require_password?+ (and
55
- similar methods for requiring password),
56
- +require_login_confirmation?+, and +require_password_confirmation?+
57
- are set to false. In general, the caller of the method should not
58
- be able to determine the user's password, and there is no point
59
- in requiring parameter confirmation when calling the method
60
- directly.
61
-
62
- You can override the configuration for internal requests by using
63
- the +internal_request_configuration+ configuration method. For
64
- example, you can set the minimum length for logins to be 15
65
- for normal requests, but only 3 for internal requests:
66
-
67
- plugin :rodauth do
68
- enable :create_account, :internal_request
69
- login_minimum_length 15
70
-
71
- internal_request_configuration do
72
- login_minimum_length 3
73
- end
74
- end
75
-
76
- Another approach for doing this is to call the +internal_request?+
77
- method inside configuration method blocks:
78
-
79
- plugin :rodauth do
80
- enable :create_account, :internal_request
81
- login_minimum_length{internal_request? ? 3 : 15}
82
- end
83
-
84
- == Return Values and Exceptions
85
-
86
- Internal request methods ending in a question mark return true or false.
87
- Most other internal request methods return nil on success, and or raise a
88
- Rodauth::InternalRequestError exception on failure. The exception
89
- message will include the flash message, {the reason for the
90
- failure}[rdoc-ref:doc/error_reasons.rdoc] if available, and any field errors.
91
- This data can also be retrieved via +flash+, +reason+, and +field_errors+
92
- attributes on the exception object.
93
-
94
- If an internal request method returns a non-nil value on success,
95
- it will be documented in the Features section below. In such
96
- cases, unless documented below, the methods will still raise a
97
- Rodauth::InternalRequestError exception on failure.
98
-
99
- == Domain
100
-
101
- While it is a good idea to use the +domain+ configuration method
102
- to force a domain to use, as it can avoid DNS rebinding attacks,
103
- Rodauth can function without it, as it can use the domain of the
104
- request. However, for internal requests, there is no submitted
105
- domain, and Rodauth does not know what to use as the domain. To
106
- avoid potentially using a wrong domain, Rodauth will raise an
107
- Rodauth::InternalRequestError in internal requests if a domain
108
- is needed and has not been configured.
109
-
110
- == Features
111
-
112
- This section documents the methods that are available for each
113
- feature. You must load that feature and the internal request feature
114
- in order to call the internal request methods for that feature.
115
- Some features support multiple internal request methods, and
116
- each internal request method supported will be documented under
117
- the appropriate subheading.
118
-
119
- If the method subheading states it it requires an account, you
120
- must pass the +:account_id+ or +account_login+ option when calling
121
- the method.
122
-
123
- If the method subheading states it it requires an account or
124
- a login, you must pass either +:login+, +:account_id+, or
125
- +account_login+ when calling the method.
126
-
127
- === Base
128
-
129
- === account_exists?
130
-
131
- The +account_exists?+ method returns whether the account exists
132
- for the given login.
133
-
134
- Options:
135
- +:login+ :: (required) The login for the account.
136
-
137
- === account_id_for_login
138
-
139
- The +account_id_for_login+ method returns the account id for
140
- the given login. A Rodauth::InternalRequestError is raised
141
- if the login given is not valid.
142
-
143
- Options:
144
- +:login+ :: (required) The login for the account.
145
-
146
- === internal_request_eval
147
-
148
- The +internal_request_eval+ requires a block and will +instance_eval+
149
- the block the context of an internal request instance. This allows
150
- you full usage of the +Rodauth::Auth+ API inside the request.
151
- Before using this method, you should have a good understanding
152
- of Rodauth's internals and the effects of calling any methods you
153
- are calling inside the block.
154
-
155
- The return value of the method will be the return value of the
156
- block, unless one of the methods in the block has set a
157
- different return value.
158
-
159
- === Change Login
160
-
161
- ==== change_login (requires account)
162
-
163
- The +change_login+ method changes the login for the account.
164
-
165
- Options:
166
- +:login+ :: (required) The new login for the account. Note that if the +:account_login+ option is provided, that is the current login for the account, not the new login.
167
-
168
- === Change Password
169
-
170
- ==== change_password (requires account)
171
-
172
- The +change_password+ method changes the password for the account.
173
-
174
- Options:
175
- +:password+ or +new_password+ :: (required) The new password for the account.
176
-
177
- === Close Account
178
-
179
- ==== close_account (requires account)
180
-
181
- The +close_account+ method closes the account. There is no method
182
- in Rodauth to reopen closed accounts.
183
-
184
- === Create Account
185
-
186
- ==== create_account
187
-
188
- The +create_account+ method creates an account.
189
-
190
- Options:
191
- +:login+ :: (required) The login for the created account.
192
- +:password+ :: The password for the created account.
193
-
194
- === Email Auth
195
-
196
- ==== email_auth_request (requires account or login)
197
-
198
- The +email_auth_request+ method requests an email with an
199
- authentication link be sent to the account's email address.
200
-
201
- ==== email_auth
202
-
203
- The +email_auth+ method determines if the given email authentication
204
- key is valid.
205
-
206
- This method will return the account id if the authentication key is
207
- valid.
208
-
209
- Options:
210
- +:email_auth_key+ :: (required) The email authentication key for the account.
211
-
212
- ==== valid_email_auth?
213
-
214
- The +valid_email_auth?+ method returns whether the given email
215
- authentication key is valid.
216
-
217
- Options:
218
- +:email_auth_key+ :: (required) The email authentication key for the account.
219
-
220
- === Lockout
221
-
222
- ==== lock_account (requires account)
223
-
224
- The +lock_account+ method locks an account, even if the account has
225
- not experienced any login failures. This is one method only available
226
- as an internal request.
227
-
228
- ==== unlock_account_request (requires account or login)
229
-
230
- The +unlock_account_request+ method requests an email with an
231
- link to unlock the account be sent to the account's email address.
232
-
233
- ==== unlock_account
234
-
235
- The +unlock_account+ method unlocks the account.
236
-
237
- If an +:account_id+ or +:account_login+ option is provided, this
238
- will unlock the account without requiring the unlock account key
239
- value.
240
-
241
- Options:
242
- +:unlock_account_key+ :: The unlock account key for the account. This allows unlocking accounts by key, without knowing the account id or login.
243
-
244
- === Login
245
-
246
- ==== login (requires account or login)
247
-
248
- The +login+ method determines if the given password is valid for
249
- the given account.
250
-
251
- This method will return the account id if the password is valid.
252
-
253
- Options:
254
- +:password+ :: (required) The password for the account.
255
-
256
- ==== valid_login_and_password? (requires account or login)
257
-
258
- The +valid_login_and_password?+ method returns whether the given
259
- password is valid for the given account.
260
-
261
- Options:
262
- +:password+ :: (required) The password for the account.
263
-
264
- === OTP
265
-
266
- ==== otp_setup_params (requires account)
267
-
268
- The +otp_setup_params+ method returns a hash with an +:otp_setup+
269
- key, and an +:otp_setup_raw+ key if the Rodauth configuration uses
270
- +hmac_secret+.
271
-
272
- The +:otp_setup+ key in the returned hash specifies the OTP secret.
273
-
274
- This hash should be merged into the options submitted to the
275
- +otp_setup+ method in order to complete OTP setup.
276
-
277
- ==== otp_setup (requires account)
278
-
279
- The +otp_setup+ method enables OTP multifactor authentication for
280
- the account.
281
-
282
- The values in the hash returned by the +otp_setup_params+ hash
283
- must be passed as options to this method.
284
-
285
- Additional Options:
286
- +:otp_auth+ :: (required) The current OTP authentication code for the OTP secret.
287
-
288
- ==== otp_auth (requires account)
289
-
290
- The +otp_auth+ method determines if the OTP authentication code is
291
- valid for the account.
292
-
293
- Options:
294
- +:otp_auth+ :: (required) The current OTP authentication code for account.
295
-
296
- ==== valid_otp_auth? (requires account)
297
-
298
- The +valid_otp_auth?+ method returns whether the OTP authentication
299
- code is valid for the account.
300
-
301
- Options:
302
- +:otp_auth+ :: (required) The current OTP authentication code for account.
303
-
304
- ==== otp_disable (requires account)
305
-
306
- The +otp_disable+ method disables OTP authentication for the account.
307
-
308
- === Recovery Codes
309
-
310
- ==== recovery_codes (requires account)
311
-
312
- The +recovery_codes+ method returns an array of recovery codes for
313
- the account. This array can be empty if no recovery codes are setup.
314
-
315
- Options:
316
- +:add_recovery_codes+ :: Generate new recovery codes for the account, up to the configured +recovery_codes_limit+, before returning the codes.
317
-
318
- ==== recovery_auth (requires account)
319
-
320
- The +recovery_auth+ method determines if the recovery authentication
321
- code is valid for the account.
322
-
323
- Options:
324
- +:recovery_codes+ :: (required) A valid recovery code for the account. This option sounds like it would take an array of recover codes, but it only takes a single recovery code.
325
-
326
- ==== valid_recovery_auth? (requires account)
327
-
328
- The +valid_recovery_auth?+ method returns whether the recovery
329
- authentication code is valid for the account.
330
-
331
- Options:
332
- +:recovery_codes+ :: (required) A valid recovery code for the account. This option sounds like it would take an array of recover codes, but it only takes a single recovery code.
333
-
334
- === Remember
335
-
336
- ==== remember_setup (requires_account)
337
-
338
- The +remember_setup+ method setups up the remember feature for
339
- the account, and returns the cookie value that can be used for
340
- the remember cookie.
341
-
342
- ==== remember_disable (requires_account)
343
-
344
- The +remember_disable+ method disables the remember feature for
345
- the account.
346
-
347
- ==== account_id_for_remember_key
348
-
349
- The +account_id_for_remember_key+ method returns the account id
350
- for the given remember key.
351
-
352
- Options:
353
- +:remember+ :: (required) The remember key for the account. This is the same value returned by +remember_setup+.
354
-
355
- === Reset Password
356
-
357
- ==== reset_password_request (requires account or login)
358
-
359
- The +reset_password_request+ method requests an email with an
360
- link to reset the password for the account be sent to the account's
361
- email address.
362
-
363
- ==== reset_password
364
-
365
- The +reset_password+ method resets the password for an account.
366
- This is similar to the +change_password+ method, but requires
367
- that a reset password key has been created for the account, and
368
- removes the key after the password has been reset.
369
-
370
- If an +:account_id+ or +:account_login+ option is provided, this
371
- will reset the password for the account without requiring the
372
- reset password key value.
373
-
374
- Options:
375
- +:password+ :: (required) The new password for the account.
376
- +:reset_password_key+ :: The reset password key for the account. This allows resetting passwords by key, without knowing the account id or login.
377
-
378
- === SMS Codes
379
-
380
- ==== sms_setup (requires account)
381
-
382
- The +sms_setup+ method sends an SMS message to the given
383
- phone number with a code to setup SMS authentication for
384
- the account.
385
-
386
- Options:
387
- +:sms_phone+ :: (required) The phone number to use to setup SMS authentication.
388
-
389
- ==== sms_confirm (requires account)
390
-
391
- The +sms_confirm+ method sets up SMS authentication for
392
- an account, confirming that the SMS authentication code
393
- sent previously was received.
394
-
395
- Options:
396
- +:sms_code+ :: (required) The authentication code sent to the user for setting up SMS authentication.
397
-
398
- ==== sms_request (requires account)
399
-
400
- The +sms_setup+ method sends an SMS message to the account's
401
- SMS phone number with an authentication code for two factor
402
- authentication.
403
-
404
- ==== sms_auth (requires account)
405
-
406
- The +sms_auth+ method determines if the SMS authentication code is
407
- valid for the account.
408
-
409
- Options:
410
- +:sms_code+ :: (required) The authentication code sent to the user via SMS.
411
-
412
- ==== valid_sms_auth? (requires account)
413
-
414
- The +valid_sms_auth?+ method returns whether the SMS authentication
415
- code is valid for the account.
416
-
417
- Options:
418
- +:sms_code+ :: (required) The authentication code sent to the user via SMS.
419
-
420
- ==== sms_disable (requires account)
421
-
422
- The +sms_disable+ method disables SMS authentication for the account.
423
-
424
- === Two Factor Base
425
-
426
- ==== two_factor_disable (requires_account)
427
-
428
- The +two_factor_disable+ method disables all multifactor authentication
429
- for the account.
430
-
431
- === Verify Account
432
-
433
- ==== verify_account_resend (requires account or login)
434
-
435
- The +verify_account_resend+ method resends the account verification email
436
- to the account's email address.
437
-
438
- ==== verify_account
439
-
440
- The +verify_account+ method verifies the account.
441
- to the account's email address.
442
-
443
- If an +:account_id+ or +:account_login+ option is provided, this
444
- will verify the account without requiring the verify account key value.
445
-
446
- Options:
447
- +:password+ :: The password for the account, if setting up passwords during verification.
448
- +:verify_account_key+ :: The verify account key for the account. This allows verifying accounts by key, without knowing the account id or login.
449
-
450
- === Verify Login Change
451
-
452
- ==== verify_login_change
453
-
454
- The +verify_login_change+ method verifies the login change for the
455
- account.
456
-
457
- If an +:account_id+ or +:account_login+ option is provided, this
458
- will verify the account without requiring the verify account key value.
459
- If the +:account_login+ option is provided, it specifies the current
460
- account login, before the change.
461
-
462
- Options:
463
- +:verify_login_change_key+ :: The verify login change key for the account. This allows verifying login changes by key, without knowing the account id or login.
464
-
465
- === WebAuthn
466
-
467
- ==== webauthn_setup_params (requires account)
468
-
469
- The +webauthn_setup_params+ method returns a hash with +:webauthn_setup+,
470
- +:webauthn_setup_challenge+ and +:webauthn_setup_challenge_hmac+ keys.
471
-
472
- The +:webauthn_setup+ options should be provided to the client for WebAuthn
473
- registration, while +:webauthn_setup_challenge+ and
474
- +webauthn_setup_challenge_hmac+ should be passed to the +webauthn_setup+
475
- method.
476
-
477
- ==== webauthn_setup (requires account)
478
-
479
- The +webauthn_setup+ method creates a WebAuthn credential for the account.
480
-
481
- Options:
482
- +:webauthn_setup+ :: The WebAuthn credential provided by the client during registration.
483
- +:webauthn_setup_challenge+ :: The WebAuthn challenge generated for registration.
484
- +:webauthn_setup_challenge_hmac+ :: The HMAC of the WebAuthn challenge generated for registration.
485
-
486
- ==== webauthn_auth_params (requires account)
487
-
488
- The +webauthn_auth_params+ method returns a hash with +:webauthn_auth+,
489
- +:webauthn_auth_challenge+ and +:webauthn_auth_challenge_hmac+ keys.
490
-
491
- The +:webauthn_auth+ options should be provided to the client for WebAuthn
492
- authentication, while +:webauthn_auth_challenge+ and
493
- +webauthn_auth_challenge_hmac+ should be passed to the +webauthn_auth+ method.
494
-
495
- ==== webauthn_auth (requires account)
496
-
497
- The +webauthn_auth+ method determines if the given WebAuthn credential is valid
498
- for the account.
499
-
500
- Options:
501
- +:webauthn_auth+ :: The WebAuthn credential provided by the client during authentication.
502
- +:webauthn_auth_challenge+ :: The WebAuthn challenge generated for authentication.
503
- +:webauthn_auth_challenge_hmac+ :: The HMAC of the WebAuthn challenge generated for authentication.
504
-
505
- ==== webauthn_remove (requires account)
506
-
507
- The +webauthn_remove+ methods deletes the given WebAuthn credential for the
508
- account.
509
-
510
- Options:
511
- +:webauthn_remove+ :: The ID of the WebAuthn credential to delete.
512
-
513
- === WebAuthn Login
514
-
515
- ==== webauthn_login_params (requires account or login)
516
-
517
- The +webauthn_login_params+ method returns a hash with +:webauthn_auth+,
518
- +:webauthn_auth_challenge+ and +:webauthn_auth_challenge_hmac+ keys.
519
-
520
- The +:webauthn_auth+ options should be provided to the client for WebAuthn
521
- authentication, while +:webauthn_auth_challenge+ and
522
- +webauthn_auth_challenge_hmac+ should be passed to the +webauthn_login+ method.
523
-
524
- ==== webauthn_login (requires account or login)
525
-
526
- The +webauthn_login+ method determines if the given WebAuthn credential is
527
- valid for the given account.
528
-
529
- This method will return the account id if the WebAuthn credential is valid.
530
-
531
- Options:
532
- +:webauthn_auth+ :: The WebAuthn credential provided by the client during authentication.
533
- +:webauthn_auth_challenge+ :: The WebAuthn challenge generated for authentication.
534
- +:webauthn_auth_challenge_hmac+ :: The HMAC of the WebAuthn challenge generated for authentication.
535
-
536
- === WebAuthn Autofill
537
-
538
- Enabling this feature modifies +webauthn_login_params+ and +webauthn_login+
539
- methods not to require an account or login.
data/doc/json.rdoc DELETED
@@ -1,56 +0,0 @@
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 JSON response can be modified at any point by modifying the +json_response+
19
- hash. The following example adds an {error reason}[rdoc-ref:doc/error_reasons.rdoc]
20
- to the JSON response:
21
-
22
- set_error_reason do |reason|
23
- json_response[:error_reason] = reason
24
- end
25
-
26
- The session state is managed in the rack session, so make sure that
27
- CSRF protection is enabled. This will be the case when passing the
28
- <tt>json: true</tt> option when loading the rodauth plugin. If you
29
- want to only handle JSON requests, set <tt>only_json? true</tt> in
30
- your rodauth configuration.
31
-
32
- If you want token-based authentication sent via the Authorization
33
- header, consider using the jwt feature.
34
-
35
- == Auth Value Methods
36
-
37
- json_accept_regexp :: The regexp to use to check the Accept header for JSON if +json_check_accept?+ is true.
38
- json_check_accept? :: Whether to check the Accept header to see if the client supports JSON responses, true by default.
39
- json_non_post_error_message :: The error message to use when a JSON non-POST request is sent.
40
- 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+.
41
- json_request_content_type_regexp :: The regexp to use to recognize a request as a json request.
42
- json_response_content_type :: The content type to set for json responses, <tt>application/json</tt> by default.
43
- 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.
44
- json_response_error? :: Whether the current JSON response indicates an error. By default, returns whether +json_response_error_key+ is set.
45
- json_response_error_key :: The JSON result key containing an error message, +error+ by default.
46
- json_response_error_status :: The HTTP status code to use for JSON error responses if not using custom error statuses, 400 by default.
47
- json_response_field_error_key :: The JSON result key containing an field error message, <tt>field-error</tt> by default.
48
- json_response_success_key :: The JSON result key containing a success message for successful request, if set. +success+ by default.
49
- non_json_request_error_message :: The error message to use when a non-JSON request is sent and +only_json?+ is set.
50
- 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.
51
- 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.
52
-
53
- == Auth Methods
54
-
55
- json_request? :: Whether the current request is a JSON request, looks at the Content-Type request header by default.
56
- 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 DELETED
@@ -1,52 +0,0 @@
1
- = Documentation for JWT Feature
2
-
3
- The jwt feature adds support for JSON API access for all other features
4
- that ship with Rodauth, using JWT (JSON Web Tokens) to hold the
5
- session information. It depends on the json feature.
6
-
7
- In order to use this feature, you have to set the +jwt_secret+ configuration
8
- option with the secret used to cryptographically protect the token.
9
-
10
- To use this JSON API, when processing responses for requests to a Rodauth
11
- endpoint, check for the Authorization header, and use the value of the
12
- response Authorization header as the request Authorization header in
13
- future requests, if the response Authorization header is set. If the
14
- response Authorization header is not set, then continue to use the
15
- previous Authorization header.
16
-
17
- When using this feature, consider using the <tt>json: :only</tt> option when
18
- loading the rodauth plugin, if you want Rodauth to only handle
19
- JSON requests. If you don't use the <tt>json: :only</tt> option, the jwt feature
20
- will probably result in an error if a request to a Rodauth endpoint comes
21
- in with a Content-Type that isn't application/json, unless you also set
22
- <tt>only_json? false</tt> in your rodauth configuration.
23
-
24
- If you would like to check if a valid JWT was submitted with the current
25
- request in your Roda app, you can call the +rodauth.valid_jwt?+ method. If
26
- +rodauth.valid_jwt?+ returns true, the contents of the jwt can be retrieved
27
- from +rodauth.session+.
28
-
29
- Logging the session out does not invalidate the previous JWT token by default.
30
- If you would like this behavior, you can use the active_sessions feature, which
31
- stores session identifiers in the database and deletes them when the session
32
- expires. This provides a whitelist approach of revoking JWT tokens.
33
-
34
- == Auth Value Methods
35
-
36
- invalid_jwt_format_error_message :: The error message to use when a JWT with an invalid format is submitted in the Authorization header.
37
- jwt_algorithm :: The JWT algorithm to use, +HS256+ by default.
38
- 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.
39
- jwt_authorization_remove :: A regexp to remove from the Authorization header before processing the JWT. By default, a Bearer prefix is removed.
40
- jwt_decode_opts :: An optional hash to pass to +JWT.decode+. Can be used to set JWT verifiers.
41
- jwt_old_secret :: The previous JWT secret used, to support JWT secret rotation (only supported when using jwt 2.4+). Access to this should be protected the same as a session secret.
42
- jwt_secret :: The JWT secret to use. Access to this should be protected the same as a session secret.
43
- jwt_session_key :: A key to nest the session hash under in the JWT payload. nil by default, for no nesting.
44
- jwt_symbolize_deeply? :: Whether to symbolize the session hash deeply. false by default.
45
- 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.
46
-
47
- == Auth Methods
48
-
49
- jwt_session_hash :: The session hash used to create the session_jwt. Can be used to set JWT claims.
50
- jwt_token :: Retrieve the JWT token from the request, by default taking it from the Authorization header.
51
- session_jwt :: An encoded JWT for the current session.
52
- set_jwt_token(token) :: Set the JWT token in the response, by default storing it in the Authorization header.
data/doc/jwt_cors.rdoc DELETED
@@ -1,22 +0,0 @@
1
- = Documentation for JWT CORS Feature
2
-
3
- The jwt_cors feature adds support for Cross-Origin Resource Sharing
4
- to Rodauth's JSON API.
5
-
6
- When this feature is used, CORS requests are handled. This includes
7
- CORS preflight requests, which are required since Rodauth's JSON API
8
- uses the application/json request content type.
9
-
10
- This feature depends on the jwt feature.
11
-
12
- == Auth Value Methods
13
-
14
- jwt_cors_allow_headers :: For allowed CORS-preflight requests, the value returned in the Access-Control-Allow-Headers header (default: 'Content-Type, Authorization, Accept'). This specifies which headers can be included in CORS requests.
15
- jwt_cors_allow_methods :: For allowed CORS-preflight requests, the value returned in the Access-Control-Allow-Methods header (default: 'POST'). This specifies which methods are allowed in CORS requests.
16
- jwt_cors_allow_origin :: Which origins are allowed to perform CORS requests. The default is +false+. This can be a String, Array of Strings, Regexp, or +true+ to allow CORS requests from any domain.
17
- jwt_cors_expose_headers :: For allowed CORS requests, the value returned in the Access-Control-Expose-Headers header (default: 'Authorization'). This specifies which headers the browser is allowed to access from a response to a CORS request.
18
- jwt_cors_max_age :: For allowed CORS-preflight requests, the value returned in the Access-Control-Max-Age header (default: 86400). This specifies how long before the information returned should be considered stale and another CORS preflight request made.
19
-
20
- == Auth Methods
21
-
22
- jwt_cors_allow? :: Whether the request should be allowed. This is called for all requests for a Rodauth route that include an Origin header. It should return true or false for whether to specially handle the cross-origin request. By default, uses the +jwt_cors_allow_origin+ setting to check the origin.