# actix_web::middleware::identity::IdentityService - Rust
API documentation for the Rust `IdentityService` struct in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, IdentityService

# Struct actix_web::middleware::identity::IdentityService [−] [src]

    pub struct IdentityService<T> { /* fields omitted */ }

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),
        ));
    }

## Methods

###

`impl<T> IdentityService<T>`

[src]

####

`pub fn new(backend: T) -> Self`

[src]

Create new identity service with specified backend.

## Trait Implementations

###

`impl<S: 'static, T: IdentityPolicy<S>> Middleware<S> for IdentityService<T>`

[src]

####

`fn start(&self, req: &HttpRequest<S>) -> Result<Started>`

[src]

Method is called when request is ready. It may return future, which should resolve before next middleware get called. Read more

####

`fn response(&self, req: &HttpRequest<S>, resp: HttpResponse) -> Result<Response>`

[src]

Method is called when handler returns response, but before sending http message to peer. Read more

####

`fn finish(&self, req: &HttpRequest<S>, resp: &HttpResponse) -> Finished`

[src]

Method is called after body stream get sent to peer.

## Auto Trait Implementations

###

`impl<T> Send for IdentityService<T> where T: Send,`

###

`impl<T> Sync for IdentityService<T> where T: Sync,`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)