Skip to main content

AuthConfig

Struct AuthConfig 

Source
pub struct AuthConfig {
Show 28 fields pub mode: AuthMode, pub public_url: Option<Url>, pub sqlite_path: PathBuf, pub key_path: PathBuf, pub bootstrap_secret: Option<String>, pub allowed_client_redirect_uris: Vec<String>, pub admin_email: String, pub google: GoogleConfig, pub authelia: AutheliaConfig, pub github: GitHubConfig, pub default_provider: String, pub access_token_ttl: Duration, pub refresh_token_ttl: Duration, pub auth_code_ttl: Duration, pub register_requests_per_minute: u32, pub authorize_requests_per_minute: u32, pub max_pending_oauth_states: usize, pub env_prefix: String, pub default_data_dir: PathBuf, pub session_cookie_name: String, pub scopes_supported: Vec<String>, pub resource_path: String, pub default_scope: String, pub static_token_scopes: Vec<String>, pub login_path: String, pub enable_dynamic_registration: bool, pub disable_static_token_with_oauth: bool, pub token_encryption_key: Option<TokenEncryptionKey>,
}

Fields§

§mode: AuthMode§public_url: Option<Url>§sqlite_path: PathBuf§key_path: PathBuf§bootstrap_secret: Option<String>§allowed_client_redirect_uris: Vec<String>§admin_email: String

Single bootstrap admin email permitted to log in through any configured OAuth/OIDC provider. Required when mode == AuthMode::OAuth. Additional users are granted through the SQLite-backed allowlist managed via the web UI.

§google: GoogleConfig§authelia: AutheliaConfig§github: GitHubConfig§default_provider: String

Which configured provider /authorize and /auth/login use when the request omits ?provider=. Must name a provider that is actually configured (validated in AuthConfig::validate). Resolved automatically when unset: google > authelia > github, in that priority order, picking the first one that has credentials — this is what makes every existing single-provider (Google-only) deployment keep working with zero config changes after upgrading.

§access_token_ttl: Duration§refresh_token_ttl: Duration§auth_code_ttl: Duration§register_requests_per_minute: u32§authorize_requests_per_minute: u32§max_pending_oauth_states: usize§env_prefix: String

Env var prefix used for diagnostics (e.g. "LAB", "SYSLOG_MCP"). Set via AuthConfigBuilder::env_prefix BEFORE any env reads.

§default_data_dir: PathBuf

Default base directory for auth.db and auth-jwt.pem when the corresponding env vars are unset.

§session_cookie_name: String

Browser session cookie name. Lab consumer leaves this at the default ("lab_session"); other consumers override with their own brand.

§scopes_supported: Vec<String>

Scopes advertised on /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource.

§resource_path: String

Path appended to public_url to form the canonical resource URL returned in the protected-resource metadata document.

§default_scope: String

Default scope applied when /authorize requests omit one and the only scope accepted by the legacy single-scope validator.

§static_token_scopes: Vec<String>

Scopes minted into the static-bearer-derived AuthContext so legacy admin tools keep functioning when the dual-mode middleware (L2) is deployed. Lab keeps the legacy ["lab:read","lab:admin"] defaults; cortex will override with ["syslog:read","syslog:admin"].

§login_path: String

Path of the browser login route (typically /auth/login).

§enable_dynamic_registration: bool

Whether POST /register (RFC 7591 dynamic client registration) is mounted. Defaults to false (closed) — opt-in per consumer.

§disable_static_token_with_oauth: bool

When true, dual-mode middleware MUST reject the static bearer token whenever OAuth is active. Defaults to false (lab keeps the historical break-glass behavior); cortex overrides to true.

§token_encryption_key: Option<TokenEncryptionKey>

Optional at-rest encryption key for upstream provider refresh tokens.

When present, provider refresh tokens are encrypted with ChaCha20-Poly1305 before being written to SQLite. Set via {PREFIX}_TOKEN_ENCRYPTION_KEY (64 hex digits or 43 base64url chars). When absent, tokens are stored as plaintext (backward-compatible).

Implementations§

Source§

impl AuthConfig

Source

pub fn from_sources( vars: impl IntoIterator<Item = (String, String)>, ) -> Result<Self, AuthError>

Backward-compatible convenience: read env vars using the default LAB prefix. Equivalent to AuthConfigBuilder::new().build_from_sources(vars).

Trait Implementations§

Source§

impl Clone for AuthConfig

Source§

fn clone(&self) -> AuthConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AuthConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AuthConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for AuthConfig

Source§

fn eq(&self, other: &AuthConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for AuthConfig

Source§

impl StructuralPartialEq for AuthConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,