Skip to content

core.reauthentication ​

Overview ​

Reauthentication policy: which flow a user must complete, and whether their session completed it recently.

did_recently_authenticate ​

Return whether the session holds an authentication record for the user's required flow that is newer than ACCOUNT_REAUTHENTICATION_TIMEOUT.

Login and reauthentication both write records, so a fresh login satisfies the check as well as a reauthentication does. Only records of the required method count: confirming the password does not refresh the session of a user who must confirm a second factor.

Signature ​

did_recently_authenticate(request)

Parameters ​

NameTypeRequiredDefaultDescription
requestyes

Source ​

server/vueda/core/reauthentication.py:38

required_flow ​

Return the allauth Flow the user must complete to count as recently authenticated.

A user with an MFA authenticator confirms a second factor (Flow.MFA_REAUTHENTICATE). A user with only a usable password confirms the password (Flow.REAUTHENTICATE). A user with neither has nothing to confirm, so the result is None and the session always counts as recent.

Signature ​

required_flow(user)

Parameters ​

NameTypeRequiredDefaultDescription
useryes

Source ​

server/vueda/core/reauthentication.py:21

RECORD_METHOD_BY_FLOW ​

The method allauth writes into a session authentication record when each flow completes.

Source ​

server/vueda/core/reauthentication.py