| 1 |
Configuration |
| 2 |
============= |
| 3 |
|
| 4 |
.. warning:: |
| 5 |
Be sure to set all configuration (in app.config["xxx"]) *PRIOR* to instantiating |
| 6 |
the Security class or calling security.init_app(). |
| 7 |
|
| 8 |
The following configuration values are used by Flask-Security: |
| 9 |
|
| 10 |
Core |
| 11 |
-------------- |
| 12 |
|
| 13 |
These configuration keys are used globally across all features. |
| 14 |
|
| 15 |
.. py:data:: SECRET_KEY |
| 16 |
|
| 17 |
This is actually part of Flask - but is used by Flask-Security to sign all tokens. |
| 18 |
It is critical this is set to a strong value. For python3 consider using: ``secrets.token_urlsafe()`` |
| 19 |
|
| 20 |
.. py:data:: SECRET_KEY_FALLBACKS |
| 21 |
|
| 22 |
This is part of Flask (>=3.1) but can be used by Flask-Security to unsign tokens. |
| 23 |
See Flask documentation https://flask.palletsprojects.com/en/stable/config/#SECRET_KEY_FALLBACKS |
| 24 |
|
| 25 |
.. versionadded:: 5.6.0 |
| 26 |
|
| 27 |
.. py:data:: SECURITY_BLUEPRINT_NAME |
| 28 |
|
| 29 |
Specifies the name for the Flask-Security blueprint. |
| 30 |
|
| 31 |
Default: ``"security"``. |
| 32 |
|
| 33 |
.. py:data:: SECURITY_URL_PREFIX |
| 34 |
|
| 35 |
Specifies the URL prefix for the Flask-Security blueprint. |
| 36 |
|
| 37 |
Default: ``None``. |
| 38 |
|
| 39 |
.. py:data:: SECURITY_STATIC_FOLDER |
| 40 |
|
| 41 |
Specifies the folder name for static files (webauthn). |
| 42 |
|
| 43 |
Default: ``"static"``. |
| 44 |
|
| 45 |
.. versionadded:: 5.1.0 |
| 46 |
|
| 47 |
.. py:data:: SECURITY_STATIC_FOLDER_URL |
| 48 |
|
| 49 |
Specifies the URL for static files used by Flask-Security (webauthn). |
| 50 |
See Flask documentation https://flask.palletsprojects.com/en/latest/blueprints/#static-files |
| 51 |
|
| 52 |
Default: ``"/fs-static"``. |
| 53 |
|
| 54 |
.. versionadded:: 5.1.0 |
| 55 |
|
| 56 |
.. py:data:: SECURITY_SUBDOMAIN |
| 57 |
|
| 58 |
Specifies the subdomain for the Flask-Security blueprint. If your authenticated |
| 59 |
content is on a different subdomain, also enable :py:data:`SECURITY_REDIRECT_ALLOW_SUBDOMAINS`. |
| 60 |
|
| 61 |
Default: ``None``. |
| 62 |
.. py:data:: SECURITY_FLASH_MESSAGES |
| 63 |
|
| 64 |
Specifies whether or not to flash messages for actions certain endpoint perform. |
| 65 |
Normally Flash-Security views will flash informational or error messages only when the operation |
| 66 |
results in a redirect. |
| 67 |
|
| 68 |
Default: ``True``. |
| 69 |
.. py:data:: SECURITY_I18N_DOMAIN |
| 70 |
|
| 71 |
Specifies the name for domain used for translations. |
| 72 |
|
| 73 |
Default: ``"flask_security"``. |
| 74 |
.. py:data:: SECURITY_I18N_DIRNAME |
| 75 |
|
| 76 |
Specifies the directory containing the ``MO`` files used for translations. |
| 77 |
When using flask-babel this can also be a list of directory names - this |
| 78 |
enables application to override a subset of messages if desired. The |
| 79 |
default ``builtin`` uses translations shipped with Flask-Security. |
| 80 |
|
| 81 |
Default: ``"builtin"``. |
| 82 |
|
| 83 |
.. versionchanged:: 5.2.0 |
| 84 |
"builtin" is a special name which will be interpreted as the ``translations`` |
| 85 |
directory within the installation of Flask-Security. |
| 86 |
|
| 87 |
.. py:data:: SECURITY_TOKEN_AUTHENTICATION_KEY |
| 88 |
|
| 89 |
Specifies the query string parameter to read when using token authentication. |
| 90 |
|
| 91 |
Default: ``"auth_token"``. |
| 92 |
|
| 93 |
.. py:data:: SECURITY_TOKEN_AUTHENTICATION_HEADER |
| 94 |
|
| 95 |
Specifies the HTTP header to read when using token authentication. |
| 96 |
|
| 97 |
Default: ``"Authentication-Token"``. |
| 98 |
|
| 99 |
.. py:data:: SECURITY_TOKEN_MAX_AGE |
| 100 |
|
| 101 |
Specifies the number of seconds before an authentication token expires. |
| 102 |
|
| 103 |
Default: ``None``, meaning the token never expires. |
| 104 |
|
| 105 |
.. py:data:: SECURITY_TOKEN_EXPIRE_TIMESTAMP |
| 106 |
|
| 107 |
A callable that returns a unix timestamp in the future when this specific |
| 108 |
authentication token should expire. Returning 0 means no expiration. |
| 109 |
It is passed the currently authenticated User so any fields can be used |
| 110 |
to customize an expiration time. Of course it is called in a request |
| 111 |
context so any information about the current request can also be used. |
| 112 |
|
| 113 |
If BOTH this and :data:`SECURITY_TOKEN_MAX_AGE` are set - the shorter is used. |
| 114 |
|
| 115 |
.. note:: |
| 116 |
These 2 expiry options work differently - with this one, the actual expire |
| 117 |
timestamp is in the auth_token. The signed token (using itsdangerous) |
| 118 |
has the timestamp the token was generated. On validation, that is checked |
| 119 |
against ``SECURITY_TOKEN_MAX_AGE``. So for MAX_AGE, at the time of |
| 120 |
validation, the token hasn't yet been associated with a User. |
| 121 |
|
| 122 |
Default: ``lambda user: 0`` |
| 123 |
|
| 124 |
|
| 125 |
.. py:data:: SECURITY_CACHE_CONTROL |
| 126 |
|
| 127 |
Specifies the Cache-Control header attributes to be sent with all responses from Flask-Security endpoints. |
| 128 |
Each entry in the dict is a (attribute, value) pair, where allowed attributes are |
| 129 |
defined in the Flask documentation https://flask.palletsprojects.com/en/stable/api/#flask.Response.cache_control. |
| 130 |
|
| 131 |
.. note:: |
| 132 |
Flask-Security does not pretend to handle the Cache-Control header for your application. |
| 133 |
This default setting is to ensure that out of the box, Flask-Security responses |
| 134 |
which might contain sensitive information aren't cached. |
| 135 |
Please see https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#cache_directives. |
| 136 |
Responses from your own application endpoints (including endpoints protected with |
| 137 |
a Flask-Security decorator, such as token-authenticated APIs) are not modified - |
| 138 |
set the Cache-Control header there yourself if needed. |
| 139 |
|
| 140 |
.. note:: |
| 141 |
Flask itself adds the 'Vary: Cookie' header to all responses that access the session (cookie). |
| 142 |
This of course includes all non-anonymous Flask-Security endpoints as well as |
| 143 |
any application endpoints that are decorated with a Flask-Security decorator. |
| 144 |
This alone is likely enough to ensure no personal information is leaked. |
| 145 |
|
| 146 |
|
| 147 |
Default: ``{"private": True, "no-store": True}``. |
| 148 |
|
| 149 |
.. versionadded:: 5.8.0 |
| 150 |
|
| 151 |
.. py:data:: SECURITY_EMAIL_VALIDATOR_ARGS |
| 152 |
|
| 153 |
Email address are validated and normalized via the ``mail_util_cls`` which |
| 154 |
defaults to :class:`.MailUtil`. That uses the `email_validator`_ package whose methods |
| 155 |
have configurable options - these can be set here and will be passed in. |
| 156 |
For example setting this to: ``{"check_deliverability": False}`` is useful |
| 157 |
when unit testing if the emails are fake. |
| 158 |
|
| 159 |
``mail_util_cls`` has 2 methods - ``normalize`` and ``validate``. Both |
| 160 |
ensure the passed value is a valid email address, and returns a normalized |
| 161 |
version. ``validate`` additionally, by default, verifies that the email |
| 162 |
address can likely actually receive an email. |
| 163 |
|
| 164 |
Default: ``None``, meaning use the defaults from email_validator package. |
| 165 |
|
| 166 |
.. versionadded:: 4.0.0 |
| 167 |
|
| 168 |
.. _email_validator: https://pypi.org/project/email-validator/ |
| 169 |
|
| 170 |
.. py:data:: SECURITY_DEFAULT_HTTP_AUTH_REALM |
| 171 |
|
| 172 |
Specifies the default authentication realm when using basic HTTP auth. |
| 173 |
|
| 174 |
Default: ``Login Required`` |
| 175 |
|
| 176 |
.. py:data:: SECURITY_REDIRECT_BEHAVIOR |
| 177 |
|
| 178 |
Passwordless login, confirmation, reset password, unified signin, change_email, and Social Login |
| 179 |
have GET endpoints that validate the passed token and redirect to an action form. |
| 180 |
For Single-Page-Applications style UIs which need to control their own internal URL routing these redirects |
| 181 |
need to not contain forms, but contain relevant information as query parameters. |
| 182 |
Setting this to ``"spa"`` will enable that behavior. |
| 183 |
|
| 184 |
When this is enabled, the following must also be defined: |
| 185 |
|
| 186 |
- :py:data:`SECURITY_POST_OAUTH_LOGIN_VIEW` (if :py:data:`SECURITY_OAUTH_ENABLE` is True) |
| 187 |
- :py:data:`SECURITY_POST_OAUTH_VERIFY_VIEW` (if :py:data:`SECURITY_OAUTH_ENABLE` is True) |
| 188 |
- :py:data:`SECURITY_VERIFY_ERROR_VIEW` (if :py:data:`SECURITY_OAUTH_ENABLE` is True) |
| 189 |
- :py:data:`SECURITY_LOGIN_ERROR_VIEW` |
| 190 |
- :py:data:`SECURITY_CONFIRM_ERROR_VIEW` |
| 191 |
- :py:data:`SECURITY_POST_CHANGE_EMAIL_VIEW` |
| 192 |
- :py:data:`SECURITY_CHANGE_EMAIL_ERROR_VIEW` |
| 193 |
- :py:data:`SECURITY_POST_CONFIRM_VIEW` |
| 194 |
- :py:data:`SECURITY_RESET_ERROR_VIEW` |
| 195 |
- :py:data:`SECURITY_RESET_VIEW` |
| 196 |
|
| 197 |
|
| 198 |
Default: ``None`` which is existing html-style form redirects. |
| 199 |
|
| 200 |
.. versionadded:: 3.3.0 |
| 201 |
|
| 202 |
.. py:data:: SECURITY_REDIRECT_HOST |
| 203 |
|
| 204 |
Mostly for development purposes, the UI is often developed |
| 205 |
separately and is running on a different port than the |
| 206 |
Flask application. In order to test redirects, the `netloc` |
| 207 |
of the redirect URL needs to be rewritten. Setting this to e.g. `localhost:8080` does that. |
| 208 |
|
| 209 |
.. tip:: |
| 210 |
Be aware that when this is set, any of the `*_VIEW` configuration variables that are set |
| 211 |
to URLs and not endpoints, will be redirected to this host. |
| 212 |
|
| 213 |
Default: ``None``. |
| 214 |
|
| 215 |
.. versionadded:: 3.3.0 |
| 216 |
|
| 217 |
.. py:data:: SECURITY_REDIRECT_ALLOW_SUBDOMAINS |
| 218 |
|
| 219 |
If ``True`` then subdomains (and the root domain) of the top-level host set |
| 220 |
by Flask's ``SERVER_NAME`` configuration will be allowed as post-view redirect targets. |
| 221 |
This is beneficial if you wish to place your authentication on one subdomain and |
| 222 |
authenticated content on another, for example ``auth.domain.tld`` and ``app.domain.tld``. |
| 223 |
|
| 224 |
Default: ``False``. |
| 225 |
|
| 226 |
.. versionadded:: 4.0.0 |
| 227 |
|
| 228 |
.. py:data:: SECURITY_REDIRECT_BASE_DOMAIN |
| 229 |
|
| 230 |
Set the base domain for checking allowable redirects. The intent here is to |
| 231 |
allow an application to be served on e.g. "flaskapp.my.org" and redirect |
| 232 |
to "myservice.my.org" (which maybe isn't a Flask app). Flask's SERVER_NAME |
| 233 |
can't be used to verify redirects in this case. Note that in most cases |
| 234 |
the application will want to set Flask's SESSION_COOKIE_DOMAIN to be this base domain - |
| 235 |
otherwise authorization information won't be sent. |
| 236 |
|
| 237 |
Default: ``None`` |
| 238 |
|
| 239 |
.. versionadded:: 5.5.0 |
| 240 |
|
| 241 |
.. py:data:: SECURITY_REDIRECT_ALLOWED_SUBDOMAINS |
| 242 |
|
| 243 |
A list of subdomains. Each will be prepended to |
| 244 |
``SECURITY_REDIRECT_BASE_DOMAIN`` and checked against the requested redirect. |
| 245 |
|
| 246 |
Default: ``[]`` |
| 247 |
|
| 248 |
.. versionadded:: 5.5.0 |
| 249 |
|
| 250 |
|
| 251 |
.. note:: |
| 252 |
The above 4 config options apply BOTH to the handling of ``next`` parameter |
| 253 |
as well as all the ``XXX_VIEW`` URL configuration options |
| 254 |
for those views that perform a redirect after processing. |
| 255 |
|
| 256 |
.. py:data:: SECURITY_CSRF_PROTECT_MECHANISMS |
| 257 |
|
| 258 |
Authentication mechanisms that require CSRF protection. |
| 259 |
These are the same mechanisms as are permitted in the ``@auth_required`` decorator. |
| 260 |
|
| 261 |
Default: ``("basic", "session", "token")``. |
| 262 |
|
| 263 |
.. py:data:: SECURITY_CSRF_IGNORE_UNAUTH_ENDPOINTS |
| 264 |
|
| 265 |
If ``True`` then CSRF will not be required for endpoints |
| 266 |
that don't require authentication (e.g. login, logout, register, forgot_password). |
| 267 |
|
| 268 |
Default: ``False``. |
| 269 |
|
| 270 |
.. py:data:: SECURITY_CSRF_COOKIE_NAME |
| 271 |
|
| 272 |
The name for the CSRF cookie. This usually should be dictated by your |
| 273 |
client-side code - more information can be found at :ref:`csrf_topic` |
| 274 |
|
| 275 |
Default: ``None`` - meaning no cookie will be sent. |
| 276 |
|
| 277 |
.. py:data:: SECURITY_CSRF_COOKIE |
| 278 |
|
| 279 |
A dict that defines the parameters required to |
| 280 |
set a CSRF cookie. |
| 281 |
The complete set of parameters is described in Flask's `set_cookie`_ documentation. |
| 282 |
|
| 283 |
Default: ``{"samesite": "Strict", "httponly": False, "secure": False}`` |
| 284 |
|
| 285 |
.. versionchanged:: 4.1.0 |
| 286 |
The 'key' attribute was deprecated in favor of a separate configuration |
| 287 |
variable :data:`SECURITY_CSRF_COOKIE_NAME`. |
| 288 |
|
| 289 |
.. py:data:: SECURITY_CSRF_HEADER |
| 290 |
|
| 291 |
The HTTP Header name that will contain the CSRF token. ``X-XSRF-Token`` |
| 292 |
is used by packages such as `axios`_. |
| 293 |
|
| 294 |
Default: ``"X-XSRF-Token"``. |
| 295 |
|
| 296 |
.. py:data:: SECURITY_CSRF_COOKIE_REFRESH_EACH_REQUEST |
| 297 |
|
| 298 |
By default, csrf_tokens have an expiration (controlled |
| 299 |
by the configuration variable ``WTF_CSRF_TIME_LIMIT``. |
| 300 |
This can cause CSRF failures if say an application is left |
| 301 |
idle for a long time. You can set that time limit to ``None`` |
| 302 |
or have the CSRF cookie sent on every request (which will give |
| 303 |
it a new expiration time). |
| 304 |
|
| 305 |
Default: ``False``. |
| 306 |
|
| 307 |
.. py:data:: SECURITY_SCRIPT_NONCE_KEY |
| 308 |
|
| 309 |
If set, adds a nonce attribute to all ``<script>`` tags rendered by Flask-Security. |
| 310 |
The nonce itself needs to be placed in the flask ``g`` context under the key defined here. |
| 311 |
This is useful when the Content Security Policy requires a nonce on script tags like:: |
| 312 |
|
| 313 |
Content-Security-Policy: script-src 'nonce-{g.your-key}' |
| 314 |
|
| 315 |
Default: ``None``. |
| 316 |
|
| 317 |
.. versionadded:: 5.7.0 |
| 318 |
|
| 319 |
.. py:data:: SECURITY_EMAIL_SENDER |
| 320 |
|
| 321 |
Specifies the email address to send emails as. |
| 322 |
|
| 323 |
Default: value set to ``MAIL_DEFAULT_SENDER`` if Flask-Mail is used otherwise ``no-reply@localhost``. |
| 324 |
|
| 325 |
.. py:data:: SECURITY_USER_IDENTITY_ATTRIBUTES |
| 326 |
|
| 327 |
Specifies which attributes of the user object can be used for credential validation. |
| 328 |
|
| 329 |
Defines the order and matching that will be applied when validating login |
| 330 |
credentials (either via standard login form or the unified sign in form). |
| 331 |
The identity field in the form will be matched in order using this configuration |
| 332 |
- the FIRST match will then be used to look up the user in the DB. |
| 333 |
|
| 334 |
Mapping functions take a single argument - ``identity`` from the form |
| 335 |
and should return ``None`` if the ``identity`` argument isn't in a format |
| 336 |
suitable for the attribute. If the ``identity`` argument format matches, it |
| 337 |
should be returned, optionally having had some normalization performed. |
| 338 |
The returned result will be used to look up the identity in the UserDataStore |
| 339 |
using the column name specified in the key. |
| 340 |
|
| 341 |
The provided :meth:`flask_security.uia_phone_mapper` for example performs |
| 342 |
phone number normalization using the ``phonenumbers`` package. |
| 343 |
|
| 344 |
.. tip:: |
| 345 |
If your mapper performs any sort of normalization, |
| 346 |
make sure you apply the exact same transformation in your form validator |
| 347 |
when setting the field. |
| 348 |
|
| 349 |
.. danger:: |
| 350 |
Make sure that any attributes listed here are marked Unique in your UserDataStore |
| 351 |
model. |
| 352 |
|
| 353 |
.. danger:: |
| 354 |
Make sure your mapper methods guard against malicious user input. For example, |
| 355 |
if you allow ``username`` as an identity method you could use `bleach`_:: |
| 356 |
|
| 357 |
def uia_username_mapper(identity): |
| 358 |
# we allow pretty much anything - but we bleach it. |
| 359 |
return bleach.clean(identity, strip=True) |
| 360 |
|
| 361 |
Default:: |
| 362 |
|
| 363 |
[ |
| 364 |
{"email": {"mapper": uia_email_mapper, "case_insensitive": True}}, |
| 365 |
] |
| 366 |
|
| 367 |
If you enable :py:data:`SECURITY_UNIFIED_SIGNIN` and set ``sms`` as a :py:data:`SECURITY_US_ENABLED_METHODS` |
| 368 |
and your `SECURITY_USER_IDENTITY_ATTRIBUTES` contained:: |
| 369 |
|
| 370 |
[ |
| 371 |
{"email": {"mapper": uia_email_mapper, "case_insensitive": True}}, |
| 372 |
{"us_phone_number": {"mapper": uia_phone_mapper}}, |
| 373 |
] |
| 374 |
|
| 375 |
Then after the user sets up their SMS - they could login using their phone number and |
| 376 |
get a text with the authentication code. |
| 377 |
|
| 378 |
.. versionchanged:: 4.0.0 |
| 379 |
Changed from list to list of dict. |
| 380 |
|
| 381 |
.. _bleach: https://pypi.org/project/bleach/ |
| 382 |
|
| 383 |
.. py:data:: SECURITY_USER_IDENTITY_MAPPINGS |
| 384 |
|
| 385 |
.. versionadded:: 3.4.0 |
| 386 |
.. deprecated:: 4.0.0 |
| 387 |
Superseded by :py:data:`SECURITY_USER_IDENTITY_ATTRIBUTES` |
| 388 |
|
| 389 |
.. py:data:: SECURITY_API_ENABLED_METHODS |
| 390 |
|
| 391 |
Various endpoints of Flask-Security require the caller to be authenticated. |
| 392 |
This variable controls which of the methods - ``token``, ``session``, ``basic`` |
| 393 |
will be allowed. The default does NOT include ``basic`` since if ``basic`` |
| 394 |
is in the list, and if the user is NOT authenticated, then the standard/required |
| 395 |
response of 401 with the ``WWW-Authenticate`` header is returned. This is |
| 396 |
rarely what the client wants. |
| 397 |
|
| 398 |
Default: ``["session", "token"]``. |
| 399 |
|
| 400 |
.. versionadded:: 4.0.0 |
| 401 |
|
| 402 |
.. py:data:: SECURITY_DEFAULT_REMEMBER_ME |
| 403 |
|
| 404 |
Specifies the default "remember me" value used when logging in a user. |
| 405 |
|
| 406 |
Default: ``False``. |
| 407 |
|
| 408 |
.. py:data:: SECURITY_RETURN_GENERIC_RESPONSES |
| 409 |
|
| 410 |
If set to ``True`` Flask-Security will return generic responses to endpoints |
| 411 |
that could be used to enumerate users. Please see :ref:`generic_responses`. |
| 412 |
|
| 413 |
Default: ``False`` |
| 414 |
|
| 415 |
.. versionadded:: 5.0.0 |
| 416 |
|
| 417 |
.. py:data:: SECURITY_FRESHNESS |
| 418 |
|
| 419 |
A timedelta used to protect endpoints that alter sensitive information. |
| 420 |
This is used to protect the following Flask Security endpoints: |
| 421 |
|
| 422 |
- :py:data:`SECURITY_US_SETUP_URL` |
| 423 |
- :py:data:`SECURITY_TWO_FACTOR_SETUP_URL` |
| 424 |
- :py:data:`SECURITY_WAN_REGISTER_URL` |
| 425 |
- :py:data:`SECURITY_WAN_DELETE_URL` |
| 426 |
- :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_CODES` |
| 427 |
- :py:data:`SECURITY_CHANGE_EMAIL_URL` |
| 428 |
- :py:data:`SECURITY_CHANGE_USERNAME_URL` |
| 429 |
|
| 430 |
This can also be used to protect application endpoints with the :meth:`flask_security.auth_required` decorator. |
| 431 |
|
| 432 |
Setting this to a negative number will disable any freshness checking and |
| 433 |
the endpoints: |
| 434 |
|
| 435 |
- :py:data:`SECURITY_VERIFY_URL` |
| 436 |
- :py:data:`SECURITY_US_VERIFY_URL` |
| 437 |
- :py:data:`SECURITY_US_VERIFY_SEND_CODE_URL` |
| 438 |
- :py:data:`SECURITY_WAN_VERIFY_URL` |
| 439 |
- :py:data:`SECURITY_OAUTH_VERIFY_START_URL` |
| 440 |
- :py:data:`SECURITY_OAUTH_VERIFY_RESPONSE_URL` |
| 441 |
|
| 442 |
won't be registered. |
| 443 |
Setting this to 0 results in undefined behavior. |
| 444 |
Please see :meth:`flask_security.check_and_update_authn_fresh` for details. |
| 445 |
|
| 446 |
.. note:: |
| 447 |
The timestamp of when the caller/user last successfully authenticated is |
| 448 |
stored in the session as well as authentication token. |
| 449 |
|
| 450 |
Default: timedelta(hours=24) |
| 451 |
|
| 452 |
.. versionadded:: 3.4.0 |
| 453 |
|
| 454 |
.. py:data:: SECURITY_FRESHNESS_GRACE_PERIOD |
| 455 |
|
| 456 |
A timedelta that provides a grace period when altering sensitive |
| 457 |
information. This ensures that multi-step operations don't get denied |
| 458 |
because the session/token happens to expire mid-step. |
| 459 |
|
| 460 |
Note that this is not implemented for freshness information carried in the |
| 461 |
auth token. |
| 462 |
|
| 463 |
N.B. To avoid strange behavior, be sure to set the grace period less than |
| 464 |
the freshness period. |
| 465 |
Please see :meth:`flask_security.check_and_update_authn_fresh` for details. |
| 466 |
|
| 467 |
Default: timedelta(hours=1) |
| 468 |
|
| 469 |
.. versionadded:: 3.4.0 |
| 470 |
|
| 471 |
.. py:data:: SECURITY_FRESHNESS_ALLOW_AUTH_TOKEN |
| 472 |
|
| 473 |
Controls whether the freshness data set in the auth token can be used to |
| 474 |
satisfy freshness checks. Some applications might want to force freshness |
| 475 |
protected endpoints to always use browser based access with sessions - they |
| 476 |
should set this to ``False``. |
| 477 |
|
| 478 |
Default: ``True`` |
| 479 |
|
| 480 |
|
| 481 |
.. versionadded:: 5.5.0 |
| 482 |
|
| 483 |
Core - Passwords and Tokens |
| 484 |
---------------------------- |
| 485 |
.. py:data:: SECURITY_PASSWORD_HASH |
| 486 |
|
| 487 |
Specifies the password hash algorithm to use when hashing passwords. |
| 488 |
Recommended values for production systems are ``argon2``, ``bcrypt``, or |
| 489 |
``pbkdf2_sha512``. Some algorithms require the installation of a backend package (e.g. `bcrypt`_, `argon2`_). |
| 490 |
|
| 491 |
Default: ``"argon2"``. |
| 492 |
|
| 493 |
.. versionchanged:: 5.5.0 |
| 494 |
Default changed from ``bcrypt`` to ``argon2``. |
| 495 |
|
| 496 |
.. py:data:: SECURITY_PASSWORD_SCHEMES |
| 497 |
|
| 498 |
List of supported password hash algorithms. ``SECURITY_PASSWORD_HASH`` |
| 499 |
must be from this list. Passwords encrypted with any of these schemes will be honored. |
| 500 |
This is passed directly to `passlib's CryptoContext`_. |
| 501 |
|
| 502 |
.. py:data:: SECURITY_DEPRECATED_PASSWORD_SCHEMES |
| 503 |
|
| 504 |
List of password hash algorithms that are considered weak and |
| 505 |
will be accepted, however on first use, will be re-hashed to the current |
| 506 |
setting of ``SECURITY_PASSWORD_HASH``. |
| 507 |
This is passed directly to `passlib's CryptoContext`_. |
| 508 |
|
| 509 |
Default: ``["auto"]`` which means any password found that wasn't |
| 510 |
hashed using ``SECURITY_PASSWORD_HASH`` will be re-hashed. |
| 511 |
|
| 512 |
.. py:data:: SECURITY_PASSWORD_SALT |
| 513 |
|
| 514 |
Specifies the HMAC salt. This is required for all schemes that |
| 515 |
are configured for double hashing. A good salt can be generated using: |
| 516 |
``secrets.SystemRandom().getrandbits(128)``. |
| 517 |
|
| 518 |
Default: ``None``. |
| 519 |
|
| 520 |
.. py:data:: SECURITY_PASSWORD_SINGLE_HASH |
| 521 |
|
| 522 |
A list of schemes that should not be hashed twice. By default, passwords are |
| 523 |
hashed twice, first with :py:data:`SECURITY_PASSWORD_SALT`, and then with a random salt. |
| 524 |
|
| 525 |
Default: a list of known schemes not working with double hashing (`django_{digest}`, `plaintext`). |
| 526 |
|
| 527 |
.. py:data:: SECURITY_HASHING_SCHEMES |
| 528 |
|
| 529 |
List of algorithms used for encrypting/hashing sensitive data within a token |
| 530 |
(Such as is sent with confirmation or reset password). |
| 531 |
This is passed directly to `passlib's CryptoContext`_. |
| 532 |
|
| 533 |
Default: ``["sha256_crypt", "hex_md5"]``. |
| 534 |
.. py:data:: SECURITY_DEPRECATED_HASHING_SCHEMES |
| 535 |
|
| 536 |
List of deprecated algorithms used for creating and validating tokens. |
| 537 |
This is passed directly to `passlib's CryptoContext`_. |
| 538 |
|
| 539 |
Default: ``["auto"]``. |
| 540 |
|
| 541 |
.. versionchanged:: 5.5.0 |
| 542 |
Default changed from ``hex_md5`` to ``auto``. |
| 543 |
|
| 544 |
.. py:data:: SECURITY_PASSWORD_HASH_OPTIONS |
| 545 |
|
| 546 |
Specifies additional options to be passed to the hashing method. This is deprecated as of passlib 1.7. |
| 547 |
|
| 548 |
.. deprecated:: 3.4.0 see: :py:data:`SECURITY_PASSWORD_HASH_PASSLIB_OPTIONS` |
| 549 |
|
| 550 |
.. py:data:: SECURITY_PASSWORD_HASH_PASSLIB_OPTIONS |
| 551 |
|
| 552 |
Pass additional options through ``passlib`` to the various hashing methods. |
| 553 |
This is a dict of the form ``{<scheme>__<option>: <value>, ..}`` |
| 554 |
e.g. {"argon2__time_cost": 3}. |
| 555 |
|
| 556 |
Default: ``{}`` |
| 557 |
|
| 558 |
.. versionadded:: 3.3.1 |
| 559 |
|
| 560 |
.. py:data:: SECURITY_PASSWORD_LENGTH_MIN |
| 561 |
|
| 562 |
Minimum required length for passwords. |
| 563 |
|
| 564 |
Default: ``8`` |
| 565 |
|
| 566 |
.. versionadded:: 3.4.0 |
| 567 |
.. py:data:: SECURITY_PASSWORD_COMPLEXITY_CHECKER |
| 568 |
|
| 569 |
Set to complexity checker to use (Only ``zxcvbn`` supported). |
| 570 |
|
| 571 |
Default: ``None`` |
| 572 |
|
| 573 |
.. versionadded:: 3.4.0 |
| 574 |
.. py:data:: SECURITY_ZXCVBN_MINIMUM_SCORE |
| 575 |
|
| 576 |
Required ``zxcvbn`` password complexity score (0-4). |
| 577 |
Refer to https://github.com/dropbox/zxcvbn#usage for exact meanings of |
| 578 |
different score values. |
| 579 |
|
| 580 |
Default: ``3`` (Good or Strong) |
| 581 |
|
| 582 |
.. versionadded:: 5.0.0 |
| 583 |
.. py:data:: SECURITY_PASSWORD_CHECK_BREACHED |
| 584 |
|
| 585 |
If not ``None`` new/changed passwords will be checked against the |
| 586 |
database of breached passwords at https://api.pwnedpasswords.com. |
| 587 |
If set to ``strict`` then if the site can't be reached, validation will fail. |
| 588 |
If set to ``best-effort`` failure to reach the site will continue |
| 589 |
with the rest of password validation. |
| 590 |
|
| 591 |
Default: ``None`` |
| 592 |
|
| 593 |
.. versionadded:: 3.4.0 |
| 594 |
.. py:data:: SECURITY_PASSWORD_BREACHED_COUNT |
| 595 |
|
| 596 |
Passwords with counts greater than or equal to this value are considered breached. |
| 597 |
|
| 598 |
Default: 1 - which might be to burdensome for some applications. |
| 599 |
|
| 600 |
.. versionadded:: 3.4.0 |
| 601 |
|
| 602 |
.. py:data:: SECURITY_PASSWORD_NORMALIZE_FORM |
| 603 |
|
| 604 |
Passwords are normalized prior to changing or comparing. This satisfies |
| 605 |
the NIST requirement: `5.1.1.2 Memorized Secret Verifiers`_. |
| 606 |
Normalization is performed using the Python unicodedata.normalize() method. |
| 607 |
|
| 608 |
Default: ``"NFKD"`` |
| 609 |
|
| 610 |
.. versionadded:: 4.0.0 |
| 611 |
|
| 612 |
.. _5.1.1.2 Memorized Secret Verifiers: https://pages.nist.gov/800-63-3/sp800-63b.html#sec5 |
| 613 |
|
| 614 |
.. py:data:: SECURITY_PASSWORD_REQUIRED |
| 615 |
|
| 616 |
If set to ``False`` then a user can register with an empty password. |
| 617 |
This requires :py:data:`SECURITY_UNIFIED_SIGNIN` to be enabled. By |
| 618 |
default, the user will be able to authenticate using an email link. |
| 619 |
Please note: this does not mean a user can sign in with an empty |
| 620 |
password - it means that they must have some OTHER means of authenticating. |
| 621 |
|
| 622 |
Default: ``True`` |
| 623 |
|
| 624 |
.. versionadded:: 5.0.0 |
| 625 |
|
| 626 |
.. py:data:: SECURITY_PASSWORD_CONFIRM_REQUIRED |
| 627 |
|
| 628 |
If set to ``True`` then during registration a 'password confirmation' field is presented. |
| 629 |
N.B. this just applies to the new(er) RegisterFormV2 (see :py:data:`SECURITY_USE_REGISTER_V2`) |
| 630 |
|
| 631 |
Default: ``True`` |
| 632 |
|
| 633 |
.. versionadded:: 5.6.0 |
| 634 |
|
| 635 |
Core - Multi-factor |
| 636 |
------------------- |
| 637 |
These are used by the Two-Factor and Unified Signin features. |
| 638 |
|
| 639 |
.. py:data:: SECURITY_TOTP_SECRETS |
| 640 |
|
| 641 |
Secret used to encrypt the totp_password both into DB and into the session cookie. |
| 642 |
Best practice is to set this to: |
| 643 |
|
| 644 |
.. code-block:: python |
| 645 |
|
| 646 |
from passlib import totp |
| 647 |
"{1: <result of totp.generate_secret()>}" |
| 648 |
|
| 649 |
See: `Totp`_ for details. |
| 650 |
|
| 651 |
.. versionadded:: 3.4.0 |
| 652 |
|
| 653 |
.. py:data:: SECURITY_TOTP_ISSUER |
| 654 |
|
| 655 |
Specifies the name of the service or application that the user is authenticating to. |
| 656 |
This will be the name displayed by most authenticator apps. |
| 657 |
|
| 658 |
Default: ``None``. |
| 659 |
|
| 660 |
.. versionadded:: 3.4.0 |
| 661 |
|
| 662 |
.. py:data:: SECURITY_SMS_SERVICE |
| 663 |
|
| 664 |
Specifies the name of the sms service provider. Out of the box |
| 665 |
"Twilio" is supported. For other sms service providers you will need |
| 666 |
to subclass :class:`.SmsSenderBaseClass` and register it: |
| 667 |
|
| 668 |
.. code-block:: python |
| 669 |
|
| 670 |
SmsSenderFactory.senders[<service-name>] = <service-class> |
| 671 |
|
| 672 |
Default: ``Dummy`` which does nothing. |
| 673 |
|
| 674 |
.. versionadded:: 3.4.0 |
| 675 |
|
| 676 |
.. py:data:: SECURITY_SMS_SERVICE_CONFIG |
| 677 |
|
| 678 |
Specifies a dictionary of basic configurations needed for use of a sms service. |
| 679 |
For "Twilio" the following keys are required (fill in from your Twilio dashboard): |
| 680 |
|
| 681 |
Default: ``{'ACCOUNT_SID': NONE, 'AUTH_TOKEN': NONE, 'PHONE_NUMBER': NONE}`` |
| 682 |
|
| 683 |
.. versionadded:: 3.4.0 |
| 684 |
|
| 685 |
.. py:data:: SECURITY_PHONE_REGION_DEFAULT |
| 686 |
|
| 687 |
Assigns a default 'region' for phone numbers used for two-factor or |
| 688 |
unified sign in. All other phone numbers will require a region prefix to |
| 689 |
be accepted. |
| 690 |
|
| 691 |
Default: ``"US"`` |
| 692 |
|
| 693 |
.. versionadded:: 3.4.0 |
| 694 |
|
| 695 |
Core - Compatibility |
| 696 |
--------------------- |
| 697 |
These are flags that change various backwards compatability functionality. |
| 698 |
|
| 699 |
.. py:data:: SECURITY_ANONYMOUS_USER_DISABLED |
| 700 |
|
| 701 |
If set to `True` then :data:`flask_security.current_user` will be `None` for unauthenticated |
| 702 |
users instead of pointing to an AnonymousUser object. Note that Flask-Login intends |
| 703 |
to deprecate the entire AnonymousUser concept. |
| 704 |
|
| 705 |
Default: ``False``. |
| 706 |
|
| 707 |
.. versionadded:: 5.4.0 |
| 708 |
|
| 709 |
.. py:data:: SECURITY_BACKWARDS_COMPAT_AUTH_TOKEN |
| 710 |
|
| 711 |
If set to ``True`` then an Authentication-Token will be returned |
| 712 |
on every successful call to login, reset-password, change-password |
| 713 |
as part of the JSON response. This was the default prior to release 3.3.0 |
| 714 |
- however sending Authentication-Tokens (which by default don't expire) |
| 715 |
to session based UIs is a bad security practice. |
| 716 |
|
| 717 |
Default: ``False``. |
| 718 |
|
| 719 |
Core - rarely need changing |
| 720 |
---------------------------- |
| 721 |
|
| 722 |
.. py:data:: SECURITY_DATETIME_FACTORY |
| 723 |
|
| 724 |
Specifies the default datetime factory. The default is naive-UTC which |
| 725 |
corresponds to many DB's DateTime type. |
| 726 |
|
| 727 |
Default:``flask_security.naive_utcnow``. |
| 728 |
|
| 729 |
.. py:data:: SECURITY_CONFIRM_SALT |
| 730 |
|
| 731 |
Specifies the salt value when generating confirmation links/tokens. |
| 732 |
|
| 733 |
Default: ``"confirm-salt"``. |
| 734 |
|
| 735 |
.. py:data:: SECURITY_RESET_SALT |
| 736 |
|
| 737 |
Specifies the salt value when generating password reset links/tokens. |
| 738 |
|
| 739 |
Default: ``"reset-salt"``. |
| 740 |
|
| 741 |
.. py:data:: SECURITY_LOGIN_SALT |
| 742 |
|
| 743 |
Specifies the salt value when generating login links/tokens. |
| 744 |
|
| 745 |
Default: ``"login-salt"``. |
| 746 |
|
| 747 |
.. py:data:: SECURITY_REMEMBER_SALT |
| 748 |
|
| 749 |
Specifies the salt value when generating remember tokens. |
| 750 |
Remember tokens are used instead of user ID's as it is more secure. |
| 751 |
|
| 752 |
Default: ``"remember-salt"``. |
| 753 |
.. py:data:: SECURITY_TWO_FACTOR_VALIDITY_SALT |
| 754 |
|
| 755 |
Specifies the salt value when generating two-factor validity tokens. |
| 756 |
|
| 757 |
Default: ``"tf-validity-salt"``. |
| 758 |
.. py:data:: SECURITY_US_SETUP_SALT |
| 759 |
|
| 760 |
Default: ``"us-setup-salt"`` |
| 761 |
|
| 762 |
.. py:data:: SECURITY_WAN_SALT |
| 763 |
|
| 764 |
Default: ``"wan-salt"`` |
| 765 |
.. py:data:: SECURITY_TWO_FACTOR_SETUP_SALT |
| 766 |
|
| 767 |
Default: ``"tf-setup-salt"`` |
| 768 |
.. py:data:: SECURITY_EMAIL_CHANGE_SALT |
| 769 |
|
| 770 |
Specifies the salt value when generating change email confirmation links/tokens. |
| 771 |
|
| 772 |
Default: ``"change-email-salt"``. |
| 773 |
|
| 774 |
.. py:data:: SECURITY_EMAIL_PLAINTEXT |
| 775 |
|
| 776 |
Sends email as plaintext using ``*.txt`` template. |
| 777 |
|
| 778 |
Default: ``True``. |
| 779 |
|
| 780 |
.. py:data:: SECURITY_EMAIL_HTML |
| 781 |
|
| 782 |
Sends email as HTML using ``*.html`` template. |
| 783 |
|
| 784 |
Default: ``True``. |
| 785 |
|
| 786 |
.. py:data:: SECURITY_CLI_USERS_NAME |
| 787 |
|
| 788 |
Specifies the name for the command managing users. Disable by setting ``False``. |
| 789 |
|
| 790 |
Default: ``"users"``. |
| 791 |
|
| 792 |
.. py:data:: SECURITY_CLI_ROLES_NAME |
| 793 |
|
| 794 |
Specifies the name for the command managing roles. Disable by setting ``False``. |
| 795 |
|
| 796 |
Default: ``"roles"``. |
| 797 |
|
| 798 |
.. py:data:: SECURITY_JOIN_USER_ROLES |
| 799 |
|
| 800 |
Specifies whether to set the ``UserModel.roles`` loading relationship to ``joined`` when a ``roles`` attribute |
| 801 |
is present for a SQLAlchemy Datastore. Setting this to ``False`` restores pre 3.3.0 behavior and is required if the ``roles`` attribute |
| 802 |
is not a joinable attribute on the ``UserModel``. The default setting improves performance by only requiring a single |
| 803 |
DB call. |
| 804 |
|
| 805 |
Default: ``True``. |
| 806 |
|
| 807 |
.. versionadded:: 3.4.0 |
| 808 |
|
| 809 |
.. _Totp: https://passlib.readthedocs.io/en/stable/narr/totp-tutorial.html#totp-encryption-setup |
| 810 |
.. _set_cookie: https://flask.palletsprojects.com/en/1.1.x/api/?highlight=set_cookie#flask.Response.set_cookie |
| 811 |
.. _axios: https://github.com/axios/axios |
| 812 |
.. _bcrypt: https://pypi.org/project/bcrypt/ |
| 813 |
.. _argon2: https://pypi.org/project/argon2-cffi/ |
| 814 |
|
| 815 |
Login/Logout |
| 816 |
------------ |
| 817 |
.. py:data:: SECURITY_LOGIN_URL |
| 818 |
|
| 819 |
Specifies the login URL. |
| 820 |
|
| 821 |
Default: ``"/login"``. |
| 822 |
|
| 823 |
.. py:data:: SECURITY_LOGOUT_URL |
| 824 |
|
| 825 |
Specifies the logout URL. |
| 826 |
|
| 827 |
Default:``"/logout"``. |
| 828 |
|
| 829 |
|
| 830 |
.. py:data:: SECURITY_LOGOUT_METHODS |
| 831 |
|
| 832 |
Specifies the HTTP request methods that the logout URL accepts. Specify ``None`` to disable the logout URL (and implement your own). |
| 833 |
Configuring with just ``["POST"]`` is slightly more secure. The default includes ``"GET"`` for backwards compatibility. |
| 834 |
|
| 835 |
Default: ``["GET", "POST"]``. |
| 836 |
|
| 837 |
|
| 838 |
.. py:data:: SECURITY_POST_LOGIN_VIEW |
| 839 |
|
| 840 |
Specifies the default view to redirect to after a user logs in. This value can be set to a URL |
| 841 |
or an endpoint name. Defaults to the Flask config ``APPLICATION_ROOT`` value which itself defaults to ``"/"``. |
| 842 |
Note that if the request URL or form has a ``next`` parameter, that will take precedence. |
| 843 |
|
| 844 |
Default: ``APPLICATION_ROOT``. |
| 845 |
|
| 846 |
.. py:data:: SECURITY_POST_LOGOUT_VIEW |
| 847 |
|
| 848 |
Specifies the default view to redirect to after a user logs out. This value can be set to a URL |
| 849 |
or an endpoint name. Defaults to the Flask config ``APPLICATION_ROOT`` value which itself defaults to ``"/"``. |
| 850 |
Note that if the request URL or form has a ``next`` parameter, that will take precedence. |
| 851 |
|
| 852 |
Default: ``APPLICATION_ROOT``. |
| 853 |
|
| 854 |
|
| 855 |
.. py:data:: SECURITY_UNAUTHORIZED_VIEW |
| 856 |
|
| 857 |
Specifies the view to redirect to if a user attempts to access a URL/endpoint that they do |
| 858 |
not have permission to access. This can be a callable (which returns a URL or ``None``) or an endpoint or a URL. |
| 859 |
If this value is ``None`` or the configured callable returns ``None`` or empty, the user is presented with a default HTTP 403 response. |
| 860 |
|
| 861 |
Default: ``None``. |
| 862 |
|
| 863 |
.. py:data:: SECURITY_LOGIN_USER_TEMPLATE |
| 864 |
|
| 865 |
Specifies the path to the template for the user login page. |
| 866 |
|
| 867 |
Default: ``"security/login_user.html"``. |
| 868 |
|
| 869 |
.. py:data:: SECURITY_VERIFY_URL |
| 870 |
|
| 871 |
Specifies the reauthenticate URL. If :py:data:`SECURITY_FRESHNESS` evaluates to < 0; this |
| 872 |
endpoint won't be registered. |
| 873 |
|
| 874 |
Default: ``"/verify"`` |
| 875 |
|
| 876 |
.. versionadded:: 3.4.0 |
| 877 |
|
| 878 |
|
| 879 |
.. py:data:: SECURITY_VERIFY_TEMPLATE |
| 880 |
|
| 881 |
Specifies the path to the template for the verify password page. |
| 882 |
|
| 883 |
Default: ``"security/verify.html"``. |
| 884 |
|
| 885 |
.. versionadded:: 3.4.0 |
| 886 |
|
| 887 |
.. py:data:: SECURITY_POST_VERIFY_URL |
| 888 |
|
| 889 |
Specifies the default view to redirect to after a user successfully reauthenticates either via |
| 890 |
the :py:data:`SECURITY_VERIFY_URL` or the :py:data:`SECURITY_US_VERIFY_URL`. |
| 891 |
Normally this won't need to be set and after the verification/reauthentication, the referring |
| 892 |
view (held in the ``next`` parameter) will be redirected to. |
| 893 |
|
| 894 |
Default: ``None``. |
| 895 |
|
| 896 |
.. versionadded:: 3.4.0 |
| 897 |
|
| 898 |
Registerable |
| 899 |
------------ |
| 900 |
.. py:data:: SECURITY_REGISTERABLE |
| 901 |
|
| 902 |
Specifies if Flask-Security should create a user registration endpoint. |
| 903 |
|
| 904 |
Default: ``False`` |
| 905 |
|
| 906 |
.. py:data:: SECURITY_SEND_REGISTER_EMAIL |
| 907 |
|
| 908 |
Specifies whether registration email is sent. |
| 909 |
|
| 910 |
Default: ``True``. |
| 911 |
.. py:data:: SECURITY_EMAIL_SUBJECT_REGISTER |
| 912 |
|
| 913 |
Sets the subject for the confirmation email. |
| 914 |
|
| 915 |
Default: ``_("Welcome")``. |
| 916 |
.. py:data:: SECURITY_REGISTER_USER_TEMPLATE |
| 917 |
|
| 918 |
Specifies the path to the template for the user registration page. |
| 919 |
|
| 920 |
Default: ``"security/register_user.html"``. |
| 921 |
.. py:data:: SECURITY_POST_REGISTER_VIEW |
| 922 |
|
| 923 |
Specifies the view to redirect to after a user successfully registers. |
| 924 |
This value can be set to a URL or an endpoint name. If this value is |
| 925 |
``None``, the user is redirected to the value of :data:`SECURITY_POST_LOGIN_VIEW`. |
| 926 |
Note that if the request URL or form has a ``next`` parameter, that will take precedence. |
| 927 |
|
| 928 |
Default: ``None``. |
| 929 |
.. py:data:: SECURITY_REGISTER_URL |
| 930 |
|
| 931 |
Specifies the register URL. |
| 932 |
|
| 933 |
Default: ``"/register"``. |
| 934 |
|
| 935 |
.. py:data:: SECURITY_USERNAME_ENABLE |
| 936 |
|
| 937 |
If set to True, the default registration form and template, and |
| 938 |
login form and template will have |
| 939 |
a username field added. This requires that your user model contain the |
| 940 |
field ``username``. It MUST be set as 'unique' and if you don't want |
| 941 |
to require a username, it should be set as 'nullable'. |
| 942 |
The form validators will call :meth:`.UsernameUtil.validate`. |
| 943 |
|
| 944 |
In addition, :data:`SECURITY_USER_IDENTITY_ATTRIBUTES` will be updated to include:: |
| 945 |
|
| 946 |
{"username": {"mapper": uia_username_mapper}, "case_insensitive": True} |
| 947 |
|
| 948 |
See :meth:`flask_security.uia_username_mapper` for details. |
| 949 |
|
| 950 |
If you already have added a username field to your forms, don't set this |
| 951 |
option - the system will throw an exception at init_app time. |
| 952 |
|
| 953 |
Validation and normalization is encapsulated in :class:`.UsernameUtil`. |
| 954 |
Note that the default validation restricts username input to be unicode |
| 955 |
letters and numbers. It also uses ``bleach`` to scrub any risky input. Be |
| 956 |
sure your application requirements includes `bleach`_. |
| 957 |
|
| 958 |
Default: ``False`` |
| 959 |
|
| 960 |
.. versionadded:: 4.1.0 |
| 961 |
|
| 962 |
.. py:data:: SECURITY_USERNAME_REQUIRED |
| 963 |
|
| 964 |
If username is enabled, is it required as part of registration? |
| 965 |
|
| 966 |
Default: ``False`` |
| 967 |
|
| 968 |
.. versionadded:: 4.1.0 |
| 969 |
|
| 970 |
|
| 971 |
.. py:data:: SECURITY_USERNAME_MIN_LENGTH |
| 972 |
|
| 973 |
Minimum length of a username. |
| 974 |
|
| 975 |
Default: ``4`` |
| 976 |
|
| 977 |
.. versionadded:: 4.1.0 |
| 978 |
|
| 979 |
.. py:data:: SECURITY_USERNAME_MAX_LENGTH |
| 980 |
|
| 981 |
Maximum length of a username. |
| 982 |
|
| 983 |
Default: ``32`` |
| 984 |
|
| 985 |
.. versionadded:: 4.1.0 |
| 986 |
|
| 987 |
.. py:data:: SECURITY_USERNAME_NORMALIZE_FORM |
| 988 |
|
| 989 |
Usernames, by default, are normalized using the Python unicodedata.normalize() method. |
| 990 |
|
| 991 |
Default: ``"NFKD"`` |
| 992 |
|
| 993 |
.. versionadded:: 4.1.0 |
| 994 |
|
| 995 |
.. py:data:: SECURITY_USE_REGISTER_V2 |
| 996 |
|
| 997 |
The :py:class:`flask_security.RegisterFormV2` is a single form used for registration. This is replacing the |
| 998 |
RegisterForm and ConfirmRegisterForm (over a few releases). Setting this option |
| 999 |
to ``False`` will revert behavior to prior releases with register_form=RegisterForm and |
| 1000 |
confirm_register_form=ConfirmRegisterForm. Note that this |
| 1001 |
option is ignored if the application has sub-classed the registration form. |
| 1002 |
|
| 1003 |
Default: ``True`` |
| 1004 |
|
| 1005 |
.. versionadded:: 5.6.0 |
| 1006 |
.. versionchanged:: 5.7.0 |
| 1007 |
Default set to ``True`` |
| 1008 |
.. deprecated:: 5.7.0 |
| 1009 |
In a future release the old RegisterForm and ConfirmRegisterForm will be removed which |
| 1010 |
will make this option obsolete. |
| 1011 |
|
| 1012 |
|
| 1013 |
|
| 1014 |
Confirmable |
| 1015 |
----------- |
| 1016 |
|
| 1017 |
.. py:data:: SECURITY_CONFIRMABLE |
| 1018 |
|
| 1019 |
Specifies if users are required to confirm their email address when |
| 1020 |
registering a new account. If this value is `True`, Flask-Security creates an endpoint to handle |
| 1021 |
confirmations and requests to resend confirmation instructions. |
| 1022 |
|
| 1023 |
Default: ``False``. |
| 1024 |
.. py:data:: SECURITY_CONFIRM_EMAIL_WITHIN |
| 1025 |
|
| 1026 |
Specifies the amount of time a user has before their confirmation |
| 1027 |
link expires. Always pluralize the time unit for this value. |
| 1028 |
|
| 1029 |
Default: ``"5 days"``. |
| 1030 |
.. py:data:: SECURITY_CONFIRM_URL |
| 1031 |
|
| 1032 |
Specifies the email confirmation URL. |
| 1033 |
|
| 1034 |
Default: ``"/confirm"``. |
| 1035 |
.. py:data:: SECURITY_SEND_CONFIRMATION_TEMPLATE |
| 1036 |
|
| 1037 |
Specifies the path to the template for the resend confirmation instructions page. |
| 1038 |
|
| 1039 |
Default: ``"security/send_confirmation.html"``. |
| 1040 |
.. py:data:: SECURITY_EMAIL_SUBJECT_CONFIRM |
| 1041 |
|
| 1042 |
Sets the subject for the email confirmation message. |
| 1043 |
|
| 1044 |
Default: ``_("Please confirm your email")``. |
| 1045 |
.. py:data:: SECURITY_CONFIRM_ERROR_VIEW |
| 1046 |
|
| 1047 |
Specifies the view to redirect to if a confirmation error occurs. |
| 1048 |
This value can be set to a URL or an endpoint name. |
| 1049 |
If this value is ``None``, the user is presented the default view |
| 1050 |
to resend a confirmation link. In the case of :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"`` |
| 1051 |
query params in the redirect will contain the error. |
| 1052 |
|
| 1053 |
Default: ``None``. |
| 1054 |
.. py:data:: SECURITY_POST_CONFIRM_VIEW |
| 1055 |
|
| 1056 |
Specifies the view to redirect to after a user successfully confirms their email. |
| 1057 |
This value can be set to a URL or an endpoint name. If this value is ``None``, the user is redirected to the |
| 1058 |
value of :data:`SECURITY_POST_LOGIN_VIEW`. |
| 1059 |
|
| 1060 |
Default: ``None``. |
| 1061 |
.. py:data:: SECURITY_AUTO_LOGIN_AFTER_CONFIRM |
| 1062 |
|
| 1063 |
If ``True``, then the user corresponding to the confirmation token will be automatically signed in. |
| 1064 |
If ``False`` (the default) then the user will be required to authenticate using the usual mechanism(s). |
| 1065 |
Note that the confirmation token is single-use. This is not recommended by OWASP |
| 1066 |
however an application that is by invite only (no self-registration) might find this useful. |
| 1067 |
|
| 1068 |
Default: ``False``. |
| 1069 |
|
| 1070 |
.. py:data:: SECURITY_LOGIN_WITHOUT_CONFIRMATION |
| 1071 |
|
| 1072 |
Specifies if a user may login before confirming their email when |
| 1073 |
the value of :data:`SECURITY_CONFIRMABLE` is set to ``True``. |
| 1074 |
|
| 1075 |
Default: ``False``. |
| 1076 |
.. py:data:: SECURITY_REQUIRES_CONFIRMATION_ERROR_VIEW |
| 1077 |
|
| 1078 |
Specifies a redirect page if the users tries to login, reset password or us-signin with an unconfirmed account. |
| 1079 |
If an URL endpoint is specified, flashes an error messages and redirects. |
| 1080 |
Default behavior is to reload the form with an error message without redirecting to an other page. |
| 1081 |
|
| 1082 |
Default: ``None``. |
| 1083 |
|
| 1084 |
Changeable |
| 1085 |
---------- |
| 1086 |
|
| 1087 |
.. py:data:: SECURITY_CHANGEABLE |
| 1088 |
|
| 1089 |
Specifies if Flask-Security should enable the change password endpoint. |
| 1090 |
|
| 1091 |
Default: ``False``. |
| 1092 |
.. py:data:: SECURITY_CHANGE_URL |
| 1093 |
|
| 1094 |
Specifies the password change URL. |
| 1095 |
|
| 1096 |
Default: ``"/change"``. |
| 1097 |
.. py:data:: SECURITY_POST_CHANGE_VIEW |
| 1098 |
|
| 1099 |
Specifies the view to redirect to after a user successfully changes their password. |
| 1100 |
This value can be set to a URL or an endpoint name. |
| 1101 |
If this value is ``None``, the user is redirected to the |
| 1102 |
value of :data:`SECURITY_POST_LOGIN_VIEW`. |
| 1103 |
|
| 1104 |
Default: ``None``. |
| 1105 |
.. py:data:: SECURITY_CHANGE_PASSWORD_TEMPLATE |
| 1106 |
|
| 1107 |
Specifies the path to the template for the change password page. |
| 1108 |
|
| 1109 |
Default: ``"security/change_password.html"``. |
| 1110 |
|
| 1111 |
.. py:data:: SECURITY_SEND_PASSWORD_CHANGE_EMAIL |
| 1112 |
|
| 1113 |
Specifies whether password change email is sent. |
| 1114 |
|
| 1115 |
Default: ``True``. |
| 1116 |
|
| 1117 |
.. py:data:: SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE |
| 1118 |
|
| 1119 |
Sets the subject for the password change notice. |
| 1120 |
|
| 1121 |
Default: ``_("Your password has been changed")``. |
| 1122 |
|
| 1123 |
Recoverable |
| 1124 |
----------- |
| 1125 |
|
| 1126 |
.. py:data:: SECURITY_RECOVERABLE |
| 1127 |
|
| 1128 |
Specifies if Flask-Security should create a password reset/recover endpoint. |
| 1129 |
|
| 1130 |
Default: ``False``. |
| 1131 |
|
| 1132 |
.. py:data:: SECURITY_RESET_URL |
| 1133 |
|
| 1134 |
Specifies the password reset URL. |
| 1135 |
|
| 1136 |
Default: ``"/reset"``. |
| 1137 |
|
| 1138 |
.. py:data:: SECURITY_RESET_PASSWORD_TEMPLATE |
| 1139 |
|
| 1140 |
Specifies the path to the template for the reset password page. |
| 1141 |
|
| 1142 |
Default: ``"security/reset_password.html"``. |
| 1143 |
|
| 1144 |
.. py:data:: SECURITY_FORGOT_PASSWORD_TEMPLATE |
| 1145 |
|
| 1146 |
Specifies the path to the template for the forgot password page. |
| 1147 |
|
| 1148 |
Default: ``"security/forgot_password.html"``. |
| 1149 |
|
| 1150 |
.. py:data:: SECURITY_POST_RESET_VIEW |
| 1151 |
|
| 1152 |
Specifies the view to redirect to after a user successfully resets their password. |
| 1153 |
This value can be set to a URL or an endpoint name. If this |
| 1154 |
value is ``None``, the user is redirected to the value of ``.login`` if |
| 1155 |
:py:data:`SECURITY_AUTO_LOGIN_AFTER_RESET` is ``False`` or :py:data:`SECURITY_POST_LOGIN_VIEW` |
| 1156 |
if ``True`` |
| 1157 |
|
| 1158 |
Default: ``None``. |
| 1159 |
|
| 1160 |
.. py:data:: SECURITY_RESET_VIEW |
| 1161 |
|
| 1162 |
Specifies the view/URL to redirect to after a GET reset-password link. |
| 1163 |
This is only valid if :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"``. |
| 1164 |
Query params in the redirect will contain the ``token``. |
| 1165 |
|
| 1166 |
Default: ``None``. |
| 1167 |
|
| 1168 |
.. py:data:: SECURITY_AUTO_LOGIN_AFTER_RESET |
| 1169 |
|
| 1170 |
If ``False`` then on successful reset the user will be required to signin again. |
| 1171 |
Note that the reset token is not valid after being used once. |
| 1172 |
If ``True``, then the user corresponding to the |
| 1173 |
reset token will be automatically signed in. Note: auto-login is contrary |
| 1174 |
to OWASP best security practices. This option is for backwards compatibility |
| 1175 |
and is deprecated. |
| 1176 |
|
| 1177 |
Default: ``False``. |
| 1178 |
|
| 1179 |
.. versionadded:: 5.3.0 |
| 1180 |
.. deprecated:: 5.3.0 |
| 1181 |
|
| 1182 |
.. py:data:: SECURITY_RESET_ERROR_VIEW |
| 1183 |
|
| 1184 |
Specifies the view/URL to redirect to after a GET reset-password link when there is an error. |
| 1185 |
This is only valid if :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``spa``. |
| 1186 |
Query params in the redirect will contain the error. |
| 1187 |
|
| 1188 |
Default: ``None``. |
| 1189 |
|
| 1190 |
.. py:data:: SECURITY_RESET_PASSWORD_WITHIN |
| 1191 |
|
| 1192 |
Specifies the amount of time a user has before their password reset link expires. |
| 1193 |
Always pluralize the time unit for this value. |
| 1194 |
|
| 1195 |
Default: ``"1 days"``. |
| 1196 |
|
| 1197 |
.. py:data:: SECURITY_SEND_PASSWORD_RESET_EMAIL |
| 1198 |
|
| 1199 |
Specifies whether password reset email is sent. These are instructions |
| 1200 |
including a link that can be clicked on. |
| 1201 |
|
| 1202 |
Default: ``True``. |
| 1203 |
|
| 1204 |
.. py:data:: SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL |
| 1205 |
|
| 1206 |
Specifies whether password reset notice email is sent. This is sent once |
| 1207 |
a user's password was successfully reset. |
| 1208 |
|
| 1209 |
Default: ``True``. |
| 1210 |
|
| 1211 |
.. py:data:: SECURITY_EMAIL_SUBJECT_PASSWORD_RESET |
| 1212 |
|
| 1213 |
Sets the subject for the password reset email. |
| 1214 |
|
| 1215 |
Default: ``_("Password reset instructions")``. |
| 1216 |
|
| 1217 |
.. py:data:: SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE |
| 1218 |
|
| 1219 |
Sets subject for the password notice. |
| 1220 |
|
| 1221 |
Default: ``_("Your password has been reset")``. |
| 1222 |
|
| 1223 |
Change-Email |
| 1224 |
------------ |
| 1225 |
.. versionadded:: 5.5.0 |
| 1226 |
|
| 1227 |
.. py:data:: SECURITY_CHANGE_EMAIL |
| 1228 |
|
| 1229 |
It ``True`` an endpoint is created that allows a user to change their email address. |
| 1230 |
|
| 1231 |
Default: ``False`` |
| 1232 |
.. py:data:: SECURITY_CHANGE_EMAIL_SUBJECT |
| 1233 |
|
| 1234 |
Sets the subject for the change email confirmation email. |
| 1235 |
|
| 1236 |
Default: ``_("Confirm your new email address")``. |
| 1237 |
.. py:data:: SECURITY_CHANGE_EMAIL_TEMPLATE |
| 1238 |
|
| 1239 |
Specifies the path to the template for the change email page. |
| 1240 |
|
| 1241 |
Default: ``"security/change_email.html"``. |
| 1242 |
.. py:data:: SECURITY_CHANGE_EMAIL_WITHIN |
| 1243 |
|
| 1244 |
Specifies the amount of time a user has before their change email |
| 1245 |
token expires. Always pluralize the time unit for this value. |
| 1246 |
|
| 1247 |
Default: ``"2 hours"`` |
| 1248 |
.. py:data:: SECURITY_POST_CHANGE_EMAIL_VIEW |
| 1249 |
|
| 1250 |
Specifies the view to redirect to after a user successfully confirms their new email address. |
| 1251 |
This value can be set to a URL or an endpoint name. If this value is |
| 1252 |
``None``, the user is redirected to the value of :py:data:`SECURITY_POST_LOGIN_VIEW`. |
| 1253 |
Note that if the request URL or form has a ``next`` parameter, that will take precedence. |
| 1254 |
In the case of :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"`` this value must be set. |
| 1255 |
|
| 1256 |
Default: ``None``. |
| 1257 |
.. py:data:: SECURITY_CHANGE_EMAIL_ERROR_VIEW |
| 1258 |
|
| 1259 |
Specifies the view to redirect to if a change email confirmation error occurs. |
| 1260 |
This value can be set to a URL or an endpoint name. |
| 1261 |
If this value is ``None``, the user is redirected back to the change_email page. |
| 1262 |
In the case of :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"`` |
| 1263 |
this value must be set, and the query params in the redirect will contain the error. |
| 1264 |
|
| 1265 |
Default: ``None``. |
| 1266 |
.. py:data:: SECURITY_CHANGE_EMAIL_URL |
| 1267 |
|
| 1268 |
Specifies the change-email endpoint URL. |
| 1269 |
|
| 1270 |
Default: ``"/change-email"``. |
| 1271 |
.. py:data:: SECURITY_CHANGE_EMAIL_CONFIRM_URL |
| 1272 |
|
| 1273 |
Specifies the change-email confirmation endpoint URL. This is a GET |
| 1274 |
only endpoint (accessed via a link in an email). |
| 1275 |
|
| 1276 |
Default: ``"/change-email-confirm"``. |
| 1277 |
|
| 1278 |
Additional relevant configuration variables: |
| 1279 |
|
| 1280 |
- :py:data:`SECURITY_FRESHNESS` - Used to protect /change-email. |
| 1281 |
- :py:data:`SECURITY_FRESHNESS_GRACE_PERIOD` - Used to protect /change-email. |
| 1282 |
|
| 1283 |
Two-Factor |
| 1284 |
----------- |
| 1285 |
Configuration related to the two-factor authentication feature. |
| 1286 |
|
| 1287 |
.. versionadded:: 3.2.0 |
| 1288 |
|
| 1289 |
.. py:data:: SECURITY_TWO_FACTOR |
| 1290 |
|
| 1291 |
Specifies if Flask-Security should enable the two-factor login feature. |
| 1292 |
|
| 1293 |
Default: ``False``. |
| 1294 |
.. py:data:: SECURITY_TWO_FACTOR_REQUIRED |
| 1295 |
|
| 1296 |
If set to ``True`` then all users will be required to setup and use two-factor authentication. |
| 1297 |
Please see :py:meth:`.UserMixin.check_tf_required` and :ref:`two_factor_configurations:Fine-Grained Control of Two-Factor` |
| 1298 |
for ways the application can |
| 1299 |
more finely tune which users require two-factor authentication. |
| 1300 |
|
| 1301 |
Default: ``False``. |
| 1302 |
|
| 1303 |
.. versionchanged:: 5.8.0 |
| 1304 |
Added overridable method that can alter this behavior. |
| 1305 |
|
| 1306 |
.. py:data:: SECURITY_TWO_FACTOR_ENABLED_METHODS |
| 1307 |
|
| 1308 |
Specifies the default enabled methods for two-factor authentication. |
| 1309 |
|
| 1310 |
Default: ``['email', 'authenticator', 'sms']`` which are the only currently supported methods. |
| 1311 |
.. py:data:: SECURITY_TWO_FACTOR_AUTHENTICATOR_VALIDITY |
| 1312 |
|
| 1313 |
Specifies the number of seconds access token is valid. |
| 1314 |
|
| 1315 |
Default: ``120``. |
| 1316 |
.. py:data:: SECURITY_TWO_FACTOR_MAIL_VALIDITY |
| 1317 |
|
| 1318 |
Specifies the number of seconds access token is valid. |
| 1319 |
|
| 1320 |
Default: ``300``. |
| 1321 |
.. py:data:: SECURITY_TWO_FACTOR_SMS_VALIDITY |
| 1322 |
|
| 1323 |
Specifies the number of seconds access token is valid. |
| 1324 |
|
| 1325 |
Default: ``120``. |
| 1326 |
.. py:data:: SECURITY_TWO_FACTOR_SETUP_WITHIN |
| 1327 |
|
| 1328 |
Specifies the amount of time a user has before their two-factor setup |
| 1329 |
token expires. Always pluralize the time unit for this value. |
| 1330 |
|
| 1331 |
Default: ``"30 minutes"`` |
| 1332 |
|
| 1333 |
.. versionadded:: 5.5.0 |
| 1334 |
.. py:data:: SECURITY_TWO_FACTOR_RESCUE_MAIL |
| 1335 |
|
| 1336 |
Specifies the email address users send mail to when they can't complete the |
| 1337 |
two-factor authentication login. |
| 1338 |
|
| 1339 |
Default: ``"no-reply@localhost"``. |
| 1340 |
|
| 1341 |
.. py:data:: SECURITY_EMAIL_SUBJECT_TWO_FACTOR |
| 1342 |
|
| 1343 |
Sets the subject for the two-factor feature. |
| 1344 |
|
| 1345 |
Default: ``_("Two-Factor Login")`` |
| 1346 |
.. py:data:: SECURITY_EMAIL_SUBJECT_TWO_FACTOR_RESCUE |
| 1347 |
|
| 1348 |
Sets the subject for the two-factor help function. |
| 1349 |
|
| 1350 |
Default: ``_("Two-Factor Rescue")`` |
| 1351 |
.. py:data:: SECURITY_TWO_FACTOR_VERIFY_CODE_TEMPLATE |
| 1352 |
|
| 1353 |
Specifies the path to the template for the verify code page for the two-factor authentication process. |
| 1354 |
|
| 1355 |
Default: ``"security/two_factor_verify_code.html"``. |
| 1356 |
.. py:data:: SECURITY_TWO_FACTOR_SETUP_TEMPLATE |
| 1357 |
|
| 1358 |
Specifies the path to the template for the setup page for the two-factor authentication process. |
| 1359 |
|
| 1360 |
Default: ``"security/two_factor_setup.html"``. |
| 1361 |
|
| 1362 |
.. py:data:: SECURITY_TWO_FACTOR_SETUP_URL |
| 1363 |
|
| 1364 |
Specifies the two-factor setup URL. |
| 1365 |
|
| 1366 |
Default: ``"/tf-setup"``. |
| 1367 |
.. py:data:: SECURITY_TWO_FACTOR_TOKEN_VALIDATION_URL |
| 1368 |
|
| 1369 |
Specifies the two-factor token validation URL. |
| 1370 |
|
| 1371 |
Default: ``"/tf-validate"``. |
| 1372 |
|
| 1373 |
.. py:data:: SECURITY_TWO_FACTOR_RESCUE_URL |
| 1374 |
|
| 1375 |
Specifies the two-factor rescue URL. |
| 1376 |
|
| 1377 |
Default: ``"/tf-rescue"``. |
| 1378 |
|
| 1379 |
.. py:data:: SECURITY_TWO_FACTOR_SELECT_URL |
| 1380 |
|
| 1381 |
Specifies the two-factor select URL. This is used when the user has |
| 1382 |
setup more than one second factor - see :ref:`webauthn:webauthn`. |
| 1383 |
|
| 1384 |
Default: ``"/tf-select"``. |
| 1385 |
|
| 1386 |
.. versionadded:: 5.0.0 |
| 1387 |
|
| 1388 |
.. py:data:: SECURITY_TWO_FACTOR_ERROR_VIEW |
| 1389 |
|
| 1390 |
Specifies a URL or endpoint to redirect to if the system detects that |
| 1391 |
a two-factor endpoint is being accessed without the proper state. For example |
| 1392 |
if ``tf-validate`` is accessed but the caller hasn't yet successfully passed the |
| 1393 |
primary authentication. |
| 1394 |
|
| 1395 |
Default: ``".login"`` |
| 1396 |
|
| 1397 |
.. versionadded:: 5.1.0 |
| 1398 |
|
| 1399 |
.. py:data:: SECURITY_TWO_FACTOR_POST_SETUP_VIEW |
| 1400 |
|
| 1401 |
Specifies the view to redirect to after a user successfully setups a two-factor method (non-json). |
| 1402 |
This value can be set to a URL or an endpoint name. |
| 1403 |
|
| 1404 |
Default: ``".two_factor_setup"`` |
| 1405 |
|
| 1406 |
.. versionadded:: 5.1.0 |
| 1407 |
|
| 1408 |
.. py:data:: SECURITY_TWO_FACTOR_SELECT_TEMPLATE |
| 1409 |
|
| 1410 |
Specifies the path to the template for the select method page for the two-factor authentication process. |
| 1411 |
This is used when more than one two-factor method has been setup (e.g. SMS and Webauthn). |
| 1412 |
|
| 1413 |
Default: ``"security/two_factor_select.html"``. |
| 1414 |
|
| 1415 |
.. versionadded:: 5.0.0 |
| 1416 |
|
| 1417 |
.. py:data:: SECURITY_TWO_FACTOR_ALWAYS_VALIDATE |
| 1418 |
|
| 1419 |
Specifies whether the application should require a two-factor code upon every login. |
| 1420 |
If set to ``False`` then the 2 values below are used to determine when |
| 1421 |
a code is required. Note that this is cookie based - so a new browser |
| 1422 |
session will always require a fresh two-factor code. |
| 1423 |
|
| 1424 |
Default: ``True``. |
| 1425 |
.. py:data:: SECURITY_TWO_FACTOR_LOGIN_VALIDITY |
| 1426 |
|
| 1427 |
Specifies the expiration of the two-factor validity cookie and verification of the token. |
| 1428 |
|
| 1429 |
Default: ``"30 Days"``. |
| 1430 |
|
| 1431 |
|
| 1432 |
.. py:data:: SECURITY_TWO_FACTOR_VALIDITY_COOKIE |
| 1433 |
|
| 1434 |
A dictionary containing the parameters of the two-factor validity cookie. |
| 1435 |
The complete set of parameters is described in Flask's `set_cookie`_ documentation. |
| 1436 |
|
| 1437 |
Default: ``{'httponly': True, 'secure': False, 'samesite': None}``. |
| 1438 |
|
| 1439 |
.. py:data:: SECURITY_TWO_FACTOR_IMPLEMENTATIONS |
| 1440 |
|
| 1441 |
A dictionary of supported second factor implementations. All of these must |
| 1442 |
implement the TfPluginBase interface. |
| 1443 |
|
| 1444 |
Default: ``{"code": "flask_security.twofactor.CodeTfPlugin", "webauthn": "flask_security.webauthn.WebAuthnTfPlugin",}`` |
| 1445 |
|
| 1446 |
.. versionadded:: 5.0.0 |
| 1447 |
|
| 1448 |
.. py:data:: SECURITY_TWO_FACTOR_RESCUE_EMAIL |
| 1449 |
|
| 1450 |
If True, then the 'email' option for two-factor rescue is enabled - allowing a user to |
| 1451 |
recover a missing/inoperable second factor device by requesting a one time code sent to their email. |
| 1452 |
While this is very convenient is has the downside that if a user's email is hacked, their second factor |
| 1453 |
is useless to protect their account. |
| 1454 |
|
| 1455 |
Default: ``True`` |
| 1456 |
|
| 1457 |
.. versionadded:: 5.0.0 |
| 1458 |
|
| 1459 |
Unified Signin |
| 1460 |
-------------- |
| 1461 |
|
| 1462 |
Unified sign in provides a generalized sign in endpoint that takes an `identity` |
| 1463 |
and a `passcode`. |
| 1464 |
|
| 1465 |
.. versionadded:: 3.4.0 |
| 1466 |
|
| 1467 |
.. py:data:: SECURITY_UNIFIED_SIGNIN |
| 1468 |
|
| 1469 |
To enable this feature - set this to ``True``. |
| 1470 |
|
| 1471 |
Default: ``False`` |
| 1472 |
|
| 1473 |
.. py:data:: SECURITY_US_SIGNIN_URL |
| 1474 |
|
| 1475 |
Sign in a user with an identity and a passcode. |
| 1476 |
|
| 1477 |
Default: ``"/us-signin"`` |
| 1478 |
|
| 1479 |
.. py:data:: SECURITY_US_SIGNIN_SEND_CODE_URL |
| 1480 |
|
| 1481 |
Endpoint that given an identity, and a previously setup authentication method, will |
| 1482 |
generate and return a one time code. This isn't necessary when using an authenticator |
| 1483 |
app. |
| 1484 |
|
| 1485 |
Default: ``"/us-signin/send-code"`` |
| 1486 |
|
| 1487 |
.. py:data:: SECURITY_US_SETUP_URL |
| 1488 |
|
| 1489 |
Endpoint for setting up and validating SMS or an authenticator app for use in |
| 1490 |
receiving one-time codes. |
| 1491 |
|
| 1492 |
Default: ``"/us-setup"`` |
| 1493 |
|
| 1494 |
.. py:data:: SECURITY_US_VERIFY_LINK_URL |
| 1495 |
|
| 1496 |
This endpoint handles the 'magic link' that is sent when the user requests a code |
| 1497 |
via email. It is mostly just accessed via a ``GET`` from an email reader. |
| 1498 |
|
| 1499 |
Default: ``"/us-verify-link"`` |
| 1500 |
|
| 1501 |
.. py:data:: SECURITY_US_VERIFY_URL |
| 1502 |
|
| 1503 |
This endpoint handles reauthentication, the caller must be already authenticated |
| 1504 |
and then enter in their primary credentials (password/passcode) again. This is |
| 1505 |
used when an endpoint (such as ``/us-setup``) fails freshness checks. |
| 1506 |
This endpoint won't be registered if :py:data:`SECURITY_FRESHNESS` evaluates to < 0. |
| 1507 |
|
| 1508 |
Default: ``"/us-verify"`` |
| 1509 |
|
| 1510 |
.. py:data:: SECURITY_US_VERIFY_SEND_CODE_URL |
| 1511 |
|
| 1512 |
As part of ``/us-verify``, this endpoint will send the appropriate code. |
| 1513 |
This endpoint won't be registered if :py:data:`SECURITY_FRESHNESS` evaluates to < 0. |
| 1514 |
|
| 1515 |
Default: ``"/us-verify/send-code"`` |
| 1516 |
|
| 1517 |
.. py:data:: SECURITY_US_POST_SETUP_VIEW |
| 1518 |
|
| 1519 |
Specifies the view to redirect to after a user successfully setups an authentication method (non-json). |
| 1520 |
This value can be set to a URL or an endpoint name. |
| 1521 |
|
| 1522 |
Default: ``".us-setup"`` |
| 1523 |
|
| 1524 |
.. py:data:: SECURITY_US_SIGNIN_TEMPLATE |
| 1525 |
|
| 1526 |
Default: ``"security/us_signin.html"`` |
| 1527 |
|
| 1528 |
.. py:data:: SECURITY_US_SETUP_TEMPLATE |
| 1529 |
|
| 1530 |
Default: ``"security/us_setup.html"`` |
| 1531 |
|
| 1532 |
.. py:data:: SECURITY_US_VERIFY_TEMPLATE |
| 1533 |
|
| 1534 |
Default: ``"security/us_verify.html"`` |
| 1535 |
|
| 1536 |
.. py:data:: SECURITY_US_ENABLED_METHODS |
| 1537 |
|
| 1538 |
Specifies the default enabled methods for unified signin authentication. |
| 1539 |
Be aware that ``password`` only affects this :data:`SECURITY_US_SIGNIN_URL` endpoint. |
| 1540 |
Removing it from here won't stop users from using the :data:`SECURITY_LOGIN_URL` endpoint |
| 1541 |
(unless you replace the login endpoint using :py:data:`SECURITY_US_SIGNIN_REPLACES_LOGIN`). |
| 1542 |
|
| 1543 |
This config variable defines which methods can be used to provide ``passcode`` data. |
| 1544 |
:py:data:`SECURITY_USER_IDENTITY_ATTRIBUTES` defines which user model fields can be used as ``identity``. |
| 1545 |
|
| 1546 |
Default: ``["password", "email", "authenticator", "sms"]`` - which are the only supported options. |
| 1547 |
|
| 1548 |
.. py:data:: SECURITY_US_MFA_REQUIRED |
| 1549 |
|
| 1550 |
A list of :data:`SECURITY_US_ENABLED_METHODS` that will require two-factor |
| 1551 |
authentication. This is of course dependent on the settings of :py:data:`SECURITY_TWO_FACTOR` |
| 1552 |
and :py:data:`SECURITY_TWO_FACTOR_REQUIRED`. Note that even with REQUIRED, only |
| 1553 |
methods listed here will trigger a two-factor cycle. |
| 1554 |
|
| 1555 |
Default: ``["password", "email"]``. |
| 1556 |
|
| 1557 |
.. py:data:: SECURITY_US_TOKEN_VALIDITY |
| 1558 |
|
| 1559 |
Specifies the number of seconds access token/code is valid. |
| 1560 |
|
| 1561 |
Default: ``120`` |
| 1562 |
|
| 1563 |
.. py:data:: SECURITY_US_EMAIL_SUBJECT |
| 1564 |
|
| 1565 |
Sets the email subject when sending the verification code via email. |
| 1566 |
|
| 1567 |
Default: ``_("Verification Code")`` |
| 1568 |
|
| 1569 |
.. py:data:: SECURITY_US_SETUP_WITHIN |
| 1570 |
|
| 1571 |
Specifies the amount of time a user has before their setup |
| 1572 |
token expires. Always pluralize the time unit for this value. |
| 1573 |
|
| 1574 |
Default: ``"30 minutes"`` |
| 1575 |
|
| 1576 |
.. py:data:: SECURITY_US_SIGNIN_REPLACES_LOGIN |
| 1577 |
|
| 1578 |
If set, then the :py:data:`SECURITY_LOGIN_URL` will be registered to the ``us-signin`` endpoint. |
| 1579 |
Doing this will mean that logout will properly redirect to the us-signin endpoint. |
| 1580 |
|
| 1581 |
Default: ``False`` |
| 1582 |
|
| 1583 |
|
| 1584 |
Additional relevant configuration variables: |
| 1585 |
|
| 1586 |
* :py:data:`SECURITY_USER_IDENTITY_ATTRIBUTES` - Defines the order and methods for parsing and validating identity. |
| 1587 |
* :py:data:`SECURITY_PASSWORD_REQUIRED` - Can a user register w/o a password? |
| 1588 |
* :py:data:`SECURITY_DEFAULT_REMEMBER_ME` |
| 1589 |
* :py:data:`SECURITY_SMS_SERVICE` - When SMS is enabled in :py:data:`SECURITY_US_ENABLED_METHODS`. |
| 1590 |
* :py:data:`SECURITY_SMS_SERVICE_CONFIG` |
| 1591 |
* :py:data:`SECURITY_TOTP_SECRETS` |
| 1592 |
* :py:data:`SECURITY_TOTP_ISSUER` |
| 1593 |
* :py:data:`SECURITY_PHONE_REGION_DEFAULT` |
| 1594 |
* :py:data:`SECURITY_LOGIN_ERROR_VIEW` - The user is redirected here if |
| 1595 |
:py:data:`SECURITY_US_VERIFY_LINK_URL` has an error and the request is json and |
| 1596 |
:py:data:`SECURITY_REDIRECT_BEHAVIOR` equals ``"spa"``. |
| 1597 |
* :py:data:`SECURITY_FRESHNESS` - Used to protect /us-setup. |
| 1598 |
* :py:data:`SECURITY_FRESHNESS_GRACE_PERIOD` - Used to protect /us-setup. |
| 1599 |
|
| 1600 |
Username-Recovery |
| 1601 |
----------------- |
| 1602 |
|
| 1603 |
.. versionadded:: 5.6.0 |
| 1604 |
|
| 1605 |
.. py:data:: SECURITY_USERNAME_RECOVERY |
| 1606 |
|
| 1607 |
Specifies whether username recovery is enabled. If set to ``True`` the UserModel |
| 1608 |
must contain a column ``"username"``. Note that this feature is independent |
| 1609 |
of the :py:data:`SECURITY_USERNAME_ENABLE` feature. |
| 1610 |
|
| 1611 |
Default: ``False``. |
| 1612 |
|
| 1613 |
.. py:data:: SECURITY_USERNAME_RECOVERY_URL |
| 1614 |
|
| 1615 |
Specifies the username recovery URL. |
| 1616 |
|
| 1617 |
Default: ``"/recover-username"``. |
| 1618 |
|
| 1619 |
.. py:data:: SECURITY_EMAIL_SUBJECT_USERNAME_RECOVERY |
| 1620 |
|
| 1621 |
Sets subject for the username recovery email. |
| 1622 |
|
| 1623 |
Default: ``_("Your requested username")``. |
| 1624 |
|
| 1625 |
.. py:data:: SECURITY_USERNAME_RECOVERY_TEMPLATE |
| 1626 |
|
| 1627 |
Specifies the path to the template for the username recovery page. |
| 1628 |
|
| 1629 |
Default: ``"security/recover_username.html"``. |
| 1630 |
|
| 1631 |
Change Username |
| 1632 |
----------------- |
| 1633 |
|
| 1634 |
.. versionadded:: 5.6.0 |
| 1635 |
|
| 1636 |
.. py:data:: SECURITY_CHANGE_USERNAME |
| 1637 |
|
| 1638 |
Specifies whether change username feature is enabled. |
| 1639 |
This feature should be used in conjunction with |
| 1640 |
the :py:data:`SECURITY_USERNAME_ENABLE` feature. |
| 1641 |
|
| 1642 |
Default: ``False``. |
| 1643 |
|
| 1644 |
.. py:data:: SECURITY_CHANGE_USERNAME_URL |
| 1645 |
|
| 1646 |
Specifies the change username URL. |
| 1647 |
|
| 1648 |
Default: ``"/change-username"``. |
| 1649 |
|
| 1650 |
.. py:data:: SECURITY_POST_CHANGE_USERNAME_VIEW |
| 1651 |
|
| 1652 |
Specifies the view to redirect to after a user successfully changes their username. |
| 1653 |
This value can be set to a URL or an endpoint name. |
| 1654 |
If this value is ``None``, the user is redirected to the |
| 1655 |
value of :data:`SECURITY_POST_LOGIN_VIEW`. |
| 1656 |
|
| 1657 |
Default: ``None``. |
| 1658 |
|
| 1659 |
.. py:data:: SECURITY_SEND_USERNAME_CHANGE_EMAIL |
| 1660 |
|
| 1661 |
If ``True`` then an email will be sent to the registered user upon |
| 1662 |
successful change of their username. |
| 1663 |
|
| 1664 |
Default: ``True``. |
| 1665 |
|
| 1666 |
.. py:data:: SECURITY_EMAIL_SUBJECT_USERNAME_CHANGE_NOTICE |
| 1667 |
|
| 1668 |
Sets subject for the change username email. |
| 1669 |
|
| 1670 |
Default: ``_(""Your username has been changed"")``. |
| 1671 |
|
| 1672 |
.. py:data:: SECURITY_CHANGE_USERNAME_TEMPLATE |
| 1673 |
|
| 1674 |
Specifies the path to the template for the change username page. |
| 1675 |
|
| 1676 |
Default: ``"security/change_username.html"``. |
| 1677 |
|
| 1678 |
Additional relevant configuration variables: |
| 1679 |
|
| 1680 |
* :py:data:`SECURITY_FRESHNESS` - Used to protect /change-username. |
| 1681 |
* :py:data:`SECURITY_FRESHNESS_GRACE_PERIOD` - Used to protect /change-username. |
| 1682 |
|
| 1683 |
|
| 1684 |
Passwordless |
| 1685 |
------------- |
| 1686 |
|
| 1687 |
This feature is DEPRECATED as of 5.0.0. Please use unified signin feature instead. |
| 1688 |
|
| 1689 |
.. py:data:: SECURITY_PASSWORDLESS |
| 1690 |
|
| 1691 |
Specifies if Flask-Security should enable the passwordless login feature. |
| 1692 |
If set to ``True``, users are not required to enter a password to login but are |
| 1693 |
sent an email with a login link. |
| 1694 |
**This feature is being replaced with a more generalized passwordless feature |
| 1695 |
that includes using SMS or authenticator applications for generating codes.** |
| 1696 |
|
| 1697 |
Default: ``False``. |
| 1698 |
|
| 1699 |
.. py:data:: SECURITY_SEND_LOGIN_TEMPLATE |
| 1700 |
|
| 1701 |
Specifies the path to the template for the send login instructions page for |
| 1702 |
passwordless logins. |
| 1703 |
|
| 1704 |
Default:``"security/send_login.html"``. |
| 1705 |
|
| 1706 |
.. py:data:: SECURITY_EMAIL_SUBJECT_PASSWORDLESS |
| 1707 |
|
| 1708 |
Sets the subject for the passwordless feature. |
| 1709 |
|
| 1710 |
Default: ``_("Login instructions")``. |
| 1711 |
|
| 1712 |
.. py:data:: SECURITY_LOGIN_WITHIN |
| 1713 |
|
| 1714 |
Specifies the amount of time a user has before a login link expires. |
| 1715 |
Always pluralize the time unit for this value. |
| 1716 |
|
| 1717 |
Default: ``"1 days"``. |
| 1718 |
|
| 1719 |
.. py:data:: SECURITY_LOGIN_ERROR_VIEW |
| 1720 |
|
| 1721 |
Specifies the view/URL to redirect to after the following login/authentication errors: |
| 1722 |
|
| 1723 |
* GET passwordless link where the link is expired/incorrect |
| 1724 |
* GET unified sign in magic link when there is an error. |
| 1725 |
* GET on oauthresponse where there was an OAuth protocol error. |
| 1726 |
* GET on oauthresponse where the returned identity isn't registered. |
| 1727 |
|
| 1728 |
This is only valid if :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"``. |
| 1729 |
Query params in the redirect will contain the error. |
| 1730 |
|
| 1731 |
Default: ``None``. |
| 1732 |
|
| 1733 |
Trackable |
| 1734 |
---------- |
| 1735 |
.. py:data:: SECURITY_TRACKABLE |
| 1736 |
|
| 1737 |
Specifies if Flask-Security should track basic user login statistics. If set to ``True``, ensure your |
| 1738 |
models have the required fields/attributes and make sure to commit changes after calling |
| 1739 |
``login_user``. Be sure to use `ProxyFix <https://werkzeug.palletsprojects.com/en/stable/middleware/proxy_fix/>`_ if you are using a proxy. |
| 1740 |
|
| 1741 |
Default: ``False`` |
| 1742 |
|
| 1743 |
WebAuthn |
| 1744 |
-------------- |
| 1745 |
|
| 1746 |
.. versionadded:: 5.0.0 |
| 1747 |
|
| 1748 |
.. py:data:: SECURITY_WEBAUTHN |
| 1749 |
|
| 1750 |
To enable this feature - set this to ``True``. Please see :ref:`models_topic` for |
| 1751 |
required additions to your database models. |
| 1752 |
|
| 1753 |
Default: ``False`` |
| 1754 |
|
| 1755 |
.. py:data:: SECURITY_WAN_REGISTER_URL |
| 1756 |
|
| 1757 |
Endpoint for registering WebAuthn credentials/passkeys. |
| 1758 |
|
| 1759 |
Default: ``"/wan-register"`` |
| 1760 |
|
| 1761 |
.. py:data:: SECURITY_WAN_SIGNIN_URL |
| 1762 |
|
| 1763 |
Endpoint for signing in using a WebAuthn credential/passkey. |
| 1764 |
|
| 1765 |
Default: ``"/wan-signin"`` |
| 1766 |
|
| 1767 |
.. py:data:: SECURITY_WAN_DELETE_URL |
| 1768 |
|
| 1769 |
Endpoint for removing a WebAuthn credential/passkey. |
| 1770 |
|
| 1771 |
Default: ``"/wan-delete"`` |
| 1772 |
|
| 1773 |
.. py:data:: SECURITY_WAN_VERIFY_URL |
| 1774 |
|
| 1775 |
Endpoint for reauthenticating using a WebAuthn credential/passkey. |
| 1776 |
|
| 1777 |
Default: ``"/wan-verify"`` |
| 1778 |
|
| 1779 |
.. py:data:: SECURITY_WAN_POST_REGISTER_VIEW |
| 1780 |
|
| 1781 |
Specifies the view to redirect to after a user successfully registers a new WebAuthn credential/passkey (non-json). |
| 1782 |
This value can be set to a URL or an endpoint name. |
| 1783 |
|
| 1784 |
Default: ``".wan-register"`` |
| 1785 |
|
| 1786 |
.. py:data:: SECURITY_WAN_REGISTER_TEMPLATE |
| 1787 |
|
| 1788 |
Default: ``"security/wan_register.html"`` |
| 1789 |
|
| 1790 |
.. py:data:: SECURITY_WAN_SIGNIN_TEMPLATE |
| 1791 |
|
| 1792 |
Default: ``"security/wan_signin.html"`` |
| 1793 |
|
| 1794 |
.. py:data:: SECURITY_WAN_VERIFY_TEMPLATE |
| 1795 |
|
| 1796 |
Default: ``"security/wan_verify.html"`` |
| 1797 |
|
| 1798 |
|
| 1799 |
.. py:data:: SECURITY_WAN_RP_NAME |
| 1800 |
|
| 1801 |
The Relying Party (that's us!) name passed as part of credential |
| 1802 |
creation. Defined in the `spec <https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#dictionary-pkcredentialentity>`_. |
| 1803 |
|
| 1804 |
Default: ``"My Flask App"`` |
| 1805 |
|
| 1806 |
.. py:data:: SECURITY_WAN_REGISTER_WITHIN |
| 1807 |
|
| 1808 |
Specifies the amount of time a user has before their register |
| 1809 |
token expires. Always pluralize the time unit for this value. |
| 1810 |
|
| 1811 |
Default: ``"30 minutes"`` |
| 1812 |
|
| 1813 |
.. py:data:: SECURITY_WAN_REGISTER_TIMEOUT |
| 1814 |
|
| 1815 |
Specifies the timeout that is passed as part of PublicKeyCredentialCreationOptions. |
| 1816 |
In milliseconds. |
| 1817 |
|
| 1818 |
Default: ``60000`` |
| 1819 |
|
| 1820 |
.. py:data:: SECURITY_WAN_SIGNIN_WITHIN |
| 1821 |
|
| 1822 |
Specifies the amount of time a user has before their signin |
| 1823 |
token expires. Always pluralize the time unit for this value. |
| 1824 |
|
| 1825 |
Default: ``"1 minutes"`` |
| 1826 |
|
| 1827 |
.. py:data:: SECURITY_WAN_SIGNIN_TIMEOUT |
| 1828 |
|
| 1829 |
Specifies the timeout that is passed as part of PublicKeyCredentialRequestOptions. |
| 1830 |
In milliseconds. |
| 1831 |
|
| 1832 |
Default: ``60000`` |
| 1833 |
|
| 1834 |
.. py:data:: SECURITY_WAN_ALLOW_AS_FIRST_FACTOR |
| 1835 |
|
| 1836 |
If True then a WebAuthn credential/passkey may be registered for use as the first (or only) |
| 1837 |
authentication factor. This will set the default ``AuthenticatorSelectionCriteria`` |
| 1838 |
to require a cross-platform key. |
| 1839 |
|
| 1840 |
Default: ``True`` |
| 1841 |
|
| 1842 |
.. py:data:: SECURITY_WAN_ALLOW_AS_MULTI_FACTOR |
| 1843 |
|
| 1844 |
If True then a WebAuthn credential/passkey can be used |
| 1845 |
as both a primary and a secondary factor. This requires that the key |
| 1846 |
supports 'UserVerification'. |
| 1847 |
|
| 1848 |
Default: ``True`` |
| 1849 |
|
| 1850 |
.. py:data:: SECURITY_WAN_ALLOW_USER_HINTS |
| 1851 |
|
| 1852 |
If True then an unauthenticated user can request a list of registered |
| 1853 |
WebAuthn credentials/passkeys. This allows the use of non-resident (non-discoverable) |
| 1854 |
keys, but has the possible security concern that it allows 'user discovery'. |
| 1855 |
Look at https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-username-enumeration |
| 1856 |
for a good writeup. |
| 1857 |
|
| 1858 |
If this is ``False`` and :py:data:`SECURITY_WAN_ALLOW_AS_FIRST_FACTOR` is ``True`` |
| 1859 |
(the default) then by default, ``AuthenticatorSelectionCriteria`` will be set |
| 1860 |
to require a Resident key. |
| 1861 |
|
| 1862 |
Default: ``True`` |
| 1863 |
|
| 1864 |
.. py:data:: SECURITY_WAN_ALLOW_AS_VERIFY |
| 1865 |
|
| 1866 |
Sets which type of WebAuthn security credential, if any, may be used for |
| 1867 |
reauthentication/verify events. This is a list with possible values: |
| 1868 |
|
| 1869 |
- ``"first"`` - just credentials/passkeys registered as "first" usage are allowed |
| 1870 |
- ``"secondary"`` - just credentials/passkeys registered as "secondary" are allowed |
| 1871 |
|
| 1872 |
If list is empty or ``None`` WebAuthn credentials/passkeys aren't allowed. This also means that the |
| 1873 |
:py:data:`SECURITY_WAN_VERIFY_URL` endpoint won't be registered. |
| 1874 |
|
| 1875 |
Default: ``["first", "secondary"]`` |
| 1876 |
|
| 1877 |
|
| 1878 |
Additional relevant configuration variables: |
| 1879 |
|
| 1880 |
* :py:data:`SECURITY_FRESHNESS` - Used to protect /wan-register and /wan-delete. |
| 1881 |
* :py:data:`SECURITY_FRESHNESS_GRACE_PERIOD` - Used to protect /wan-register and /wan-delete. |
| 1882 |
|
| 1883 |
Recovery Codes |
| 1884 |
-------------- |
| 1885 |
|
| 1886 |
.. versionadded:: 5.0.0 |
| 1887 |
|
| 1888 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_CODES |
| 1889 |
|
| 1890 |
To enable this feature - set this to ``True``. Please see :ref:`models_topic` for |
| 1891 |
required additions to your database models. This enables a user to generate and |
| 1892 |
use a recovery code for two-factor authentication. This works for all two-factor |
| 1893 |
mechanisms - including WebAuthn. Note that these code are single use and |
| 1894 |
the user should be advised to write them down and store in a safe place. |
| 1895 |
|
| 1896 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_CODES_N |
| 1897 |
|
| 1898 |
How many recovery codes to generate. |
| 1899 |
|
| 1900 |
Default:: ``5`` |
| 1901 |
|
| 1902 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_CODES_URL |
| 1903 |
|
| 1904 |
Endpoint for displaying and generating recovery codes. |
| 1905 |
|
| 1906 |
Default: ``"/mf-recovery-codes"`` |
| 1907 |
|
| 1908 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_CODES_TEMPLATE |
| 1909 |
|
| 1910 |
Default: ``"security/mf_recovery_codes.html"`` |
| 1911 |
|
| 1912 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_URL |
| 1913 |
|
| 1914 |
Endpoint for entering a recovery code. |
| 1915 |
|
| 1916 |
Default: ``"/mf-recovery"`` |
| 1917 |
|
| 1918 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_TEMPLATE |
| 1919 |
|
| 1920 |
Default: ``"security/mf_recovery.html"`` |
| 1921 |
|
| 1922 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_CODES_KEYS |
| 1923 |
|
| 1924 |
A list of keys used to encrypt the recovery codes at rest (i.e. in the database). |
| 1925 |
The default implementation uses cryptography.fernet (https://cryptography.io/en/latest/fernet/#cryptography.fernet.Fernet) |
| 1926 |
- so the keys should be generated by:: |
| 1927 |
|
| 1928 |
from cryptography.fernet import Fernet |
| 1929 |
key = Fernet.generate_key() |
| 1930 |
|
| 1931 |
Multiple keys can be configured allowing for key rotation. |
| 1932 |
|
| 1933 |
Default: ``None`` - recovery codes will NOT be encrypted on disk |
| 1934 |
|
| 1935 |
.. versionadded:: 5.1.0 |
| 1936 |
|
| 1937 |
.. py:data:: SECURITY_MULTI_FACTOR_RECOVERY_CODE_TTL |
| 1938 |
|
| 1939 |
An integer passed to decrypt specifying the maximum age of the code. |
| 1940 |
|
| 1941 |
Default: ``None`` - no TTL will be enforced. |
| 1942 |
|
| 1943 |
.. versionadded:: 5.1.0 |
| 1944 |
|
| 1945 |
Additional relevant configuration variables: |
| 1946 |
|
| 1947 |
* :py:data:`SECURITY_FRESHNESS` - Used to protect /mf-recovery-codes. |
| 1948 |
* :py:data:`SECURITY_FRESHNESS_GRACE_PERIOD` - Used to protect /mf-recovery-codes. |
| 1949 |
* :py:data:`SECURITY_TOTP_SECRETS` - TOTP/passlib is used to generate the codes. |
| 1950 |
* :py:data:`SECURITY_TOTP_ISSUER` |
| 1951 |
|
| 1952 |
Social Login (OAuth) |
| 1953 |
-------------------- |
| 1954 |
.. versionadded:: 5.1.0 |
| 1955 |
|
| 1956 |
.. py:data:: SECURITY_OAUTH_ENABLE |
| 1957 |
|
| 1958 |
To enable using external OAuth providers - set this to ``True``. |
| 1959 |
|
| 1960 |
.. py:data:: SECURITY_OAUTH_BUILTIN_PROVIDERS |
| 1961 |
|
| 1962 |
A list of built-in providers to register. |
| 1963 |
|
| 1964 |
Default: ``["google", "github"]`` |
| 1965 |
|
| 1966 |
.. py:data:: SECURITY_OAUTH_START_URL |
| 1967 |
|
| 1968 |
Endpoint for starting an OAuth authentication operation. |
| 1969 |
|
| 1970 |
Default: ``"/login/oauthstart"`` |
| 1971 |
|
| 1972 |
.. py:data:: SECURITY_OAUTH_RESPONSE_URL |
| 1973 |
|
| 1974 |
Endpoint used as OAuth redirect. |
| 1975 |
|
| 1976 |
Default: ``"/login/oauthresponse"`` |
| 1977 |
|
| 1978 |
.. py:data:: SECURITY_POST_OAUTH_LOGIN_VIEW |
| 1979 |
|
| 1980 |
Specifies the view/URL to redirect to after a successful authentication (login) |
| 1981 |
using social login (OAuth). |
| 1982 |
This is only valid if :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"``. |
| 1983 |
Query params in the redirect will contain `identity` and `email`. |
| 1984 |
|
| 1985 |
Default: ``None``. |
| 1986 |
|
| 1987 |
.. versionadded:: 5.4.0 |
| 1988 |
|
| 1989 |
.. py:data:: SECURITY_OAUTH_VERIFY_START_URL |
| 1990 |
|
| 1991 |
Endpoint for starting an OAuth reauthentication/verify operation. |
| 1992 |
|
| 1993 |
Default: ``"/login/oauth-verify-start"`` |
| 1994 |
|
| 1995 |
.. versionadded:: 5.8.0 |
| 1996 |
|
| 1997 |
.. py:data:: SECURITY_OAUTH_VERIFY_RESPONSE_URL |
| 1998 |
|
| 1999 |
Endpoint used as the OAuth verify redirect. |
| 2000 |
|
| 2001 |
Default: ``"/login/oauth-verify-response"`` |
| 2002 |
|
| 2003 |
.. versionadded:: 5.8.0 |
| 2004 |
|
| 2005 |
.. py:data:: SECURITY_POST_OAUTH_VERIFY_VIEW |
| 2006 |
|
| 2007 |
Specifies the view/URL to redirect to after a successful reauthentication (verify) |
| 2008 |
using social login/oauth. |
| 2009 |
This is only valid if :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"``. |
| 2010 |
Query params in the redirect will contain `identity` and `email`. |
| 2011 |
|
| 2012 |
Default: ``None``. |
| 2013 |
|
| 2014 |
.. versionadded:: 5.8.0 |
| 2015 |
|
| 2016 |
.. py:data:: SECURITY_VERIFY_ERROR_VIEW |
| 2017 |
|
| 2018 |
Specifies the view/URL to redirect to after the following login/authentication errors: |
| 2019 |
|
| 2020 |
* GET on oauth-verify-response where there was an OAuth protocol error. |
| 2021 |
* GET on oauth-verify-response where the returned identity isn't registered. |
| 2022 |
|
| 2023 |
This is only valid if :py:data:`SECURITY_REDIRECT_BEHAVIOR` == ``"spa"``. |
| 2024 |
Query params in the redirect will contain the error type and message. |
| 2025 |
|
| 2026 |
Default: ``None``. |
| 2027 |
|
| 2028 |
.. versionadded:: 5.8.0 |
| 2029 |
|
| 2030 |
Feature Flags |
| 2031 |
------------- |
| 2032 |
All feature flags. By default all are ``False``/not enabled. |
| 2033 |
|
| 2034 |
* :py:data:`SECURITY_CHANGE_EMAIL` |
| 2035 |
* :py:data:`SECURITY_CHANGE_USERNAME` |
| 2036 |
* :py:data:`SECURITY_CONFIRMABLE` |
| 2037 |
* :py:data:`SECURITY_REGISTERABLE` |
| 2038 |
* :py:data:`SECURITY_RECOVERABLE` |
| 2039 |
* :py:data:`SECURITY_TRACKABLE` |
| 2040 |
* :py:data:`SECURITY_PASSWORDLESS` |
| 2041 |
* :py:data:`SECURITY_CHANGEABLE` |
| 2042 |
* :py:data:`SECURITY_TWO_FACTOR` |
| 2043 |
* :py:data:`SECURITY_UNIFIED_SIGNIN` |
| 2044 |
* :py:data:`SECURITY_USERNAME_RECOVERY` |
| 2045 |
* :py:data:`SECURITY_WEBAUTHN` |
| 2046 |
* :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_CODES` |
| 2047 |
* :py:data:`SECURITY_OAUTH_ENABLE` |
| 2048 |
|
| 2049 |
URLs and Views |
| 2050 |
-------------- |
| 2051 |
A list of all URLs and Views: |
| 2052 |
|
| 2053 |
* :py:data:`SECURITY_LOGIN_URL` ``"/login"`` |
| 2054 |
* :py:data:`SECURITY_LOGOUT_URL` ``"/logout"`` |
| 2055 |
* :py:data:`SECURITY_VERIFY_URL` ``"/verify"`` |
| 2056 |
* :py:data:`SECURITY_REGISTER_URL` ``"/register"`` |
| 2057 |
* :py:data:`SECURITY_CHANGE_EMAIL_URL` ``"change-email"`` |
| 2058 |
* :py:data:`SECURITY_CHANGE_EMAIL_CONFIRM_URL` ``"/change-email-confirm"`` |
| 2059 |
* :py:data:`SECURITY_CHANGE_USERNAME_URL` ``"change-username"`` |
| 2060 |
* :py:data:`SECURITY_RESET_URL` ``"/reset"`` |
| 2061 |
* :py:data:`SECURITY_CHANGE_URL` ``"/change"`` |
| 2062 |
* :py:data:`SECURITY_CONFIRM_URL` ``"/confirm"`` |
| 2063 |
* :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_CODES_URL` ``"/mf-recovery-codes"`` |
| 2064 |
* :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_URL` ``"/mf-recovery"`` |
| 2065 |
* :py:data:`SECURITY_OAUTH_START_URL` ``"/login/oauthstart"`` |
| 2066 |
* :py:data:`SECURITY_OAUTH_RESPONSE_URL` ``"/login/oauthresponse"`` |
| 2067 |
* :py:data:`SECURITY_OAUTH_VERIFY_START_URL` ``"/login/oauth-verify-start"`` |
| 2068 |
* :py:data:`SECURITY_OAUTH_VERIFY_RESPONSE_URL` ``"/login/oauth-verify-response"`` |
| 2069 |
* :py:data:`SECURITY_TWO_FACTOR_SELECT_URL` ``"/tf-select"`` |
| 2070 |
* :py:data:`SECURITY_TWO_FACTOR_SETUP_URL` ``"/tf-setup"`` |
| 2071 |
* :py:data:`SECURITY_TWO_FACTOR_TOKEN_VALIDATION_URL` ``"/tf-validate"`` |
| 2072 |
* :py:data:`SECURITY_TWO_FACTOR_RESCUE_URL` ``"/tf-rescue"`` |
| 2073 |
* :py:data:`SECURITY_TWO_FACTOR_ERROR_VIEW` |
| 2074 |
* :py:data:`SECURITY_TWO_FACTOR_POST_SETUP_VIEW` |
| 2075 |
* :py:data:`SECURITY_POST_LOGIN_VIEW` |
| 2076 |
* :py:data:`SECURITY_POST_LOGOUT_VIEW` |
| 2077 |
* :py:data:`SECURITY_CONFIRM_ERROR_VIEW` |
| 2078 |
* :py:data:`SECURITY_POST_REGISTER_VIEW` |
| 2079 |
* :py:data:`SECURITY_POST_CONFIRM_VIEW` |
| 2080 |
* :py:data:`SECURITY_POST_RESET_VIEW` |
| 2081 |
* :py:data:`SECURITY_POST_CHANGE_VIEW` |
| 2082 |
* :py:data:`SECURITY_POST_OAUTH_LOGIN_VIEW` |
| 2083 |
* :py:data:`SECURITY_POST_OAUTH_VERIFY_VIEW` |
| 2084 |
* :py:data:`SECURITY_UNAUTHORIZED_VIEW` |
| 2085 |
* :py:data:`SECURITY_RESET_VIEW` |
| 2086 |
* :py:data:`SECURITY_RESET_ERROR_VIEW` |
| 2087 |
* :py:data:`SECURITY_LOGIN_ERROR_VIEW` |
| 2088 |
* :py:data:`SECURITY_USERNAME_RECOVERY_URL` |
| 2089 |
* :py:data:`SECURITY_US_SIGNIN_URL` |
| 2090 |
* :py:data:`SECURITY_US_SETUP_URL` |
| 2091 |
* :py:data:`SECURITY_US_SIGNIN_SEND_CODE_URL` |
| 2092 |
* :py:data:`SECURITY_US_VERIFY_LINK_URL` |
| 2093 |
* :py:data:`SECURITY_US_VERIFY_URL` |
| 2094 |
* :py:data:`SECURITY_US_VERIFY_SEND_CODE_URL` |
| 2095 |
* :py:data:`SECURITY_US_POST_SETUP_VIEW` |
| 2096 |
* :py:data:`SECURITY_VERIFY_ERROR_VIEW` |
| 2097 |
* :py:data:`SECURITY_WAN_REGISTER_URL` |
| 2098 |
* :py:data:`SECURITY_WAN_SIGNIN_URL` |
| 2099 |
* :py:data:`SECURITY_WAN_DELETE_URL` |
| 2100 |
* :py:data:`SECURITY_WAN_VERIFY_URL` |
| 2101 |
* :py:data:`SECURITY_WAN_POST_REGISTER_VIEW` |
| 2102 |
|
| 2103 |
Template Paths |
| 2104 |
-------------- |
| 2105 |
A list of all templates: |
| 2106 |
|
| 2107 |
* :py:data:`SECURITY_FORGOT_PASSWORD_TEMPLATE` |
| 2108 |
* :py:data:`SECURITY_LOGIN_USER_TEMPLATE` |
| 2109 |
* :py:data:`SECURITY_VERIFY_TEMPLATE` |
| 2110 |
* :py:data:`SECURITY_REGISTER_USER_TEMPLATE` |
| 2111 |
* :py:data:`SECURITY_RESET_PASSWORD_TEMPLATE` |
| 2112 |
* :py:data:`SECURITY_CHANGE_PASSWORD_TEMPLATE` |
| 2113 |
* :py:data:`SECURITY_CHANGE_EMAIL_TEMPLATE` |
| 2114 |
* :py:data:`SECURITY_CHANGE_USERNAME_TEMPLATE` |
| 2115 |
* :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_TEMPLATE` |
| 2116 |
* :py:data:`SECURITY_MULTI_FACTOR_RECOVERY_CODES_TEMPLATE` |
| 2117 |
* :py:data:`SECURITY_SEND_CONFIRMATION_TEMPLATE` |
| 2118 |
* :py:data:`SECURITY_SEND_LOGIN_TEMPLATE` |
| 2119 |
* :py:data:`SECURITY_TWO_FACTOR_VERIFY_CODE_TEMPLATE` |
| 2120 |
* :py:data:`SECURITY_TWO_FACTOR_SELECT_TEMPLATE` |
| 2121 |
* :py:data:`SECURITY_TWO_FACTOR_SETUP_TEMPLATE` |
| 2122 |
* :py:data:`SECURITY_USERNAME_RECOVERY_TEMPLATE` |
| 2123 |
* :py:data:`SECURITY_US_SIGNIN_TEMPLATE` |
| 2124 |
* :py:data:`SECURITY_US_SETUP_TEMPLATE` |
| 2125 |
* :py:data:`SECURITY_US_VERIFY_TEMPLATE` |
| 2126 |
* :py:data:`SECURITY_WAN_REGISTER_TEMPLATE` |
| 2127 |
* :py:data:`SECURITY_WAN_SIGNIN_TEMPLATE` |
| 2128 |
* :py:data:`SECURITY_WAN_VERIFY_TEMPLATE` |
| 2129 |
|
| 2130 |
Messages |
| 2131 |
------------- |
| 2132 |
|
| 2133 |
The following are the messages Flask-Security uses. They are tuples; the first |
| 2134 |
element is the message and the second element is the error level. |
| 2135 |
|
| 2136 |
The default messages and error levels can be found in ``core.py``. |
| 2137 |
|
| 2138 |
* ``SECURITY_MSG_ALREADY_CONFIRMED`` |
| 2139 |
* ``SECURITY_MSG_API_ERROR`` |
| 2140 |
* ``SECURITY_MSG_ANONYMOUS_USER_REQUIRED`` |
| 2141 |
* ``SECURITY_MSG_CHANGE_EMAIL_EXPIRED`` |
| 2142 |
* ``SECURITY_MSG_CHANGE_EMAIL_CONFIRMED`` |
| 2143 |
* ``SECURITY_MSG_CHANGE_EMAIL_SENT`` |
| 2144 |
* ``SECURITY_MSG_CODE_HAS_BEEN_SENT`` |
| 2145 |
* ``SECURITY_MSG_CONFIRMATION_EXPIRED`` |
| 2146 |
* ``SECURITY_MSG_CONFIRMATION_REQUEST`` |
| 2147 |
* ``SECURITY_MSG_CONFIRMATION_REQUIRED`` |
| 2148 |
* ``SECURITY_MSG_CONFIRM_REGISTRATION`` |
| 2149 |
* ``SECURITY_MSG_DISABLED_ACCOUNT`` |
| 2150 |
* ``SECURITY_MSG_EMAIL_ALREADY_ASSOCIATED`` |
| 2151 |
* ``SECURITY_MSG_EMAIL_CONFIRMED`` |
| 2152 |
* ``SECURITY_MSG_EMAIL_NOT_PROVIDED`` |
| 2153 |
* ``SECURITY_MSG_FAILED_TO_SEND_CODE`` |
| 2154 |
* ``SECURITY_MSG_FORGOT_PASSWORD`` |
| 2155 |
* ``SECURITY_MSG_GENERIC_AUTHN_FAILED`` |
| 2156 |
* ``SECURITY_MSG_GENERIC_RECOVERY`` |
| 2157 |
* ``SECURITY_MSG_GENERIC_US_SIGNIN`` |
| 2158 |
* ``SECURITY_MSG_IDENTITY_ALREADY_ASSOCIATED`` |
| 2159 |
* ``SECURITY_MSG_IDENTITY_NOT_REGISTERED`` |
| 2160 |
* ``SECURITY_MSG_INVALID_CODE`` |
| 2161 |
* ``SECURITY_MSG_INVALID_CONFIRMATION_TOKEN`` |
| 2162 |
* ``SECURITY_MSG_INVALID_EMAIL_ADDRESS`` |
| 2163 |
* ``SECURITY_MSG_INVALID_LOGIN_TOKEN`` |
| 2164 |
* ``SECURITY_MSG_INVALID_PASSWORD`` |
| 2165 |
* ``SECURITY_MSG_INVALID_PASSWORD_CODE`` |
| 2166 |
* ``SECURITY_MSG_INVALID_RECOVERY_CODE`` |
| 2167 |
* ``SECURITY_MSG_INVALID_REDIRECT`` |
| 2168 |
* ``SECURITY_MSG_INVALID_RESET_PASSWORD_TOKEN`` |
| 2169 |
* ``SECURITY_MSG_LOGIN`` |
| 2170 |
* ``SECURITY_MSG_LOGIN_EMAIL_SENT`` |
| 2171 |
* ``SECURITY_MSG_LOGIN_EXPIRED`` |
| 2172 |
* ``SECURITY_MSG_NO_RECOVERY_CODES_SETUP`` |
| 2173 |
* ``SECURITY_MSG_OAUTH_HANDSHAKE_ERROR`` |
| 2174 |
* ``SECURITY_MSG_PASSWORDLESS_LOGIN_SUCCESSFUL`` |
| 2175 |
* ``SECURITY_MSG_PASSWORD_BREACHED`` |
| 2176 |
* ``SECURITY_MSG_PASSWORD_BREACHED_SITE_ERROR`` |
| 2177 |
* ``SECURITY_MSG_PASSWORD_CHANGE`` |
| 2178 |
* ``SECURITY_MSG_PASSWORD_INVALID_LENGTH`` |
| 2179 |
* ``SECURITY_MSG_PASSWORD_IS_THE_SAME`` |
| 2180 |
* ``SECURITY_MSG_PASSWORD_MISMATCH`` |
| 2181 |
* ``SECURITY_MSG_PASSWORD_NOT_PROVIDED`` |
| 2182 |
* ``SECURITY_MSG_PASSWORD_REQUIRED`` |
| 2183 |
* ``SECURITY_MSG_PASSWORD_RESET`` |
| 2184 |
* ``SECURITY_MSG_PASSWORD_RESET_EXPIRED`` |
| 2185 |
* ``SECURITY_MSG_PASSWORD_RESET_NO_LOGIN`` |
| 2186 |
* ``SECURITY_MSG_PASSWORD_RESET_REQUEST`` |
| 2187 |
* ``SECURITY_MSG_PASSWORD_TOO_SIMPLE`` |
| 2188 |
* ``SECURITY_MSG_PHONE_INVALID`` |
| 2189 |
* ``SECURITY_MSG_REAUTHENTICATION_REQUIRED`` |
| 2190 |
* ``SECURITY_MSG_REAUTHENTICATION_SUCCESSFUL`` |
| 2191 |
* ``SECURITY_MSG_REFRESH`` |
| 2192 |
* ``SECURITY_MSG_RETYPE_PASSWORD_MISMATCH`` |
| 2193 |
* ``SECURITY_MSG_TWO_FACTOR_INVALID_TOKEN`` |
| 2194 |
* ``SECURITY_MSG_TWO_FACTOR_LOGIN_SUCCESSFUL`` |
| 2195 |
* ``SECURITY_MSG_TWO_FACTOR_CHANGE_METHOD_SUCCESSFUL`` |
| 2196 |
* ``SECURITY_MSG_TWO_FACTOR_PERMISSION_DENIED`` |
| 2197 |
* ``SECURITY_MSG_TWO_FACTOR_METHOD_NOT_AVAILABLE`` |
| 2198 |
* ``SECURITY_MSG_TWO_FACTOR_SETUP_EXPIRED`` |
| 2199 |
* ``SECURITY_MSG_TWO_FACTOR_DISABLED`` |
| 2200 |
* ``SECURITY_MSG_UNAUTHORIZED`` |
| 2201 |
* ``SECURITY_MSG_UNAUTHENTICATED`` |
| 2202 |
* ``SECURITY_MSG_US_METHOD_NOT_AVAILABLE`` |
| 2203 |
* ``SECURITY_MSG_US_SETUP_EXPIRED`` |
| 2204 |
* ``SECURITY_MSG_US_SETUP_SUCCESSFUL`` |
| 2205 |
* ``SECURITY_MSG_US_SPECIFY_IDENTITY`` |
| 2206 |
* ``SECURITY_MSG_USE_CODE`` |
| 2207 |
* ``SECURITY_MSG_USER_DOES_NOT_EXIST`` |
| 2208 |
* ``SECURITY_MSG_USERNAME_CHANGE`` |
| 2209 |
* ``SECURITY_MSG_USERNAME_INVALID_LENGTH`` |
| 2210 |
* ``SECURITY_MSG_USERNAME_ILLEGAL_CHARACTERS`` |
| 2211 |
* ``SECURITY_MSG_USERNAME_DISALLOWED_CHARACTERS`` |
| 2212 |
* ``SECURITY_MSG_USERNAME_NOT_PROVIDED`` |
| 2213 |
* ``SECURITY_MSG_USERNAME_ALREADY_ASSOCIATED`` |
| 2214 |
* ``SECURITY_MSG_USERNAME_RECOVERY_REQUEST`` |
| 2215 |
* ``SECURITY_MSG_WEBAUTHN_EXPIRED`` |
| 2216 |
* ``SECURITY_MSG_WEBAUTHN_NAME_REQUIRED`` |
| 2217 |
* ``SECURITY_MSG_WEBAUTHN_NAME_INUSE`` |
| 2218 |
* ``SECURITY_MSG_WEBAUTHN_NAME_NOT_FOUND`` |
| 2219 |
* ``SECURITY_MSG_WEBAUTHN_CREDENTIAL_DELETED`` |
| 2220 |
* ``SECURITY_MSG_WEBAUTHN_REGISTER_SUCCESSFUL`` |
| 2221 |
* ``SECURITY_MSG_WEBAUTHN_CREDENTIAL_ID_INUSE`` |
| 2222 |
* ``SECURITY_MSG_WEBAUTHN_UNKNOWN_CREDENTIAL_ID`` |
| 2223 |
* ``SECURITY_MSG_WEBAUTHN_ORPHAN_CREDENTIAL_ID`` |
| 2224 |
* ``SECURITY_MSG_WEBAUTHN_NO_VERIFY`` |
| 2225 |
* ``SECURITY_MSG_WEBAUTHN_CREDENTIAL_WRONG_USAGE`` |
| 2226 |
* ``SECURITY_MSG_WEBAUTHN_MISMATCH_USER_HANDLE`` |
| 2227 |
|
| 2228 |
.. _passlib's CryptoContext: https://passlib.readthedocs.io/en/stable/lib/passlib.context.html |