Skip to main content

AuthConfig

Struct AuthConfig 

Source
pub struct AuthConfig {
Show 13 fields pub enabled: bool, pub issuer: String, pub audience: String, pub read_scopes: Vec<String>, pub reload_scopes: Vec<String>, pub anonymous_read: bool, pub start_degraded: bool, pub algorithms: Vec<String>, pub leeway_secs: u64, pub jwks_refresh_secs: u64, pub tenant_claim: String, pub allowed_tenants: Vec<String>, pub admin_token_fallback: bool,
}
Expand description

OIDC bearer-token enforcement for the HTTP API ([auth] block).

Disabled by default. When enabled = true, the server validates every request’s Authorization: Bearer … JWT against the JWKS discovered from the issuer’s OIDC metadata (<issuer>/.well-known/openid-configurationjwks_uri), then enforces the configured scope requirements per route.

Only compiled in when the binary was built with the auth cargo feature. Without the feature, enabled = true is rejected at startup so a misconfigured production deployment can’t silently fall back to “no auth”.

The Swagger UI’s SSO support ([swagger.oauth2]) is independent of this block — [swagger.oauth2] only drives the UI’s login dialog; [auth] is what enforces tokens on the API.

Fields§

§enabled: bool

Master switch. false (default) skips all auth processing.

§issuer: String

OIDC issuer URL — must match the iss claim of every accepted token. Required when enabled = true.

§audience: String

Expected aud claim. When empty, audience validation is skipped (not recommended in production).

§read_scopes: Vec<String>

Scopes a caller must hold to read datasets (GET endpoints + POST …/query and …/count). Empty list means “no scope check, just a valid token is enough”.

§reload_scopes: Vec<String>

Scopes required for admin/mutation endpoints (POST …/reload). Empty list means “no scope check, just a valid token is enough”.

§anonymous_read: bool

Allow unauthenticated GETs through. Useful for public datasets and demo deployments. Defaults to false.

§start_degraded: bool

Continue serving even if the JWKS fetch fails at startup. When true (default), the server starts in a degraded mode that rejects every auth’d request with 503 until JWKS becomes reachable. When false, startup fails outright.

§algorithms: Vec<String>

Allowed signing algorithms. Pinned to RS256 by default; never include HS* or none here unless you really know what you’re doing.

§leeway_secs: u64

Clock-skew leeway for exp/nbf checks, in seconds.

§jwks_refresh_secs: u64

How often (in seconds) the background refresher re-fetches the JWKS. On a kid cache miss the JWKS is also refreshed out-of-band.

§tenant_claim: String

Optional JSON-pointer into the JWT claims that extracts a tenant identifier — attached to the principal and logged on every request. Example: "/tid" (Azure AD), "/org_id". When empty, no tenant is extracted.

§allowed_tenants: Vec<String>

If non-empty, requests whose extracted tenant ID is not in this list are rejected with 403. Has no effect when tenant_claim is empty.

§admin_token_fallback: bool

If true, POST …/reload accepts either a valid token with reload_scopes or the legacy X-Admin-Token header. Defaults to true for one-release backwards compatibility — flip to false once your automation has migrated to OIDC.

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<'de> Deserialize<'de> for AuthConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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.

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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