fn load<S>(
        &self,
        req: &HttpRequest<S>,
    ) -> Box<Future<Item = Option<SqlIdentityModel>, Error = ActixWebError>> {
        let headers = req.headers();
        let auth_header = headers.get("Authorization");

        if let Some(auth_header) = auth_header {
            // Return the identity (or none, if it doesn't exist)

            if let Ok(auth_header) = auth_header.to_str() {
                let mut iter = auth_header.split(' ');
                let scheme = iter.next();
                let token = iter.next();

                if scheme.is_some() && token.is_some() {
                    let _scheme = scheme.expect("[SII::load] Scheme is None!");
                    let token = token.expect("[SII::load] Token is None!");

                    return Box::new(
                        self.addr
                            .send(FindIdentity {
                                token: token.to_string(),
                            })
                            .map_err(ActixWebError::from)
                            .and_then(move |res| match res {
                                Ok(val) => Ok(Some(val)),
                                Err(e) => {
                                    warn!("WARN: {:?}", e);
                                    Ok(None)
                                }
                            }),
                    );
                }
            }
        }

        Box::new(FutOk(None))
    }
/// Loads an identity from the backend provider (SQL database)
Loads an identity from the backend provider (SQL database)
Loads an identity from the backend provider ( SQL database )
fn load<S>(
        &self,
        req: &HttpRequest<S>,
    ) -> Box<Future<Item = Option<SqlIdentityModel>, Error = ActixWebError>> {
        let headers = req.headers();
        let auth_header = headers.get("Authorization");
        if let Some(auth_header) = auth_header {
            // Return the identity (or none, if it doesn't exist)
            if let Ok(auth_header) = auth_header.to_str() {
                let mut iter = auth_header.split(' ');
                let scheme = iter.next();
                let token = iter.next();
                if scheme.is_some() && token.is_some() {
                    let _scheme = scheme.expect("[SII::load] Scheme is None!");
                    let token = token.expect("[SII::load] Token is None!");
                    return Box::new(
                        self.addr
                            .send(FindIdentity {
                                token: token.to_string(),
                            })
                            .map_err(ActixWebError::from)
                            .and_then(move |res| match res {
                                Ok(val) => Ok(Some(val)),
                                Err(e) => {
                                    warn!("WARN: {:?}", e);
                                    Ok(None)
                                }
                            }),
                    );
                }
            }
        }
        Box::new(FutOk(None))
    }
fn load < S > ( & self , req : & HttpRequest < S > , ) -> Box < Future < Item = Option < SqlIdentityModel > , Error = ActixWebError > > { let headers = req . headers ( ) ; let auth_header = headers . get ( " " ) ; if let Some ( auth_header ) = auth_header { // Return the identity (or none, if it doesn't exist) if let Ok ( auth_header ) = auth_header . to_str ( ) { let mut iter = auth_header . split ( ' ' ) ; let scheme = iter . next ( ) ; let token = iter . next ( ) ; if scheme . is_some ( ) && token . is_some ( ) { let _scheme = scheme . expect ( " " ) ; let token = token . expect ( " " ) ; return Box :: new ( self . addr . send ( FindIdentity { token : token . to_string ( ) , } ) . map_err ( ActixWebError :: from ) . and_then ( move | res | match res { Ok ( val ) => Ok ( Some ( val ) ) , Err ( e ) => { warn ! ( " " e ) ; Ok ( None ) } } ) , ) ; } } } Box :: new ( FutOk ( None ) ) }
Loads an identity from the backend provider (SQL database)
Loads an identity from the backend provider ( SQL database )
&self
req
&HttpRequest<S>
&self
req
&HttpRequest<S>