Skip to main content

AuthDispatch

Trait AuthDispatch 

Source
pub(in router) trait AuthDispatch: AuthScheme {
    const SCHEME: Scheme;

    // Required method
    fn dispatch(
        services: &Services,
        request: &mut Request,
        json_body: Option<&CanonicalJsonValue>,
        token: Token,
        route: TypeId,
    ) -> impl Future<Output = Result<Auth>> + Send;
}
Expand description

Trait routing a concrete [AuthScheme] through the per-scheme dispatch.

dispatch is intentionally non-generic over the request type; the caller passes TypeId::of::<T>() so each impl emits a single body rather than monomorphizing per request.

Required Associated Constants§

Required Methods§

Source

fn dispatch( services: &Services, request: &mut Request, json_body: Option<&CanonicalJsonValue>, token: Token, route: TypeId, ) -> impl Future<Output = Result<Auth>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AuthDispatch for AccessToken

Source§

const SCHEME: Scheme = Scheme::AccessToken

Source§

async fn dispatch( services: &Services, request: &mut Request, _json_body: Option<&CanonicalJsonValue>, token: Token, route: TypeId, ) -> Result<Auth>

Source§

impl AuthDispatch for AccessTokenOptional

Source§

const SCHEME: Scheme = Scheme::AccessTokenOptional

Source§

async fn dispatch( services: &Services, _request: &mut Request, _json_body: Option<&CanonicalJsonValue>, token: Token, _route: TypeId, ) -> Result<Auth>

Source§

impl AuthDispatch for AppserviceToken

Source§

const SCHEME: Scheme = Scheme::AppserviceToken

Source§

async fn dispatch( services: &Services, _request: &mut Request, _json_body: Option<&CanonicalJsonValue>, token: Token, _route: TypeId, ) -> Result<Auth>

Source§

impl AuthDispatch for AppserviceTokenOptional

Source§

const SCHEME: Scheme = Scheme::AppserviceTokenOptional

Source§

async fn dispatch( services: &Services, _request: &mut Request, _json_body: Option<&CanonicalJsonValue>, token: Token, _route: TypeId, ) -> Result<Auth>

Source§

impl AuthDispatch for NoAccessToken

Source§

const SCHEME: Scheme = Scheme::None

Source§

async fn dispatch( services: &Services, request: &mut Request, json_body: Option<&CanonicalJsonValue>, token: Token, route: TypeId, ) -> Result<Auth>

Source§

impl AuthDispatch for NoAuthentication

Source§

const SCHEME: Scheme = Scheme::None

Source§

async fn dispatch( services: &Services, request: &mut Request, _json_body: Option<&CanonicalJsonValue>, token: Token, route: TypeId, ) -> Result<Auth>

Source§

impl AuthDispatch for ServerSignatures

Source§

const SCHEME: Scheme = Scheme::ServerSignatures

Source§

async fn dispatch( services: &Services, request: &mut Request, json_body: Option<&CanonicalJsonValue>, token: Token, _route: TypeId, ) -> Result<Auth>

Implementors§