ferrohealth-session 0.2.2

The OpenID Connect sign-in and the session of the FerroHEALTH operator consoles: the authorization code flow with PKCE over ferrohealth-smart, a server-side or sealed-cookie session with idle and absolute lifetimes counted from the sign-in time, and the session-watch route
Documentation
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-License-Identifier: BUSL-1.1

//! The four routes every console serves for its sign-in, the same on every
//! console so one provider registration reads alike across the family.

/// `GET`: begins a sign-in, with the page to come back to in [`RETURN`].
pub const LOGIN: &str = "/login";

/// `GET`: the redirection endpoint the provider sends the operator back to
/// (RFC 6749 ยง3.1.2); the console's `redirect_uri` ends in it.
pub const CALLBACK: &str = "/auth/callback";

/// `POST`: ends the session and signs the operator out at the provider.
pub const LOGOUT: &str = "/logout";

/// `GET` and `POST`: the session watch FerroUI's `session` script asks.
pub const SESSION: &str = "/session";

/// The query parameter of [`LOGIN`] that names the page to return to.
pub const RETURN: &str = "return";

/// Whether `path` is one of the four routes.
#[must_use]
pub fn is_own(path: &str) -> bool {
    let path = path.trim_end_matches('/');
    [LOGIN, CALLBACK, LOGOUT, SESSION].contains(&path)
}