pub struct Internal<'a, D, A> { /* private fields */ }Implementations§
Source§impl<'a, D: Adapter, A> Internal<'a, D, A>
impl<'a, D: Adapter, A> Internal<'a, D, A>
pub async fn find_user_by_email( &self, email: &str, ) -> Result<Option<UserView>, AuthError>
pub async fn find_user_by_id( &self, id: &Id, ) -> Result<Option<UserView>, AuthError>
Sourcepub async fn create_user(
&self,
user: NewUser,
account: Option<NewAccount>,
) -> Result<UserView, AuthError>
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.
pub async fn link_account( &self, user_id: &Id, account: NewAccount, ) -> Result<Account, AuthError>
pub async fn find_account( &self, provider_id: &str, account_id: &str, ) -> Result<Option<Account>, AuthError>
pub async fn credential_account( &self, user_id: &Id, ) -> Result<Option<Account>, AuthError>
Sourcepub fn validate_new_password(&self, password: &str) -> Result<(), AuthError>
pub fn validate_new_password(&self, password: &str) -> Result<(), AuthError>
Checks a new password against the configured length limits and policy.
Sourcepub async fn set_password(
&self,
user_id: &Id,
password: &str,
) -> Result<(), AuthError>
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.
Sourcepub async fn create_session(
&self,
user_id: &Id,
remember_me: bool,
) -> Result<SessionView, AuthError>
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.
Sourcepub async fn sign_in(
&self,
user: UserView,
method: &'static str,
remember_me: bool,
) -> Result<SignInResult, AuthError>
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.
pub async fn revoke_session( &self, user_id: &Id, session_id: &Id, ) -> Result<bool, AuthError>
Sourcepub async fn revoke_user_sessions(
&self,
user_id: &Id,
keep: Option<&Id>,
) -> Result<u64, AuthError>
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.
Sourcepub async fn create_verification(
&self,
identifier: &str,
ttl: Duration,
data: Option<String>,
) -> Result<String, AuthError>
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.
Sourcepub async fn store_verification_value(
&self,
identifier: &str,
value: &str,
ttl: Duration,
data: Option<String>,
) -> Result<(), AuthError>
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.
Sourcepub async fn consume_verification_value(
&self,
identifier: &str,
value: &str,
) -> Result<Option<Verification>, AuthError>
pub async fn consume_verification_value( &self, identifier: &str, value: &str, ) -> Result<Option<Verification>, AuthError>
Consumes a value stored with store_verification_value.
Sourcepub async fn find_verification(
&self,
token: &str,
) -> Result<Option<Verification>, AuthError>
pub async fn find_verification( &self, token: &str, ) -> Result<Option<Verification>, AuthError>
The unexpired verification for token, without consuming it.
Sourcepub async fn consume_verification(
&self,
token: &str,
) -> Result<Option<Verification>, AuthError>
pub async fn consume_verification( &self, token: &str, ) -> Result<Option<Verification>, AuthError>
Finds and deletes the verification for token. None if unknown or expired.
Sourcepub fn can_send_email(&self) -> bool
pub fn can_send_email(&self) -> bool
Whether a mailer is configured, so send_email can succeed.