Struct cosworth::prelude::identity::IdentityService
source · pub struct IdentityService<T> { /* private fields */ }
Expand description
Request identity middleware
use actix_web::middleware::identity::{CookieIdentityPolicy, IdentityService};
use actix_web::App;
fn main() {
let app = App::new().middleware(IdentityService::new(
// <- create identity middleware
CookieIdentityPolicy::new(&[0; 32]) // <- create cookie session backend
.name("auth-cookie")
.secure(false),
));
}
Implementations§
source§impl<T> IdentityService<T>
impl<T> IdentityService<T>
sourcepub fn new(backend: T) -> IdentityService<T>
pub fn new(backend: T) -> IdentityService<T>
Create new identity service with specified backend.
Trait Implementations§
source§impl<S, T> Middleware<S> for IdentityService<T>where
S: 'static,
T: IdentityPolicy<S>,
impl<S, T> Middleware<S> for IdentityService<T>where
S: 'static,
T: IdentityPolicy<S>,
source§fn start(&self, req: &HttpRequest<S>) -> Result<Started, Error>
fn start(&self, req: &HttpRequest<S>) -> Result<Started, Error>
Method is called when request is ready. It may return
future, which should resolve before next middleware get called. Read more
source§fn response(
&self,
req: &HttpRequest<S>,
resp: HttpResponse
) -> Result<Response, Error>
fn response(
&self,
req: &HttpRequest<S>,
resp: HttpResponse
) -> Result<Response, Error>
Method is called when handler returns response,
but before sending http message to peer. Read more
source§fn finish(&self, req: &HttpRequest<S>, resp: &HttpResponse) -> Finished
fn finish(&self, req: &HttpRequest<S>, resp: &HttpResponse) -> Finished
Method is called after body stream get sent to peer.
Auto Trait Implementations§
impl<T> RefUnwindSafe for IdentityService<T>where
T: RefUnwindSafe,
impl<T> Send for IdentityService<T>where
T: Send,
impl<T> Sync for IdentityService<T>where
T: Sync,
impl<T> Unpin for IdentityService<T>where
T: Unpin,
impl<T> UnwindSafe for IdentityService<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: AsExpression<T> + Sized,
Convert
self
to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
Convert
&self
to an expression for Diesel’s query builder. Read more