rodauth 0.10.0 → 1.0.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/CHANGELOG +146 -0
- data/README.rdoc +644 -220
- data/Rakefile +99 -11
- data/doc/account_expiration.rdoc +55 -0
- data/doc/base.rdoc +104 -0
- data/doc/change_login.rdoc +29 -0
- data/doc/change_password.rdoc +26 -0
- data/doc/close_account.rdoc +31 -0
- data/doc/confirm_password.rdoc +22 -0
- data/doc/create_account.rdoc +34 -0
- data/doc/disallow_password_reuse.rdoc +37 -0
- data/doc/email_base.rdoc +19 -0
- data/doc/jwt.rdoc +35 -0
- data/doc/lockout.rdoc +83 -0
- data/doc/login.rdoc +27 -0
- data/doc/login_password_requirements_base.rdoc +50 -0
- data/doc/logout.rdoc +21 -0
- data/doc/otp.rdoc +100 -0
- data/doc/password_complexity.rdoc +50 -0
- data/doc/password_expiration.rdoc +52 -0
- data/doc/password_grace_period.rdoc +10 -0
- data/doc/recovery_codes.rdoc +60 -0
- data/doc/release_notes/1.0.0.txt +443 -0
- data/doc/remember.rdoc +82 -0
- data/doc/reset_password.rdoc +70 -0
- data/doc/session_expiration.rdoc +27 -0
- data/doc/single_session.rdoc +43 -0
- data/doc/sms_codes.rdoc +119 -0
- data/doc/two_factor_base.rdoc +27 -0
- data/doc/verify_account.rdoc +70 -0
- data/doc/verify_account_grace_period.rdoc +15 -0
- data/doc/verify_change_login.rdoc +9 -0
- data/lib/roda/plugins/rodauth.rb +3 -262
- data/lib/rodauth.rb +260 -0
- data/lib/rodauth/features/account_expiration.rb +108 -0
- data/lib/rodauth/features/base.rb +479 -0
- data/lib/rodauth/features/change_login.rb +77 -0
- data/lib/rodauth/features/change_password.rb +66 -0
- data/lib/rodauth/features/close_account.rb +82 -0
- data/lib/rodauth/features/confirm_password.rb +51 -0
- data/lib/rodauth/features/create_account.rb +128 -0
- data/lib/rodauth/features/disallow_password_reuse.rb +82 -0
- data/lib/rodauth/features/email_base.rb +63 -0
- data/lib/rodauth/features/jwt.rb +151 -0
- data/lib/rodauth/features/lockout.rb +262 -0
- data/lib/rodauth/features/login.rb +61 -0
- data/lib/rodauth/features/login_password_requirements_base.rb +123 -0
- data/lib/rodauth/features/logout.rb +37 -0
- data/lib/rodauth/features/otp.rb +338 -0
- data/lib/rodauth/features/password_complexity.rb +89 -0
- data/lib/rodauth/features/password_expiration.rb +111 -0
- data/lib/rodauth/features/password_grace_period.rb +46 -0
- data/lib/rodauth/features/recovery_codes.rb +240 -0
- data/lib/rodauth/features/remember.rb +200 -0
- data/lib/rodauth/features/reset_password.rb +207 -0
- data/lib/rodauth/features/session_expiration.rb +55 -0
- data/lib/rodauth/features/single_session.rb +87 -0
- data/lib/rodauth/features/sms_codes.rb +498 -0
- data/lib/rodauth/features/two_factor_base.rb +135 -0
- data/lib/rodauth/features/verify_account.rb +232 -0
- data/lib/rodauth/features/verify_account_grace_period.rb +76 -0
- data/lib/rodauth/features/verify_change_login.rb +20 -0
- data/lib/rodauth/migrations.rb +130 -0
- data/lib/rodauth/version.rb +9 -0
- data/spec/account_expiration_spec.rb +90 -0
- data/spec/all.rb +1 -0
- data/spec/change_login_spec.rb +149 -0
- data/spec/change_password_spec.rb +177 -0
- data/spec/close_account_spec.rb +162 -0
- data/spec/confirm_password_spec.rb +70 -0
- data/spec/create_account_spec.rb +127 -0
- data/spec/disallow_password_reuse_spec.rb +84 -0
- data/spec/lockout_spec.rb +228 -0
- data/spec/login_spec.rb +188 -0
- data/spec/migrate/001_tables.rb +103 -16
- data/spec/migrate/002_account_password_hash_column.rb +11 -0
- data/spec/migrate_password/001_tables.rb +60 -42
- data/spec/migrate_travis/001_tables.rb +116 -0
- data/spec/password_complexity_spec.rb +108 -0
- data/spec/password_expiration_spec.rb +243 -0
- data/spec/password_grace_period_spec.rb +93 -0
- data/spec/remember_spec.rb +424 -0
- data/spec/reset_password_spec.rb +185 -0
- data/spec/rodauth_spec.rb +57 -980
- data/spec/session_expiration_spec.rb +58 -0
- data/spec/single_session_spec.rb +107 -0
- data/spec/spec_helper.rb +202 -0
- data/spec/two_factor_spec.rb +1310 -0
- data/spec/verify_account_grace_period_spec.rb +135 -0
- data/spec/verify_account_spec.rb +142 -0
- data/spec/verify_change_login_spec.rb +46 -0
- data/spec/views/login.str +2 -2
- data/templates/add-recovery-codes.str +2 -0
- data/templates/button.str +5 -0
- data/templates/change-login.str +5 -18
- data/templates/change-password.str +6 -14
- data/templates/close-account.str +3 -6
- data/templates/confirm-password.str +4 -14
- data/templates/create-account.str +6 -30
- data/templates/login-confirm-field.str +6 -0
- data/templates/login-field.str +6 -0
- data/templates/login.str +5 -19
- data/templates/logout.str +2 -6
- data/templates/otp-auth-code-field.str +6 -0
- data/templates/otp-auth.str +8 -0
- data/templates/otp-disable.str +6 -0
- data/templates/otp-setup.str +21 -0
- data/templates/password-confirm-field.str +6 -0
- data/templates/password-field.str +6 -0
- data/templates/recovery-auth.str +12 -0
- data/templates/recovery-codes.str +6 -0
- data/templates/remember.str +8 -12
- data/templates/reset-password-request.str +2 -2
- data/templates/reset-password.str +4 -18
- data/templates/sms-auth.str +6 -0
- data/templates/sms-code-field.str +6 -0
- data/templates/sms-confirm.str +7 -0
- data/templates/sms-disable.str +7 -0
- data/templates/sms-request.str +5 -0
- data/templates/sms-setup.str +12 -0
- data/templates/unlock-account-request.str +3 -7
- data/templates/unlock-account.str +4 -7
- data/templates/verify-account-resend.str +2 -2
- data/templates/verify-account.str +2 -6
- metadata +191 -29
- data/lib/roda/plugins/rodauth/base.rb +0 -428
- data/lib/roda/plugins/rodauth/change_login.rb +0 -48
- data/lib/roda/plugins/rodauth/change_password.rb +0 -42
- data/lib/roda/plugins/rodauth/close_account.rb +0 -42
- data/lib/roda/plugins/rodauth/create_account.rb +0 -92
- data/lib/roda/plugins/rodauth/lockout.rb +0 -292
- data/lib/roda/plugins/rodauth/login.rb +0 -81
- data/lib/roda/plugins/rodauth/logout.rb +0 -36
- data/lib/roda/plugins/rodauth/remember.rb +0 -226
- data/lib/roda/plugins/rodauth/reset_password.rb +0 -205
- data/lib/roda/plugins/rodauth/verify_account.rb +0 -228
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
= Documentation for Disallow Password Reuse Feature
|
|
2
|
+
|
|
3
|
+
The disallow password reuse feature disallows setting of a password
|
|
4
|
+
that matches a number of previous passwords (6 by default).
|
|
5
|
+
|
|
6
|
+
On databases where Rodauth supports the use of database authentication
|
|
7
|
+
functions, Rodauth also supports the use of database functions for checking
|
|
8
|
+
previous passwords, so previous password hashes enjoy the same database
|
|
9
|
+
security as current password hashes.
|
|
10
|
+
|
|
11
|
+
It is not recommended to use this feature unless you have a policy that
|
|
12
|
+
requires it. This will significantly slow down setting a new password
|
|
13
|
+
due to the need to check all of the previous stored passwords. Additionally,
|
|
14
|
+
storing previous passwords means that if attackers can get access to the
|
|
15
|
+
the database, they can get the previous stored passwords in addition to the
|
|
16
|
+
current password.
|
|
17
|
+
|
|
18
|
+
== Auth Value Methods
|
|
19
|
+
|
|
20
|
+
password_same_as_previous_password_message :: The error message fragment to display if the
|
|
21
|
+
given password is the same as a previous
|
|
22
|
+
password.
|
|
23
|
+
previous_password_account_id_column :: The column in the +previous_password_hash_table+ that
|
|
24
|
+
stores the account id.
|
|
25
|
+
previous_password_hash_column :: The column in the +previous_password_hash_table+ that
|
|
26
|
+
stores the password hash.
|
|
27
|
+
previous_password_hash_table :: The table storing previous password hashes.
|
|
28
|
+
previous_password_id_column :: The column in the +previous_password_hash_table+ that
|
|
29
|
+
stores the autoincrementing primary key.
|
|
30
|
+
previous_passwords_to_check :: The number of previous password hashes to store and check.
|
|
31
|
+
|
|
32
|
+
== Auth Methods
|
|
33
|
+
|
|
34
|
+
add_previous_password_hash(hash) :: Add the given hash to the list of previous hashes for
|
|
35
|
+
the current account.
|
|
36
|
+
password_doesnt_match_previous_password?(password) :: Whether the password given matches any
|
|
37
|
+
of the previous passwords.
|
data/doc/email_base.rdoc
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
= Documentation for Email Base Feature
|
|
2
|
+
|
|
3
|
+
The email base feature is automatically loaded when you use a Rodauth feature
|
|
4
|
+
that requires sending emails.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
email_from :: The from address to use for emails sent by Rodauth.
|
|
9
|
+
email_subject_prefix :: The prefix to use for email subjects
|
|
10
|
+
require_mail? :: Set to false to not require mail, useful if using a different
|
|
11
|
+
library for sending email.
|
|
12
|
+
token_separator :: The string used to separate account id from the random key in links.
|
|
13
|
+
|
|
14
|
+
== Auth Methods
|
|
15
|
+
|
|
16
|
+
email_to :: The email address to send emails to, by default the login of the
|
|
17
|
+
current account.
|
|
18
|
+
create_email(subject, body) :: Return a Mail::Message instance with the given subject
|
|
19
|
+
and body.
|
data/doc/jwt.rdoc
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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 as the token format.
|
|
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.
|
|
9
|
+
|
|
10
|
+
Responses are returned as JSON hashes. In case of an error, the "error"
|
|
11
|
+
entry is set to an error message, and the "field-error" entry is set to
|
|
12
|
+
an array containing the field name and the error message for that field.
|
|
13
|
+
Successful requests by default store a "success" entry with a success
|
|
14
|
+
message, though that can be disabled.
|
|
15
|
+
|
|
16
|
+
In order to use this feature, you have to set the +jwt_secret+ configuration
|
|
17
|
+
option the secret used to cryptographically protect the token.
|
|
18
|
+
|
|
19
|
+
== Auth Value Methods
|
|
20
|
+
|
|
21
|
+
json_non_post_error_message :: The error message to use when a JSON non-POST request is sent.
|
|
22
|
+
json_response_error_key :: The JSON result key containing an error message, "error" by default.
|
|
23
|
+
json_response_error_status :: The HTTP status code to use for JSON error responses, 400 by default.
|
|
24
|
+
json_response_field_error_key :: The JSON result key containing an field error message, "field-error" by default.
|
|
25
|
+
json_response_success_key :: The JSON result key containing a success message for successful request, if set. nil by default to not set success messages.
|
|
26
|
+
jwt_algorithm :: The JWT algorithm to use, "HS256" by default.
|
|
27
|
+
non_json_request_error_message :: The error message to use when a non-JSON request is sent and +only_json?+ is set.
|
|
28
|
+
only_json? :: Whether to have Rodauth only allow JSON requests. True by default, which means that rodauth will issue an error for non-JSON requests.
|
|
29
|
+
jwt_secret :: The JWT secret to use. Access to this should be protected the same as a session secret.
|
|
30
|
+
|
|
31
|
+
== Auth Methods
|
|
32
|
+
|
|
33
|
+
json_request? :: Whether the current request is a JSON request, looks at the Content-Type request header by default.
|
|
34
|
+
jwt_token :: Retrieve the JWT token from the request, by default taking it from the Authorization header.
|
|
35
|
+
set_jwt_token(token) :: Set the JWT token in the response, by default storing it in the Authorization header.
|
data/doc/lockout.rdoc
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
= Documentation for Lockout Feature
|
|
2
|
+
|
|
3
|
+
The lockout feature implements bruteforce protection for accounts.
|
|
4
|
+
It depends on the login feature. If a user fails to login due to
|
|
5
|
+
a password error more than a given number of times, their account
|
|
6
|
+
gets locked out, and they are given an option to request an account
|
|
7
|
+
unlock via an email sent to them.
|
|
8
|
+
|
|
9
|
+
== Auth Value Methods
|
|
10
|
+
|
|
11
|
+
account_lockouts_id_column :: The id column in the account lockouts table,
|
|
12
|
+
should be a foreign key referencing the accounts
|
|
13
|
+
table.
|
|
14
|
+
account_lockouts_deadline_column :: The deadline column in the account lockouts
|
|
15
|
+
table, containing how long the account is
|
|
16
|
+
locked out until.
|
|
17
|
+
account_lockouts_deadline_interval :: The amount of time for which to lock out accounts,
|
|
18
|
+
1 day by default.
|
|
19
|
+
account_lockouts_key_column :: The unlock key column in the account lockouts table.
|
|
20
|
+
account_lockouts_table :: The table containing account lockout information.
|
|
21
|
+
account_login_failures_id_column :: The id column in the account login failures table,
|
|
22
|
+
should be a foreign key referencing the accounts
|
|
23
|
+
table.
|
|
24
|
+
account_login_failures_number_column :: The column in the account login failures table
|
|
25
|
+
containing the number of login failures for the
|
|
26
|
+
account.
|
|
27
|
+
account_login_failures_table :: The table containing number of login failures
|
|
28
|
+
per account.
|
|
29
|
+
login_lockout_error_flash :: The flash error to show if there if the account is or becomes
|
|
30
|
+
locked out after a login attempt.
|
|
31
|
+
max_invalid_logins :: The maximum number of failed logins before account lockout. As this
|
|
32
|
+
feature is just designed for bruteforce protection, this is set to
|
|
33
|
+
100.
|
|
34
|
+
unlock_account_additional_form_tags :: HTML fragment with additional form tags to use
|
|
35
|
+
on the unlock account form.
|
|
36
|
+
unlock_account_autologin? :: Whether to autologin users after successful account unlock.
|
|
37
|
+
unlock_account_button :: The text to use on the unlock account button.
|
|
38
|
+
unlock_account_email_subject :: The subject to use for the unlock account email.
|
|
39
|
+
unlock_account_error_flash :: The flash error to display upon unsuccessful account unlock.
|
|
40
|
+
unlock_account_key_param :: The parameter name to use for the unlock account key.
|
|
41
|
+
unlock_account_notice_flash :: The flash notice to display upon successful account unlock.
|
|
42
|
+
unlock_account_redirect :: Where to redirect after successful account unlock.
|
|
43
|
+
unlock_account_request_additional_form_tags :: HTML fragment with additional form tags to use
|
|
44
|
+
on the form to request an account unlock.
|
|
45
|
+
unlock_account_request_button :: The text to use on the unlock account request button.
|
|
46
|
+
unlock_account_request_notice_flash :: The flash notice to display upon successful sending of
|
|
47
|
+
the unlock account email.
|
|
48
|
+
unlock_account_request_redirect :: Where to redirect after account unlock email is sent.
|
|
49
|
+
unlock_account_request_route :: The route to the unlock account request action.
|
|
50
|
+
unlock_account_requires_password? :: Whether a password is required when unlocking accounts,
|
|
51
|
+
false by default. May want to set to true if not
|
|
52
|
+
allowing password resets.
|
|
53
|
+
unlock_account_route :: Alias for lockout_route.
|
|
54
|
+
|
|
55
|
+
== Auth Methods
|
|
56
|
+
|
|
57
|
+
account_from_unlock_key(key) :: Retrieve the account using the given verify
|
|
58
|
+
account key, or return nil if no account
|
|
59
|
+
matches.
|
|
60
|
+
after_unlock_account :: Run arbitrary code after a successful account unlock.
|
|
61
|
+
after_unlock_account_request :: Run arbitrary code after a successful account
|
|
62
|
+
unlock request.
|
|
63
|
+
before_unlock_account :: Run arbitrary code before unlocking an account.
|
|
64
|
+
before_unlock_account_request :: Run arbitrary code before sending an account
|
|
65
|
+
unlock email.
|
|
66
|
+
before_lockout_route :: Run arbitrary code before handling an unlock account route.
|
|
67
|
+
clear_invalid_login_attempts :: Clear any stored login failures or lockouts for
|
|
68
|
+
the current account.
|
|
69
|
+
create_unlock_account_email :: A Mail::Message for the account unlock email to send.
|
|
70
|
+
generate_unlock_account_key :: A random string to use for a new unlock account key.
|
|
71
|
+
get_unlock_account_key :: Retrieve the unlock account key for the current account.
|
|
72
|
+
invalid_login_attempt :: Record an invalid login attempt, incrementing the
|
|
73
|
+
number of login failures, and possibly locking out
|
|
74
|
+
the account.
|
|
75
|
+
locked_out? :: Whether the current account is locked out.
|
|
76
|
+
send_unlock_account_email :: Send the account unlock email.
|
|
77
|
+
unlock_account_email_body :: The body to use for the unlock account email.
|
|
78
|
+
unlock_account_email_link :: The link to the unlock account form to include in the
|
|
79
|
+
unlock account email.
|
|
80
|
+
unlock_account :: Unlock the account.
|
|
81
|
+
unlock_account_key :: The unlock account key for the current account.
|
|
82
|
+
unlock_account_request_view :: The HTML to use for the unlock account request form.
|
|
83
|
+
unlock_account_view :: The HTML to use for the unlock account form.
|
data/doc/login.rdoc
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
= Documentation for Login Feature
|
|
2
|
+
|
|
3
|
+
The login feature implements a login page. It's the most commonly
|
|
4
|
+
used feature.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
login_additional_form_tags :: HTML fragment containing additional form
|
|
9
|
+
tags to use on the login form.
|
|
10
|
+
login_button :: The text to use for the login button.
|
|
11
|
+
login_error_flash :: The flash error to show for an unsuccesful login.
|
|
12
|
+
login_form_footer :: A message to display after the login form.
|
|
13
|
+
login_notice_flash :: The flash notice to show after successful login.
|
|
14
|
+
login_redirect :: Where to redirect after a sucessful login.
|
|
15
|
+
login_route :: The route to the login action.
|
|
16
|
+
|
|
17
|
+
== Auth Methods
|
|
18
|
+
|
|
19
|
+
after_login :: Run arbitrary code after a successful login.
|
|
20
|
+
after_login_failure :: Run arbitrary code after a login failure due to
|
|
21
|
+
an invalid password.
|
|
22
|
+
before_login :: Run arbitrary code after password has been checked, but
|
|
23
|
+
before updating the session.
|
|
24
|
+
before_login_attempt :: Run arbitrary code after an account has been
|
|
25
|
+
located, but before the password has been checked.
|
|
26
|
+
before_login_route :: Run arbitrary code before handling a login route.
|
|
27
|
+
login_view :: The HTML to use for the login form.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
= Documentation for Login Password Requirements Base Feature
|
|
2
|
+
|
|
3
|
+
The login password requirements base feature is automatically loaded when you
|
|
4
|
+
use a Rodauth feature that requires setting logins or passwords.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
login_confirm_label :: The label to use for login confirmations.
|
|
9
|
+
login_confirm_param :: The parameter name to use for login confirmations.
|
|
10
|
+
login_does_not_meet_requirements_message :: The error message to display when
|
|
11
|
+
the login does not meet the
|
|
12
|
+
requirements you have set.
|
|
13
|
+
login_minimum_length :: The minimum length for logins, 3 by default.
|
|
14
|
+
login_too_short_message :: The error message fragment to show if the login is
|
|
15
|
+
too short.
|
|
16
|
+
logins_do_not_match_message :: The error message to display when login and
|
|
17
|
+
login confirmation do not match.
|
|
18
|
+
password_confirm_label :: The label to use for password confirmations.
|
|
19
|
+
password_confirm_param :: The parameter name to use for password confirmations.
|
|
20
|
+
password_does_not_meet_requirements_message :: The error message to display when
|
|
21
|
+
the password does not meet the
|
|
22
|
+
requirements you have set.
|
|
23
|
+
password_hash_cost :: The bcrypt cost to use for the password hash.
|
|
24
|
+
password_minimum_length :: The minimum length for passwords, 6 by default.
|
|
25
|
+
password_too_short_message :: The error message fragment to show if the password
|
|
26
|
+
is too short.
|
|
27
|
+
passwords_do_not_match_message :: The error message to display when password
|
|
28
|
+
and password confirmation do not match.
|
|
29
|
+
require_email_address_logins? :: Whether logins need to be valid email addresses,
|
|
30
|
+
true by default.
|
|
31
|
+
require_login_confirmation? :: Whether login confirmations are required when
|
|
32
|
+
changing logins or creating accounts.
|
|
33
|
+
require_password_confirmation? :: Whether password confirmations are required
|
|
34
|
+
when changing/resetting passwords and creating
|
|
35
|
+
accounts.
|
|
36
|
+
same_as_existing_password_message :: The error message to display when a new
|
|
37
|
+
password is the same as the existing password.
|
|
38
|
+
|
|
39
|
+
== Auth Methods
|
|
40
|
+
|
|
41
|
+
login_meets_requirements?(login) :: Whether the given login meets the requirements.
|
|
42
|
+
By default, just checks that the login is a
|
|
43
|
+
valid email address.
|
|
44
|
+
password_meets_requirements?(password) :: Whether the given password meets the
|
|
45
|
+
requirements. Can be used to implement
|
|
46
|
+
complexity requirements for passwords.
|
|
47
|
+
password_hash(password) :: A hash of the given password.
|
|
48
|
+
set_password(password) :: Set the password for the current account to the given
|
|
49
|
+
password.
|
|
50
|
+
|
data/doc/logout.rdoc
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
= Documentation for Logout Feature
|
|
2
|
+
|
|
3
|
+
The logout feature implements a logout button, which clears the session.
|
|
4
|
+
It is the simplest feature.
|
|
5
|
+
|
|
6
|
+
== Auth Value Methods
|
|
7
|
+
|
|
8
|
+
logout_additional_form_tags :: HTML fragment containing additional form
|
|
9
|
+
tags to use on the logout form.
|
|
10
|
+
logout_button :: The text to use for the logout button.
|
|
11
|
+
logout_notice_flash :: The flash notice to show after logout.
|
|
12
|
+
logout_redirect :: Where to redirect after a logout.
|
|
13
|
+
logout_route :: The route to the logout action.
|
|
14
|
+
|
|
15
|
+
== Auth Methods
|
|
16
|
+
|
|
17
|
+
after_logout :: Run arbitrary code after logout.
|
|
18
|
+
before_logout :: Run arbitrary code before logout.
|
|
19
|
+
before_logout_route :: Run arbitrary code before handling a logout route.
|
|
20
|
+
logout :: Log the user out, by default clearing the session.
|
|
21
|
+
logout_view :: The HTML to use for the logout form.
|
data/doc/otp.rdoc
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
= Documentation for OTP Feature
|
|
2
|
+
|
|
3
|
+
The otp feature implements a 2 factor authentication via time-based one-time
|
|
4
|
+
passwords (TOTP). It supports signing up for 2 factor authentication, logging
|
|
5
|
+
in with authentication codes, and disabling two factor authentication.
|
|
6
|
+
|
|
7
|
+
The otp feature requires the rotp and rqrcode gems.
|
|
8
|
+
|
|
9
|
+
== Auth Value Methods
|
|
10
|
+
|
|
11
|
+
otp_already_setup_error_flash :: The flash error to show if going to the OTP setup
|
|
12
|
+
page when OTP is already setup.
|
|
13
|
+
otp_already_setup_redirect :: Where to redirect if going to the OTP setup page when OTP
|
|
14
|
+
has already been setup.
|
|
15
|
+
otp_auth_additional_form_tags :: HTML fragment containing additional form tags to use on
|
|
16
|
+
the OTP authentication form.
|
|
17
|
+
otp_auth_button :: Text to use for button on OTP authentication form.
|
|
18
|
+
otp_auth_error_flash :: The flash error to show if unable to authenticate via OTP.
|
|
19
|
+
otp_auth_failures_limit :: The number of allowed OTP authentication failures before locking
|
|
20
|
+
out.
|
|
21
|
+
otp_auth_form_footer :: A footer to display at the bottom of the OTP authentication form.
|
|
22
|
+
otp_auth_label :: The label for the OTP authentication code.
|
|
23
|
+
otp_auth_param :: The parameter name for the OTP authentication code.
|
|
24
|
+
otp_auth_route :: The route to the OTP authentication action.
|
|
25
|
+
otp_class :: The class to use for OTP authentication (default: ROTP::TOTP)
|
|
26
|
+
otp_digits :: The number of digits to use in OTP authentication codes (rotp's default is 6).
|
|
27
|
+
otp_disable_additional_form_tags :: HTML fragment containing additional form tags to use on
|
|
28
|
+
the from to disable OTP authentication.
|
|
29
|
+
otp_disable_button :: The text to use for button on form to disable OTP authentication.
|
|
30
|
+
otp_disable_error_flash :: The flash error to show if unable to disable OTP authentication.
|
|
31
|
+
otp_disable_notice_flash :: The flash notice to show after disabling OTP authentication.
|
|
32
|
+
otp_disable_redirect :: Where to redirect after disabling OTP authentication.
|
|
33
|
+
otp_disable_route :: The route to the OTP disable action.
|
|
34
|
+
otp_invalid_auth_code_message :: The error message to show when an invalid OTP authentication
|
|
35
|
+
code is used.
|
|
36
|
+
otp_invalid_secret_message :: The error message to show when an invalid OTP secret is submitted
|
|
37
|
+
during OTP setup.
|
|
38
|
+
otp_interval :: The number of seconds in which to rotate TOTP auth codes (rotp's default is 300).
|
|
39
|
+
otp_issuer :: The issuer to use in the OTP provisioning URL. Defaults to the host name of the
|
|
40
|
+
request.
|
|
41
|
+
otp_keys_id_column :: The column in the otp_keys_table containing the account id.
|
|
42
|
+
otp_keys_column :: The column in the otp_keys_table containing the OTP secret.
|
|
43
|
+
otp_keys_failures_column :: The column in the otp_keys_table containing the
|
|
44
|
+
number of OTP authentication failures.
|
|
45
|
+
otp_keys_last_use_column :: The column in otp_keys_table containing the last authentication
|
|
46
|
+
timestamp.
|
|
47
|
+
otp_keys_table :: The table name containing the OTP secrets.
|
|
48
|
+
otp_lockout_redirect :: Where to redirect if going to OTP authentication page and OTP
|
|
49
|
+
authentication has been locked out.
|
|
50
|
+
otp_lockout_error_flash :: The flash error show show when OTP authentication has been locked
|
|
51
|
+
out due to numerous authentication failures.
|
|
52
|
+
otp_modifications_require_password? :: Whether modifying OTP settings requires reentering the
|
|
53
|
+
password for the account, true by default.
|
|
54
|
+
otp_session_key :: The session key used to store whether the user has authenticated via OTP.
|
|
55
|
+
otp_setup_additional_form_tags :: HTML fragment containing additional form tags when setting up
|
|
56
|
+
OTP authentication.
|
|
57
|
+
otp_setup_button :: Text for the button when setting up OTP authentication.
|
|
58
|
+
otp_setup_error_flash :: The flash error to show if OTP authentication setup was not successful.
|
|
59
|
+
otp_setup_notice_flash :: The flash notice to show if OTP authentication setup was successful.
|
|
60
|
+
otp_setup_param :: The parameter name used for the OTP secret when setting up OTP authentication.
|
|
61
|
+
otp_setup_redirect :: Where to redirect after sucessful OTP authentication setup.
|
|
62
|
+
otp_setup_route :: The route to the OTP setup action.
|
|
63
|
+
|
|
64
|
+
== Auth Methods
|
|
65
|
+
|
|
66
|
+
after_otp_authentication_failure :: Run arbitrary code after OTP authentication failure.
|
|
67
|
+
after_otp_disable :: Run arbitrary code after OTP authentication has been disabled.
|
|
68
|
+
after_otp_setup :: Run arbitrary code after OTP authentication has been setup.
|
|
69
|
+
before_otp_authentication :: Run arbitrary code before OTP authentication.
|
|
70
|
+
before_otp_authentication_route :: Run arbitrary code before handling an OTP authentication route.
|
|
71
|
+
before_otp_setup :: Run arbitrary code before OTP authentication setup.
|
|
72
|
+
before_otp_setup_route :: Run arbitrary code before handling an OTP authentication setup route.
|
|
73
|
+
before_otp_disable :: Run arbitrary code before OTP authentication disabling.
|
|
74
|
+
before_otp_disable_route :: Run arbitrary code before handling an OTP authentication disable route.
|
|
75
|
+
otp :: The object used for verifying OTP authentication attempts.
|
|
76
|
+
otp_add_key(secret) :: Add an OTP key for the current account with the given secret.
|
|
77
|
+
otp_auth_view :: The HTML to use for the OTP authentication form.
|
|
78
|
+
otp_disable_view :: The HTML to use for the OTP disable form.
|
|
79
|
+
otp_exists? :: Whether the current account has setup OTP.
|
|
80
|
+
otp_key :: The stored OTP secret for the account.
|
|
81
|
+
otp_locked_out? :: Whether the current account has been locked out of OTP authentication.
|
|
82
|
+
otp_new_secret :: A new secret to use when setting up OTP.
|
|
83
|
+
otp_provisioning_name :: The provisioning name to use during OTP setup, defaults to the
|
|
84
|
+
account's email.
|
|
85
|
+
otp_provisioning_uri :: The provisioning URI displayed during OTP setup.
|
|
86
|
+
otp_qr_code :: The QR code containing the otp_provisioning_uri, by default an SVG image.
|
|
87
|
+
otp_record_authentication_failure :: Record an OTP authentication failure.
|
|
88
|
+
otp_remove :: Removes all stored OTP data for the current account.
|
|
89
|
+
otp_remove_auth_failures :: Removes OTP authentication failures for the current account,
|
|
90
|
+
used after successful OTP authentication.
|
|
91
|
+
otp_setup_view :: The HTML to use for the form to setup OTP authentication.
|
|
92
|
+
otp_tmp_key(secret) :: Set the secret to use for the OTP key.
|
|
93
|
+
otp_update_last_use :: Update the last time OTP authentication was successful for the
|
|
94
|
+
account. Return true if the authentication should be allowed, or
|
|
95
|
+
false if it should not be allowed because the last authentication
|
|
96
|
+
was too recent and indicates the possible reuse of a TOTP
|
|
97
|
+
authentication code.
|
|
98
|
+
otp_valid_code?(auth_code) :: Whether the given code is the currently valid OTP auth
|
|
99
|
+
code for the account.
|
|
100
|
+
otp_valid_key?(secret) :: Whether the given secret is a valid OTP secret.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
= Documentation for Password Complexity Feature
|
|
2
|
+
|
|
3
|
+
The password complexity feature implements more sophisticated password
|
|
4
|
+
complexity checks. It is not recommended to use this feature unless
|
|
5
|
+
you have a policy that requires it, as users that would not choose a
|
|
6
|
+
good password in the absense of password complexity requirements are
|
|
7
|
+
unlikely to choose a good password if you have password complexity
|
|
8
|
+
requirements.
|
|
9
|
+
|
|
10
|
+
Checks:
|
|
11
|
+
|
|
12
|
+
* Contains characters in multiple character groups, by default at
|
|
13
|
+
least 3 of uppercase letters, lowercase letters, numbers, and
|
|
14
|
+
everything else, unless the password is over 11 characters.
|
|
15
|
+
* Does not contain any invalid patterns, by default patterns like
|
|
16
|
+
+qwerty+, +azerty+, +asdf+, +zxcv+, or number sequences such as +123+.
|
|
17
|
+
* Does not contain a certain number of repeating characters, by default 3.
|
|
18
|
+
* Is not a dictionary word, after stripping off numbers from the prefix
|
|
19
|
+
and suffix and replacing some common numbers/symbols often substituted
|
|
20
|
+
for letters, catching things like <tt>P@$$w0rd1</tt>.
|
|
21
|
+
|
|
22
|
+
== Auth Value Methods
|
|
23
|
+
|
|
24
|
+
password_character_groups :: An array of regular expressions representing
|
|
25
|
+
different character groups.
|
|
26
|
+
password_dictionary :: A Array/Hash/Set containing dictionary words, which cannot
|
|
27
|
+
match the password.
|
|
28
|
+
password_dictionary_file :: A file containing dictionary words, which will not be allowed.
|
|
29
|
+
By default, <tt>/usr/share/dict/words</tt> if present. Set to
|
|
30
|
+
false to not use a password dictionary. Note that this is only
|
|
31
|
+
used during initialization, and cannot refer to request-specific
|
|
32
|
+
state, unlike most other settings.
|
|
33
|
+
password_in_dictionary_message :: The error message fragment to show if the password
|
|
34
|
+
is derived from a word in a dictionary.
|
|
35
|
+
password_invalid_pattern :: A regexp where any match is considered an invalid password.
|
|
36
|
+
For multiple sequences, use +Regexp.union+.
|
|
37
|
+
password_invalid_pattern_message :: The error message fragment to show if the password
|
|
38
|
+
matches the invalid pattern.
|
|
39
|
+
password_max_length_for_groups_check :: The number of characters above which
|
|
40
|
+
to skip the checks for character groups.
|
|
41
|
+
password_max_repeating_characters :: The maximum number of repeating characters allowed.
|
|
42
|
+
password_min_groups :: The minimum number of character groups the password
|
|
43
|
+
has to contain if it is less than
|
|
44
|
+
+password_max_length_for_groups_check+ characters.
|
|
45
|
+
password_not_enough_character_groups_message :: The error message fragment to show if the
|
|
46
|
+
password does not contain characters from
|
|
47
|
+
enough character groups.
|
|
48
|
+
password_too_many_repeating_characters_message :: The error message fragment to show if the
|
|
49
|
+
password contains too many repeating
|
|
50
|
+
characters.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
= Documentation for Password Expiration Feature
|
|
2
|
+
|
|
3
|
+
The password expiration feature requires that users change their
|
|
4
|
+
password on login if it has expired (default: every 90 days). You can
|
|
5
|
+
force password expiration checks for all logged in users by adding
|
|
6
|
+
the following code to your route block:
|
|
7
|
+
|
|
8
|
+
rodauth.require_current_password
|
|
9
|
+
|
|
10
|
+
Additionally, you can set a minimum amount of time after a password
|
|
11
|
+
is changed until it can be changed again. By default this is not
|
|
12
|
+
enabled, but it can be enabled by setting +allow_password_change_after+
|
|
13
|
+
to a positive number of seconds.
|
|
14
|
+
|
|
15
|
+
It is not recommended to use this feature unless you have a policy that
|
|
16
|
+
requires it, as password expiration in general results in users chosing
|
|
17
|
+
weaker passwords. When asked to change their password, many users choose
|
|
18
|
+
a password that is based on their previous password, so forcing password
|
|
19
|
+
expiration is in general a net loss from a security perspective.
|
|
20
|
+
|
|
21
|
+
== Auth Value Methods
|
|
22
|
+
|
|
23
|
+
allow_password_change_after :: How long in seconds after the last password change
|
|
24
|
+
until another password change is allowed (0 by default).
|
|
25
|
+
password_expiration_error_flash :: The flash error to display when the account's
|
|
26
|
+
password has expired and needs to be changed.
|
|
27
|
+
password_not_changeable_yet_error_flash :: The flash error to display when not
|
|
28
|
+
enough time has elapsed since the last
|
|
29
|
+
password change and an attempt is made
|
|
30
|
+
to change the password.
|
|
31
|
+
password_not_changeable_yet_redirect :: Where to redirect if the password cannot
|
|
32
|
+
be changed yet.
|
|
33
|
+
password_change_needed_redirect :: Where to redirect if a password needs to be
|
|
34
|
+
changes.
|
|
35
|
+
password_changed_at_session_key :: The key in the session storing the timestamp the password
|
|
36
|
+
was changed at.
|
|
37
|
+
password_expiration_default :: If the last password change time for an account cannot
|
|
38
|
+
be determined, whether to consider the account expired,
|
|
39
|
+
false by default.
|
|
40
|
+
password_expiration_table :: The table holding the password last changed timestamps.
|
|
41
|
+
password_expiration_id_column :: The column in the +password_expiration_table+ containing
|
|
42
|
+
the account's id.
|
|
43
|
+
password_expiration_changed_at_column :: The column in the +password_expiration_table+
|
|
44
|
+
containing the timestamp
|
|
45
|
+
require_password_change_after :: How long in seconds until a password change is
|
|
46
|
+
required (90 days by default).
|
|
47
|
+
|
|
48
|
+
== Auth Methods
|
|
49
|
+
|
|
50
|
+
password_expired? :: Whether the password has expired for the related account.
|
|
51
|
+
update_password_changed_at :: Update the password last changed timestamp for the
|
|
52
|
+
current account.
|