Skip to main content Module oauth Copy item path Source use std::collections::HashMap ; π use std::net::IpAddr ; π use std::sync::Arc ; π use std::sync::Mutex ; π use std::time::Instant ; π use base64::Engine as _; π use base64::engine::general_purpose::URL_SAFE_NO_PAD as b64encode; π use futures::Stream; π use futures::StreamExt; π use futures::TryStreamExt; π use http::StatusCode; π use reqwest::Method; π use reqwest::header::ACCEPT; π use reqwest::header::CONTENT_TYPE; π use ruma::UserId; π use ruma::api::error::ErrorKind; π use ruma::api::error::LimitExceededErrorData; π use serde::Serialize ; π use serde::Serialize ; π use serde_json::Value as JsonValue; π use tuwunel_core::Err ; π use tuwunel_core::Error ; π use tuwunel_core::Result ; π use tuwunel_core::err ; π use tuwunel_core::implement; π use tuwunel_core::smallstr::SmallString; π use tuwunel_core::utils::hash::sha256 ; π use tuwunel_core::utils::result::LogErr ; π use tuwunel_core::utils::result::NotFound ; π use tuwunel_core::utils::stream::ReadyExt ; π use tuwunel_core::utils::stream::TryReadyExt ; π use tuwunel_core::utils::string::truncate_deterministic ; π use tuwunel_core::warn ; π use url::Url ; π use self::providers::Providers ; π use self::sessions::Sessions ; π pub use self::providers::ProviderId ;pub use self::server::Server ;pub use self::sessions::CODE_VERIFIER_LENGTH ;pub use self::sessions::Deleted ;pub use self::sessions::Deletions ;pub use self::sessions::SESSION_ID_LENGTH ;pub use self::sessions::Session ;pub use self::sessions::SessionId ;pub use self::token_response::TokenResponse ;pub use self::user_info::UserInfo ;use crate::SelfServices ; π use crate::client::read_response_capped ; π providers server sessions token_response user_info Provider Upstream identity providers (SSO) Service DEVICE_RC_BURST π Generous allowance for the one code a real user enters. DEVICE_RC_PER_SECOND π Always-on throttle for the RFC 8628 device user-code endpoints. The
user_code is low-entropy by design (Β§6.1), so Β§5.1 requires bounding
guesses regardless of the optional oidc_rc_* knobs; the burst stays
generous for the one code a real user enters. RATELIMIT_MAP_CAP π Cap on the rate-limit table; fully refilled buckets are pruned past it. check_bucket π check_bucket_at π fallback_localpart Derive the fallback localpart of an identity from its unique-id string. identity_issuer π Issuer string used as input to the identity hash. Pinned per-brand for
providers whose published issuer has changed under us, so existing account
associations survive the change. unique_id Generate a unique-id string determined by the combination of Provider and
Session instances. unique_id_iss Generate a unique-id string determined by the combination of issuer_url
and Session instance. unique_id_iss_parts π unique_id_iss_sub Generate a unique-id string determined by the issuer_url and the sub
strings directly. unique_id_parts π unique_id_sub Generate a unique-id string determined by the combination of Provider
instance and sub string. unique_id_sub_parts π Localpart Fallback localpart derived from an identityβs unique-id string. Ratelimiter π Per-client-IP token-bucket table: last-refill instant and remaining tokens.