Skip to main content

protected

Function protected 

Source
pub fn protected(
    check: impl Fn(&Request) -> bool + Send + Sync + 'static,
    login: &str,
) -> impl Middleware
Expand description

Protect routes: when check returns false the user is redirected to login (with ?next= set) — or receives 401 for non-GET requests.