pub struct PasswordlessService { /* private fields */ }Expand description
Orchestrates the passwordless flows. link_base is the front-end URL the
magic-link token is appended to (e.g. https://app.example.com/auth/magic).
Implementations§
Source§impl PasswordlessService
impl PasswordlessService
pub fn new( users: Arc<dyn UserStore>, ott: Arc<OneTimeTokenService>, notifier: Arc<dyn Notifier>, identity: IdentityService, link_base: impl Into<String>, ) -> Self
Sourcepub fn with_send_limit(
self,
backend: Arc<dyn RateLimitBackend>,
max: u32,
window_secs: u32,
) -> Self
pub fn with_send_limit( self, backend: Arc<dyn RateLimitBackend>, max: u32, window_secs: u32, ) -> Self
Enable per-destination send throttling: at most max sends per
window_secs for any one address (fail-closed). Reuses the framework’s
distributed rate-limit backend.
Sourcepub async fn start_magic_link(
&self,
tenant: Option<&str>,
email: &str,
) -> Result<()>
pub async fn start_magic_link( &self, tenant: Option<&str>, email: &str, ) -> Result<()>
Start a magic-link login: issue a token and email it as a link. Always
returns Ok(()) even when the email is unknown, so the response cannot
enumerate accounts.
Sourcepub async fn complete_magic_link(&self, token: &str) -> Result<TokenResponse>
pub async fn complete_magic_link(&self, token: &str) -> Result<TokenResponse>
Redeem a magic-link token → issue tokens.
Sourcepub async fn start_otp(
&self,
tenant: Option<&str>,
destination: &str,
channel: Channel,
) -> Result<()>
pub async fn start_otp( &self, tenant: Option<&str>, destination: &str, channel: Channel, ) -> Result<()>
Start OTP login: send a numeric code over channel. Enumeration-safe.
Sourcepub async fn complete_otp(&self, code: &str) -> Result<TokenResponse>
pub async fn complete_otp(&self, code: &str) -> Result<TokenResponse>
Complete OTP login → issue tokens.
Auto Trait Implementations§
impl !RefUnwindSafe for PasswordlessService
impl !UnwindSafe for PasswordlessService
impl Freeze for PasswordlessService
impl Send for PasswordlessService
impl Sync for PasswordlessService
impl Unpin for PasswordlessService
impl UnsafeUnpin for PasswordlessService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request