pub trait AttachAuthorities<Type> {
    // Required method
    fn attach(&self, authorities: impl IntoIterator<Item = Type>);
}
Expand description

Allows you to transfer authorities to actix-web-grants from your custom middleware.

The default implementation is provided for the ServiceRequest

§Example

use std::collections::HashSet;
use actix_web_grants::authorities::AttachAuthorities;
use actix_web::dev::ServiceRequest;

// You can use you own type/enum instead of `String`
fn attach(req: &ServiceRequest, authorities: HashSet<String>) {
    req.attach(authorities);
}

Required Methods§

source

fn attach(&self, authorities: impl IntoIterator<Item = Type>)

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<Type: Eq + Hash + 'static> AttachAuthorities<Type> for ServiceRequest

source§

fn attach(&self, authorities: impl IntoIterator<Item = Type>)

Implementors§