pub trait MfaService:
Send
+ Sync
+ 'static {
Show 15 methods
// Required methods
fn list_mfa_factors<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ListMFAFactorsRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ListMFAFactorsResponse> + Send + use<'a, Self>>> + Send;
fn begin_totp_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, BeginTOTPEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<BeginTOTPEnrollmentResponse> + Send + use<'a, Self>>> + Send;
fn finish_totp_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, FinishTOTPEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<FinishTOTPEnrollmentResponse> + Send + use<'a, Self>>> + Send;
fn begin_passkey_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, BeginPasskeyEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<BeginPasskeyEnrollmentResponse> + Send + use<'a, Self>>> + Send;
fn finish_passkey_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, FinishPasskeyEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<FinishPasskeyEnrollmentResponse> + Send + use<'a, Self>>> + Send;
fn begin_mfa_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, BeginMFAChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<BeginMFAChallengeResponse> + Send + use<'a, Self>>> + Send;
fn verify_totp_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, VerifyTOTPChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send;
fn finish_passkey_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, FinishPasskeyChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send;
fn verify_recovery_code_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, VerifyRecoveryCodeChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send;
fn update_mfa_factor<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UpdateMFAFactorRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UpdateMFAFactorResponse> + Send + use<'a, Self>>> + Send;
fn delete_mfa_factor<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, DeleteMFAFactorRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<DeleteMFAFactorResponse> + Send + use<'a, Self>>> + Send;
fn regenerate_recovery_codes<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, RegenerateRecoveryCodesRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<RegenerateRecoveryCodesResponse> + Send + use<'a, Self>>> + Send;
fn claim_fresh_step_up<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ClaimFreshStepUpRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ClaimFreshStepUpResponse> + Send + use<'a, Self>>> + Send;
fn consume_fresh_step_up<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ConsumeFreshStepUpRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ConsumeFreshStepUpResponse> + Send + use<'a, Self>>> + Send;
fn release_fresh_step_up<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ReleaseFreshStepUpRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ReleaseFreshStepUpResponse> + Send + use<'a, Self>>> + Send;
}Expand description
MFA management service for enrollment, challenges, fresh step-up proofs, and recovery codes.
§Implementing handlers
Implement methods with plain async fn; the returned future satisfies
the Send bound automatically.
Unary and server-streaming requests arrive as
ServiceRequest<'_, Req>: a zero-copy
view of the request plus its body, valid for the duration of the call.
Fields are read directly (request.name is a &str into the decoded
buffer) and the borrow may be held across .await points. Anything
that must outlive the call — tokio::spawn, channels, server state,
or data captured by a returned response stream — takes owned data:
call request.to_owned_message() (or copy the specific fields)
first.
Client-streaming and bidi requests arrive as
InboundStream<Req> — a
ServiceStream of StreamMessages.
Each item owns its decoded buffer and is Send + 'static, so items
can be buffered or moved into spawned tasks; read fields zero-copy
through the generated accessor methods (item.name()) or .view(),
convert with .to_owned_message(), or yield an item back unchanged —
StreamMessage<M> implements Encodable<M>.
Request types resolved through extern_path (e.g. well-known types
from another crate) use the same wrappers; the crate that owns the
type must be generated with buffa ≥ 0.8.0 and views enabled so the
backing HasMessageView impl exists.
The impl Encodable<Out> return bound accepts the owned Out, the
generated OutView<'_> / OwnedOutView,
MaybeBorrowed, or
PreEncoded for handlers that encode a
non-'static view internally and pass the bytes across the handler
boundary. View bodies are not emitted for output types mapped via
extern_path (the impl would be an orphan); return owned for
WKT/extern outputs.
Server-streaming and bidi-streaming methods return
ServiceStream<impl Encodable<Out> + Send + use<Self>>. The
use<Self> precise-capturing clause excludes &self’s lifetime and
the request’s lifetime (unary methods use use<'a, Self> and may
borrow from &self), so stream items must be 'static and cannot
borrow from the request. To stream view-encoded data, encode each
item inside the stream body and yield
PreEncoded — see its # Streaming example doc.
Required Methods§
Sourcefn list_mfa_factors<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ListMFAFactorsRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ListMFAFactorsResponse> + Send + use<'a, Self>>> + Send
fn list_mfa_factors<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, ListMFAFactorsRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<ListMFAFactorsResponse> + Send + use<'a, Self>>> + Send
List the caller’s enrolled MFA factors.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn begin_totp_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, BeginTOTPEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<BeginTOTPEnrollmentResponse> + Send + use<'a, Self>>> + Send
fn begin_totp_enrollment<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, BeginTOTPEnrollmentRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<BeginTOTPEnrollmentResponse> + Send + use<'a, Self>>> + Send
Start authenticator-app enrollment.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn finish_totp_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, FinishTOTPEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<FinishTOTPEnrollmentResponse> + Send + use<'a, Self>>> + Send
fn finish_totp_enrollment<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, FinishTOTPEnrollmentRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<FinishTOTPEnrollmentResponse> + Send + use<'a, Self>>> + Send
Finish authenticator-app enrollment.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn begin_passkey_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, BeginPasskeyEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<BeginPasskeyEnrollmentResponse> + Send + use<'a, Self>>> + Send
fn begin_passkey_enrollment<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, BeginPasskeyEnrollmentRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<BeginPasskeyEnrollmentResponse> + Send + use<'a, Self>>> + Send
Start passkey enrollment.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn finish_passkey_enrollment<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, FinishPasskeyEnrollmentRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<FinishPasskeyEnrollmentResponse> + Send + use<'a, Self>>> + Send
fn finish_passkey_enrollment<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, FinishPasskeyEnrollmentRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<FinishPasskeyEnrollmentResponse> + Send + use<'a, Self>>> + Send
Finish passkey enrollment.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn begin_mfa_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, BeginMFAChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<BeginMFAChallengeResponse> + Send + use<'a, Self>>> + Send
fn begin_mfa_challenge<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, BeginMFAChallengeRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<BeginMFAChallengeResponse> + Send + use<'a, Self>>> + Send
Start an MFA challenge for session elevation or fresh step-up.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn verify_totp_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, VerifyTOTPChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send
fn verify_totp_challenge<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, VerifyTOTPChallengeRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send
Verify an MFA challenge with an authenticator-app code.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn finish_passkey_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, FinishPasskeyChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send
fn finish_passkey_challenge<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, FinishPasskeyChallengeRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send
Verify an MFA challenge with a passkey.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn verify_recovery_code_challenge<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, VerifyRecoveryCodeChallengeRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send
fn verify_recovery_code_challenge<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, VerifyRecoveryCodeChallengeRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<CompleteMFAChallengeResponse> + Send + use<'a, Self>>> + Send
Verify an MFA challenge with a recovery code.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn update_mfa_factor<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, UpdateMFAFactorRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<UpdateMFAFactorResponse> + Send + use<'a, Self>>> + Send
fn update_mfa_factor<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, UpdateMFAFactorRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<UpdateMFAFactorResponse> + Send + use<'a, Self>>> + Send
Update an enrolled MFA factor label.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn delete_mfa_factor<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, DeleteMFAFactorRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<DeleteMFAFactorResponse> + Send + use<'a, Self>>> + Send
fn delete_mfa_factor<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, DeleteMFAFactorRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<DeleteMFAFactorResponse> + Send + use<'a, Self>>> + Send
Delete an enrolled MFA factor.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn regenerate_recovery_codes<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, RegenerateRecoveryCodesRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<RegenerateRecoveryCodesResponse> + Send + use<'a, Self>>> + Send
fn regenerate_recovery_codes<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, RegenerateRecoveryCodesRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<RegenerateRecoveryCodesResponse> + Send + use<'a, Self>>> + Send
Rotate the caller’s recovery codes.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn claim_fresh_step_up<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ClaimFreshStepUpRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ClaimFreshStepUpResponse> + Send + use<'a, Self>>> + Send
fn claim_fresh_step_up<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, ClaimFreshStepUpRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<ClaimFreshStepUpResponse> + Send + use<'a, Self>>> + Send
Claim a fresh step-up proof for one protected request.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn consume_fresh_step_up<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ConsumeFreshStepUpRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ConsumeFreshStepUpResponse> + Send + use<'a, Self>>> + Send
fn consume_fresh_step_up<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, ConsumeFreshStepUpRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<ConsumeFreshStepUpResponse> + Send + use<'a, Self>>> + Send
Consume a claimed fresh step-up proof after the protected request succeeds.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Sourcefn release_fresh_step_up<'a>(
&'a self,
ctx: RequestContext,
request: ServiceRequest<'_, ReleaseFreshStepUpRequest>,
) -> impl Future<Output = ServiceResult<impl Encodable<ReleaseFreshStepUpResponse> + Send + use<'a, Self>>> + Send
fn release_fresh_step_up<'a>( &'a self, ctx: RequestContext, request: ServiceRequest<'_, ReleaseFreshStepUpRequest>, ) -> impl Future<Output = ServiceResult<impl Encodable<ReleaseFreshStepUpResponse> + Send + use<'a, Self>>> + Send
Release a claimed fresh step-up proof when the protected request does not complete.
'a lets the response body borrow from &self (e.g. server-resident state).
request is borrowed from the request body and is valid for the
duration of the call; message fields are read directly on it
(zero-copy). The response cannot borrow from request — use
.to_owned_message() (or copy the specific fields) for anything
returned, stored, or moved into tokio::spawn.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".