Trait tower_http::auth::AsyncAuthorizeRequest
source · [−]pub trait AsyncAuthorizeRequest<B> {
type RequestBody;
type ResponseBody;
type Future: Future<Output = Result<Request<Self::RequestBody>, Response<Self::ResponseBody>>>;
fn authorize(&mut self, request: Request<B>) -> Self::Future;
}
This is supported on crate feature
auth
only.Expand description
Trait for authorizing requests.
Associated Types
type RequestBody
type RequestBody
The type of request body returned by authorize
.
Set this to B
if you need to change the request body type.
type ResponseBody
type ResponseBody
The body type used for responses to unauthorized requests.
type Future: Future<Output = Result<Request<Self::RequestBody>, Response<Self::ResponseBody>>>
type Future: Future<Output = Result<Request<Self::RequestBody>, Response<Self::ResponseBody>>>
The Future type returned by authorize
Required methods
Authorize the request.
If the future resolves to Ok(request)
then the request is allowed through, otherwise not.