Skip to main content

Internal

Struct Internal 

Source
pub struct Internal<'a, D, A> { /* private fields */ }

Implementations§

Source§

impl<'a, D: Adapter, A> Internal<'a, D, A>

Source

pub async fn find_user_by_email( &self, email: &str, ) -> Result<Option<UserView>, AuthError>

Source

pub async fn find_user_by_id( &self, id: &Id, ) -> Result<Option<UserView>, AuthError>

Source

pub async fn create_user( &self, user: NewUser, account: Option<NewAccount>, ) -> Result<UserView, AuthError>

Creates a user (and optionally its first account) in one transaction. Answers USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL (422) when the email is taken.

Source

pub async fn find_account( &self, provider_id: &str, account_id: &str, ) -> Result<Option<Account>, AuthError>

Source

pub async fn credential_account( &self, user_id: &Id, ) -> Result<Option<Account>, AuthError>

Source

pub fn validate_new_password(&self, password: &str) -> Result<(), AuthError>

Checks a new password against the configured length limits and policy.

Source

pub async fn set_password( &self, user_id: &Id, password: &str, ) -> Result<(), AuthError>

Validates, hashes and stores a password, creating the credential account if needed.

Source

pub async fn create_session( &self, user_id: &Id, remember_me: bool, ) -> Result<SessionView, AuthError>

Creates a session and sets its cookies. Skips sign-in gates; use sign_in for a sign-in, and this to finish one after a challenge.

Source

pub async fn sign_in( &self, user: UserView, method: &'static str, remember_me: bool, ) -> Result<SignInResult, AuthError>

Runs every sign-in gate, then creates the session.

Source

pub async fn revoke_session( &self, user_id: &Id, session_id: &Id, ) -> Result<bool, AuthError>

Source

pub async fn revoke_user_sessions( &self, user_id: &Id, keep: Option<&Id>, ) -> Result<u64, AuthError>

Deletes every session of a user, except keep when given.

Source

pub fn clear_session_cookies(&self)

Source

pub async fn create_verification( &self, identifier: &str, ttl: Duration, data: Option<String>, ) -> Result<String, AuthError>

Stores a single-use value and returns it. Only its hash is kept.

Source

pub async fn store_verification_value( &self, identifier: &str, value: &str, ttl: Duration, data: Option<String>, ) -> Result<(), AuthError>

Stores a caller-chosen value (e.g. a 6-digit OTP) under identifier, replacing older ones.

Source

pub async fn consume_verification_value( &self, identifier: &str, value: &str, ) -> Result<Option<Verification>, AuthError>

Consumes a value stored with store_verification_value.

Source

pub async fn find_verification( &self, token: &str, ) -> Result<Option<Verification>, AuthError>

The unexpired verification for token, without consuming it.

Source

pub async fn consume_verification( &self, token: &str, ) -> Result<Option<Verification>, AuthError>

Finds and deletes the verification for token. None if unknown or expired.

Source

pub fn can_send_email(&self) -> bool

Whether a mailer is configured, so send_email can succeed.

Source

pub async fn send_email(&self, email: AuthEmail) -> Result<(), AuthError>

Source

pub async fn send_verification_email( &self, user: &UserView, callback_url: Option<&str>, ) -> Result<(), AuthError>

Auto Trait Implementations§

§

impl<'a, D, A> !RefUnwindSafe for Internal<'a, D, A>

§

impl<'a, D, A> !UnwindSafe for Internal<'a, D, A>

§

impl<'a, D, A> Forget for Internal<'a, D, A>

§

impl<'a, D, A> Freeze for Internal<'a, D, A>
where &'a Ctx<D, A>: Freeze,

§

impl<'a, D, A> Move for Internal<'a, D, A>

§

impl<'a, D, A> Send for Internal<'a, D, A>
where &'a Ctx<D, A>: Send,

§

impl<'a, D, A> Sync for Internal<'a, D, A>
where &'a Ctx<D, A>: Sync,

§

impl<'a, D, A> Unpin for Internal<'a, D, A>
where &'a Ctx<D, A>: Unpin,

§

impl<'a, D, A> UnsafeUnpin for Internal<'a, D, A>
where &'a Ctx<D, A>: UnsafeUnpin,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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