pub struct Authz<F>(/* private fields */);Implementations§
Source§impl<F> Authz<F>where
F: Fn(&mut Request, &mut Depot) -> Result<Option<CasbinVals>, StatusError> + Send + Sync + 'static,
impl<F> Authz<F>where
F: Fn(&mut Request, &mut Depot) -> Result<Option<CasbinVals>, StatusError> + Send + Sync + 'static,
Sourcepub async fn new(
db_conn: DatabaseConnection,
model_str: &str,
get_casbin_vals: F,
) -> Result<Self>
pub async fn new( db_conn: DatabaseConnection, model_str: &str, get_casbin_vals: F, ) -> Result<Self>
Create a recommended enforcer that includes functions such as tracing
logger and mini_moka cache.
pub fn get_enforcer(&self) -> Arc<RwLock<CachedEnforcer>>
pub async fn handle( &self, req: &mut Request, depot: &mut Depot, res: &mut Response, ctrl: &mut FlowCtrl, )
Trait Implementations§
Source§impl<F> Handler for Authz<F>where
F: Fn(&mut Request, &mut Depot) -> Result<Option<CasbinVals>, StatusError> + Send + Sync + 'static,
impl<F> Handler for Authz<F>where
F: Fn(&mut Request, &mut Depot) -> Result<Option<CasbinVals>, StatusError> + Send + Sync + 'static,
Source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
__macro_gen_req: &'life1 mut Request,
__macro_gen_depot: &'life2 mut Depot,
__macro_gen_res: &'life3 mut Response,
__macro_gen_ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
__macro_gen_req: &'life1 mut Request,
__macro_gen_depot: &'life2 mut Depot,
__macro_gen_res: &'life3 mut Response,
__macro_gen_ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Handle http request.
Source§fn arc(self) -> ArcHandlerwhere
Self: Sized,
fn arc(self) -> ArcHandlerwhere
Self: Sized,
Wrap to
ArcHandler.Source§fn hoop<H>(self, hoop: H) -> HoopedHandler
fn hoop<H>(self, hoop: H) -> HoopedHandler
Hoop this handler with middleware.
Auto Trait Implementations§
impl<F> Freeze for Authz<F>where
F: Freeze,
impl<F> !RefUnwindSafe for Authz<F>
impl<F> Send for Authz<F>where
F: Send,
impl<F> Sync for Authz<F>where
F: Sync,
impl<F> Unpin for Authz<F>where
F: Unpin,
impl<F> !UnwindSafe for Authz<F>
Blanket Implementations§
Source§impl<Data> ApiSuccessResponse for Data
impl<Data> ApiSuccessResponse for Data
fn api_response<Meta>(self, meta: Option<Meta>) -> ApiResponse<Self, Meta>
fn api_response_without_meta<Meta>(self) -> ApiResponse<Self, Meta>
fn api_response_with_meta<Meta>(self, meta: Meta) -> ApiResponse<Self, Meta>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> FutureTraceExt for Twhere
T: FutureExt,
impl<T> FutureTraceExt for Twhere
T: FutureExt,
Source§fn with_current_context_span(self, otel_span: Span) -> WithContext<Self> ⓘ
fn with_current_context_span(self, otel_span: Span) -> WithContext<Self> ⓘ
Pass the span of opentelemetry to the current context of tracing.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request