4.5 KiB
aurweb Web Authentication
aurweb uses an HTTP cookie to persist user sessions across requests. This cookie must be delivered with a request in order to be considered an authenticated user.
See HTTP Cookie for detailed information about the cookie.
HTTP Cookie
aurweb utilizes an HTTP cookie by the name of AURSID
to track
user authentication across requests.
This cookie's requirements changes due to aurweb's configuration in the following ways:
options.disable_http_login: 0
- Samesite=LAX, Max-Age
options.disable_http_login: 1
- Samesite=LAX, Secure, HttpOnly, Max-Age
Max-Age
The value used for the AURSID
Max-Age attribute is decided based
off of the "Remember Me" checkbox on the login page. Both paths
use their own independent configuration for the number of seconds
that each type of session should stay alive.
- "Remember Me" unchecked while logging in
options.login_timeout
is used
- "Remember Me" checked while logging in
options.persistent_cookie_timeout
is used
Both options.login_timeout
and options.persistent_cookie_timeout
indicate the number of seconds the session should live.
Notes
At all times, aur.archlinux.org operates over HTTPS. Secure cookies will only remain intact when subsequently requesting an aurweb route through the HTTPS scheme at the same host as the cookie was obtained.
Login Process
When a user logs in to aurweb, the following steps are taken:
- Was a Referer header delivered from an address starting with
{aurweb_url}/login
?- No, an HTTP 400 Bad Request response is returned
- Yes, move on to 2
- Does a Users database record exist for the given username/email?
- No, you are returned to the login page with
Bad username or password.
error - Yes, move on to 3
- No, you are returned to the login page with
- Is the user suspended?
- Yes, you are returned to the login page with
Account Suspended
error - No, move on to 4
- Yes, you are returned to the login page with
- Can the user login with the given password?
- No, you are returned to the login page with
Bad username or password.
error - Yes, move on to 5
- No, you are returned to the login page with
- Update the user's
LastLogin
andLastLoginIPAddress
columns - Does the user have a related Sessions record?
- No, generate a new Sessions record with a new unique
SessionID
- Yes, update the Sessions record's
SessionID
column with a new unique string and update the Sessions record'sLastUpdateTS
column if it has expired - In both cases, set the user's
InactivityTS
column to0
- In both cases, return the new
SessionID
column value and move on to 7
- No, generate a new Sessions record with a new unique
- Return a redirect to the
next
GET variable with the following cookies set:AURSID
- Unique session string matching the user's related
Sessions.SessionID
column
- Unique session string matching the user's related
AURTZ
- User's timezone setting
AURLANG
- User's language setting
AURREMEMBER
- Boolean state of the "Remember Me" checkbox when login submitted
Auth Verification
When a request is made toward aurweb, a middleware is responsible for
verifying the user's auth cookie. If no valid AURSID
cookie could be
found for a user in the database, the request is considered unauthenticated.
The following list of steps describes exactly how this verification works:
- Was the
AURSID
cookie delivered?- No, the algorithm ends, you are considered unauthenticated
- Yes, move on to 2
- Was the
AURREMEMBER
cookie delivered with a value of 1?- No, set the expected session timeout T to
options.login_timeout
- Yes, set the expected session timeout T to
options.persistent_cookie_timeout
- No, set the expected session timeout T to
- Does a Sessions database record exist which matches the
AURSID
?- No, the algorithm ends, you are considered unauthenticated
- Yes, move on to 4
- Does the Sessions record's LastUpdateTS column fit within
utcnow - T
?- No, the Sessions record at hand is deleted, the algorithm ends, you are considered unauthenticated
- Yes, move on to 5
- You are considered authenticated
aur.archlinux.org Auth-Related Configuration
- Operates over HTTPS with a Let's Encrypt SSL certificate
options.disable_http_login: 1
options.login_timeout: <default_provided_in_config.defaults>
options.persistent_cookie_timeout: <default_provided_in_config.defaults>