pub trait AuthBackend:
Send
+ Sync
+ 'static {
// Required methods
fn providers(&self) -> Vec<Provider>;
fn login<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: Option<&'life1 AuthContext>,
flow: LoginFlow,
) -> Pin<Box<dyn Future<Output = Result<LoginAnswer, AuthFailure>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn signup<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: Option<&'life1 AuthContext>,
via: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SignupAnswer, AuthFailure>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn ask_access<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
via: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Waiting, AuthFailure>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn waiting(&self) -> Vec<Waiting>;
fn logout<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthFailure>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn alive(&self, caller: &AuthContext) -> Result<(), String>;
}Expand description
What only the service knows about signing in. Async: a backend may talk
to its identity provider. (The gate’s own questions — Memberships,
Roles, Resolve — stay synchronous and from memory.)
Required Methods§
Sourcefn login<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: Option<&'life1 AuthContext>,
flow: LoginFlow,
) -> Pin<Box<dyn Future<Output = Result<LoginAnswer, AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn login<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: Option<&'life1 AuthContext>,
flow: LoginFlow,
) -> Pin<Box<dyn Future<Output = Result<LoginAnswer, AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sign in by flow (auth.login). caller is the connection’s
identity, if any: a LoginFlow::Session needs one (a key proof at
the upgrade, or a session) and must not widen it — the new
session’s ceiling lies within the caller’s (layer it). The browser
flow’s start and finish, the code’s single use and expiry, and the
session’s minting are the backend’s.
Sourcefn signup<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: Option<&'life1 AuthContext>,
via: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SignupAnswer, AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn signup<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: Option<&'life1 AuthContext>,
via: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<SignupAnswer, AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
auth.signup where the activation’s own rule does not decide it:
an anonymous caller (create an account — or refuse: sign in first),
or one who already holds a membership. (A signed-in caller holding
none is put on the waiting list by AuthBackend::ask_access.)
Sourcefn ask_access<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
via: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Waiting, AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ask_access<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
via: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<Waiting, AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Put a signed-in caller who holds no membership on the waiting list
(asking again keeps the first since).
Sourcefn waiting(&self) -> Vec<Waiting>
fn waiting(&self) -> Vec<Waiting>
Everyone who has asked for access. The activation shows an admin only those still holding no membership.
Sourcefn logout<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn logout<'life0, 'life1, 'async_trait>(
&'life0 self,
caller: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = Result<(), AuthFailure>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
End the caller’s session (auth.logout). A connection with no
session to end (a bare key proof) is not an error.
Sourcefn alive(&self, caller: &AuthContext) -> Result<(), String>
fn alive(&self, caller: &AuthContext) -> Result<(), String>
AUTH-11: whether a signed-in caller’s sign-in still stands — its
session not signed out, revoked or expired. The gate asks it before
every call it decides (auth.* included), so a sign-in that ended
holds nothing from its next call on. Err: why not, in words for
the caller. Memory only: it is asked on every call. (The gate
refuses a caller past its expires_at stamp before asking.)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".