Skip to content

Commit

Permalink
Add AsyncRequireAuthorization::layer (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte authored Dec 18, 2021
1 parent a8899fc commit b965b25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tower-http/src/auth/async_require_authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ impl<S, T> AsyncRequireAuthorization<S, T> {
pub fn new(inner: S, auth: T) -> AsyncRequireAuthorization<S, T> {
Self { inner, auth }
}

/// Returns a new [`Layer`] that wraps services with an [`AsyncRequireAuthorizationLayer`]
/// middleware.
///
/// [`Layer`]: tower_layer::Layer
pub fn layer(auth: T) -> AsyncRequireAuthorizationLayer<T> {
AsyncRequireAuthorizationLayer::new(auth)
}
}

impl<ReqBody, ResBody, S, Auth> Service<Request<ReqBody>> for AsyncRequireAuthorization<S, Auth>
Expand Down

0 comments on commit b965b25

Please sign in to comment.