IdentityPolicy

Trait IdentityPolicy 

Source
pub trait IdentityPolicy: Sized + 'static {
    type Future: Future<Output = Result<Option<String>, Error>>;
    type ResponseFuture: Future<Output = Result<(), Error>>;

    // Required methods
    fn from_request(&self, request: &mut ServiceRequest) -> Self::Future;
    fn to_response<B>(
        &self,
        identity: Option<String>,
        changed: bool,
        response: &mut ServiceResponse<B>,
    ) -> Self::ResponseFuture;
}
Expand description

Identity policy definition.

Required Associated Types§

Source

type Future: Future<Output = Result<Option<String>, Error>>

The return type of the middleware

Source

type ResponseFuture: Future<Output = Result<(), Error>>

The return type of the middleware

Required Methods§

Source

fn from_request(&self, request: &mut ServiceRequest) -> Self::Future

Parse the session from request and load data from a service identity.

Source

fn to_response<B>( &self, identity: Option<String>, changed: bool, response: &mut ServiceResponse<B>, ) -> Self::ResponseFuture

Write changes to response

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.

Implementors§