Expand description
Who the user is (M3.5; see archive/PROJECT.md, Authentication: as little as possible in schedr). The name is recorded on commands, never used to allow or deny anything; there are no roles.
- A caller proven to be
schedr uipasses the person’s name on inUSER_HEADER(decision 36): proven by its mTLS certificate on the webserver’s UI port (that listener marks its requestsProvenUi), by the token it presents inUI_TOKEN_HEADERwhere there is no mTLS (a mesh, a standalone), or by calling in-process (standalone’s own UI). Only so proven is the name taken; anyone else’sUSER_HEADERis ignored. - Anyone else, by the mode:
nonetakes the identity header’s value if there is one (elseanonymous);proxy_headerrequires the SSO proxy’s header;basicchecks HTTP Basic credentials against bcrypt hashes. A request refused is 401 (with a Basic challenge inbasicmode).
The same rules serve the UI’s own pages ([ui.auth]), with no UI in front of it.
Structs§
- Auth
- How a role tells who the user is.
- Auth
Timings - How the users and the UI’s token are followed.
- Followed
- A value read from a file, and read again when the file changes: the file is looked at at
most every
RECHECK(its modification time and length), and read again when they changed. A file that can’t be read or doesn’t parse leaves the value as it was (logged as an error: a mistake in the deployment), and is tried again at the next look. Or a fixed value. - Proven
Ui - A request from
schedr ui, proven by how it arrived (the UI port’s mTLS, or in-process): a request extension, which no client can set. - User
- Who a request is from (a request extension, set by
Auth::user’s middleware). - Users
- Users of
basicmode: names and their bcrypt hashes.
Enums§
- Refused
- Why a request is refused.
Constants§
- ANONYMOUS
- The name recorded when no one is named.
- DEFAULT_
PROXY_ HEADER - The header an SSO proxy names the user in, when
identity_headerisn’t set. - MAX_
NAME - The longest name taken (a longer one is refused, not cut).
- MIN_
UI_ TOKEN - The shortest token taken.
- RECHECK
- How often a followed file is looked at for a change, at most.
- REMEMBERED
- How long a check that passed is remembered.
- UI_
TOKEN_ HEADER - The header
schedr uipresents its token in, where there is no mTLS. - USER_
HEADER - The header
schedr uinames the person in (taken only from a proven UI).
Functions§
- basic_
credentials - The user name and password of an
Authorization: Basicheader. - browser_
same_ origin - Whether a browser says a request comes from the page’s own origin:
Sec-Fetch-Site(same-origin, ornone: typed by the user), else anOriginwhose host is the request’s (X-Forwarded-Hostbehind a proxy; default ports aside).Nonewhen neither header is there: not a browser’s request (a CLI,schedr ui), or an old browser’s GET. - is_open
- Whether a request for
pathis open to anyone: the API’s description and Swagger UI (they show what the API is, nothing of its data; decision 2.11a). - read_
ui_ token - The UI’s token in the file at
path, followed (its text, trimmed). - refuse_
cross_ site - The webserver’s middleware refusing (403) a write a browser sends from another site: a
browser attaches Basic credentials it remembers, or a proxy’s cookie, to any site’s form,
so a page elsewhere could act as the person signed in. Requests no browser header marks
(the CLI,
schedr ui) pass. - require
- The webserver’s middleware: the request’s
Userset, or a 401.
Type Aliases§
- UiToken
- The token a UI presents (
[webserver] ui_token_file,[[ui.deployments]] token_file), followed: a new token takes effect without a restart.