Struct jwt_authorizer::layer::AsyncAuthorizationService
source · pub struct AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync,{
pub inner: S,
pub auth: Arc<Authorizer<C>>,
}Fields§
§inner: S§auth: Arc<Authorizer<C>>Implementations§
source§impl<S, C> AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync,
impl<S, C> AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync,
source§impl<S, C> AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync,
impl<S, C> AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync,
sourcepub fn new(inner: S, auth: Arc<Authorizer<C>>) -> AsyncAuthorizationService<S, C>
pub fn new(inner: S, auth: Arc<Authorizer<C>>) -> AsyncAuthorizationService<S, C>
Authorize requests using a custom scheme.
The Authorization header is required to have the value provided.
Trait Implementations§
source§impl<B, S, C> AsyncAuthorizer<B> for AsyncAuthorizationService<S, C>where
B: Send + Sync + 'static,
C: Clone + DeserializeOwned + Send + Sync + 'static,
impl<B, S, C> AsyncAuthorizer<B> for AsyncAuthorizationService<S, C>where
B: Send + Sync + 'static,
C: Clone + DeserializeOwned + Send + Sync + 'static,
type RequestBody = B
type ResponseBody = UnsyncBoxBody<Bytes, Error>
type Future = Pin<Box<dyn Future<Output = Result<Request<B>, Response<<AsyncAuthorizationService<S, C> as AsyncAuthorizer<B>>::ResponseBody>>> + Send + 'static, Global>>
Authorize the request. Read more
source§impl<S: Clone, C> Clone for AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync + Clone,
impl<S: Clone, C> Clone for AsyncAuthorizationService<S, C>where
C: Clone + DeserializeOwned + Send + Sync + Clone,
source§fn clone(&self) -> AsyncAuthorizationService<S, C>
fn clone(&self) -> AsyncAuthorizationService<S, C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<ReqBody, S, C> Service<Request<ReqBody>> for AsyncAuthorizationService<S, C>where
ReqBody: Send + Sync + 'static,
S: Service<Request<ReqBody>, Response = Response> + Clone,
C: Clone + DeserializeOwned + Send + Sync + 'static,
impl<ReqBody, S, C> Service<Request<ReqBody>> for AsyncAuthorizationService<S, C>where
ReqBody: Send + Sync + 'static,
S: Service<Request<ReqBody>, Response = Response> + Clone,
C: Clone + DeserializeOwned + Send + Sync + 'static,
Auto Trait Implementations§
impl<S, C> !RefUnwindSafe for AsyncAuthorizationService<S, C>
impl<S, C> Send for AsyncAuthorizationService<S, C>where
S: Send,
impl<S, C> Sync for AsyncAuthorizationService<S, C>where
S: Sync,
impl<S, C> Unpin for AsyncAuthorizationService<S, C>where
S: Unpin,
impl<S, C> !UnwindSafe for AsyncAuthorizationService<S, C>
Blanket Implementations§
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>
§impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
§fn poll_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn poll_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
Returns
Poll::Ready when the factory is able to create more services. Read more§fn make_service(
&mut self,
target: Target
) -> <M as MakeService<Target, Request>>::Future
fn make_service(
&mut self,
target: Target
) -> <M as MakeService<Target, Request>>::Future
Create and return a new service value asynchronously.
§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
§fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
source§impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
impl<S, R> ServiceExt<R> for Swhere
S: Service<R>,
source§fn into_make_service(self) -> IntoMakeService<S>
fn into_make_service(self) -> IntoMakeService<S>
Convert this service into a
MakeService, that is a Service whose
response is another service. Read moresource§fn into_make_service_with_connect_info<C>(
self
) -> IntoMakeServiceWithConnectInfo<S, C>
fn into_make_service_with_connect_info<C>(
self
) -> IntoMakeServiceWithConnectInfo<S, C>
Convert this service into a
MakeService, that will store C’s
associated ConnectInfo in a request extension such that ConnectInfo
can extract it. Read more§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
§fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
Yields a mutable reference to the service when it is ready to accept a request.
§fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
fn ready_and(&mut self) -> Ready<'_, Self, Request>where
Self: Sized,
👎Deprecated since 0.4.6: please use the
ServiceExt::ready method insteadYields a mutable reference to the service when it is ready to accept a request.
§fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request>where
Self: Sized,
Yields the service when it is ready to accept a request.
§fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request>where
Self: Sized,
Consume this
Service, calling with the providing request once it is ready.§fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<Box<dyn Error + Sync + Send + 'static, Global>>,
S: Stream<Item = Request>,
fn call_all<S>(self, reqs: S) -> CallAll<Self, S>where
Self: Sized,
Self::Error: Into<Box<dyn Error + Sync + Send + 'static, Global>>,
S: Stream<Item = Request>,
§fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
Executes a new future after this service’s future resolves. This does
not alter the behaviour of the
poll_ready method. Read more§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: FnOnce(Self::Response) -> Response + Clone,
Maps this service’s response value to a different value. This does not
alter the behaviour of the
poll_ready method. Read more§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: FnOnce(Self::Error) -> Error + Clone,
Maps this service’s error value to a different value. This does not
alter the behaviour of the
poll_ready method. Read more§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Result<Response, Error> + Clone,
Maps this service’s result type (
Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read more§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where
Self: Sized,
F: FnMut(NewRequest) -> Request,
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where
Self: Sized,
F: FnMut(NewRequest) -> Request,
Composes a function in front of the service. Read more
§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone,
Fut: Future<Output = Result<Response, Error>>,
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: FnOnce(Result<Self::Response, Self::Error>) -> Fut + Clone,
Fut: Future<Output = Result<Response, Error>>,
Composes an asynchronous function after this service. Read more
§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>where
Self: Sized,
F: FnMut(Self::Future) -> Fut,
Error: From<Self::Error>,
Fut: Future<Output = Result<Response, Error>>,
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>where
Self: Sized,
F: FnMut(Self::Future) -> Fut,
Error: From<Self::Error>,
Fut: Future<Output = Result<Response, Error>>,
Composes a function that transforms futures produced by the service. Read more