pub trait GetLoginRoute {
    fn get_login_route(&self, src: Option<&str>) -> String;
}
Expand description

The route to which unauthenticated sessions should be redirected to. src specifies the destination of the request, which can be used to redirect the user post authentication

Required methods

use actix_auth_middleware::{Authentication, GetLoginRoute};

pub struct Routes {
    signin: &'static str,
    authenticated_route: &'static str,
}

impl GetLoginRoute for Routes {
// return login route and if redirection mechanism is implemented at the login
// handler, then set redirection location
    fn get_login_route(&self, src: Option<&str>) -> String {
        if let Some(redirect_to) = src {
            format!(
                "{}?redirect_to={}",
                self.signin,
                urlencoding::encode(redirect_to)
            )
        } else {
            self.signin.to_string()
        }
    }
}

Implementors