Skip to main content

Module oauth

Module oauth 

Source

Re-exportsΒ§

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; πŸ”’

ModulesΒ§

providers
server
sessions
token_response
user_info

StructsΒ§

Provider
Upstream identity providers (SSO)
Service

ConstantsΒ§

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.

FunctionsΒ§

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 πŸ”’

Type AliasesΒ§

Localpart
Fallback localpart derived from an identity’s unique-id string.
Ratelimiter πŸ”’
Per-client-IP token-bucket table: last-refill instant and remaining tokens.