Skip to main content

AuthContext

Struct AuthContext 

Source
pub struct AuthContext {
Show 22 fields pub app_name: String, pub base_url: String, pub base_path: String, pub options: RustAuthOptions, pub auth_cookies: AuthCookies, pub session_config: SessionConfig, pub secret: String, pub secret_config: SecretMaterial, pub password: PasswordContext, pub rate_limit: RateLimitContext, pub trusted_origins: Vec<String>, pub disabled_paths: Vec<String>, pub plugins: Vec<AuthPlugin>, pub adapter: Option<Arc<dyn DbAdapter>>, pub secondary_storage: Option<Arc<dyn SecondaryStorage>>, pub background_tasks: Option<Arc<dyn BackgroundTaskRunner>>, pub db_schema: DbSchema, pub plugin_error_codes: BTreeMap<String, PluginErrorCode>, pub plugin_database_hooks: Vec<PluginDatabaseHook>, pub plugin_migrations: Vec<PluginMigration>, pub telemetry_publisher: ContextTelemetryPublisher, pub logger: Logger,
}

Fields§

§app_name: String§base_url: String§base_path: String§options: RustAuthOptions§auth_cookies: AuthCookies§session_config: SessionConfig§secret: String§secret_config: SecretMaterial§password: PasswordContext§rate_limit: RateLimitContext§trusted_origins: Vec<String>§disabled_paths: Vec<String>§plugins: Vec<AuthPlugin>§adapter: Option<Arc<dyn DbAdapter>>§secondary_storage: Option<Arc<dyn SecondaryStorage>>§background_tasks: Option<Arc<dyn BackgroundTaskRunner>>§db_schema: DbSchema§plugin_error_codes: BTreeMap<String, PluginErrorCode>§plugin_database_hooks: Vec<PluginDatabaseHook>§plugin_migrations: Vec<PluginMigration>§telemetry_publisher: ContextTelemetryPublisher§logger: Logger

Implementations§

Source§

impl AuthContext

Source

pub fn db_schema(&self) -> &DbSchema

Source

pub fn schema(&self) -> AuthSchema<'_>

Schema-aware query helpers using logical table and field names.

Source

pub fn adapter(&self) -> Option<Arc<dyn DbAdapter>>

Source

pub fn require_adapter(&self) -> Result<Arc<dyn DbAdapter>, RustAuthError>

Returns the configured database adapter or a configuration error.

Source

pub fn adapter_ref(&self) -> Result<&dyn DbAdapter, RustAuthError>

Borrows the configured database adapter for the lifetime of this context.

Source

pub fn users(&self) -> Result<DbUserStore<'_>, RustAuthError>

Schema-aware user store using this context’s adapter and table mapping.

Source

pub fn sessions(&self) -> Result<SessionStore<'_>, RustAuthError>

Session store using this context’s adapter, schema, and session options.

Source

pub fn verifications(&self) -> Result<VerificationStore<'_>, RustAuthError>

Verification store (database and/or secondary storage per auth options).

Prefer this in handlers and plugins. It routes reads and writes through configured secondary storage when present.

Source

pub fn session_store(&self) -> Result<DbSessionStore<'_>, RustAuthError>

Schema-aware session database store (direct adapter access only).

Source

pub fn verification_store( &self, ) -> Result<DbVerificationStore<'_>, RustAuthError>

Schema-aware verification database store (direct adapter access only).

Use Self::verifications unless you need database-only helpers such as compare-and-update on the verification row.

Build a plugin auth cookie definition that inherits the core cookie naming and attribute policy (cookie_prefix, secure-name prefix, cross-subdomain domain, and default_cookie_attributes), exactly as the core session cookies produced by get_cookies.

Source

pub fn secondary_storage(&self) -> Option<Arc<dyn SecondaryStorage>>

Source

pub fn run_background_task(&self, task: BackgroundTaskFuture) -> bool

Source

pub async fn publish_telemetry(&self, event: ContextTelemetryEvent)

Source

pub fn has_plugin(&self, id: &str) -> bool

Source

pub fn plugin(&self, id: &str) -> Option<&AuthPlugin>

Source

pub fn is_trusted_origin( &self, url: &str, settings: Option<OriginMatchSettings>, ) -> bool

Source

pub fn trusted_origins_for_request( &self, request: Option<&Request<Vec<u8>>>, ) -> Result<Vec<String>, RustAuthError>

Source

pub fn trusted_providers_for_request( &self, request: Option<&Request<Vec<u8>>>, ) -> Result<Vec<String>, RustAuthError>

Source

pub fn is_trusted_origin_for_request( &self, url: &str, settings: Option<OriginMatchSettings>, request: Option<&Request<Vec<u8>>>, ) -> Result<bool, RustAuthError>

Trait Implementations§

Source§

impl Clone for AuthContext

Source§

fn clone(&self) -> AuthContext

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V