mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-12 08:00:07 +01:00
fix: Ensure the ready inner service is used
Cloning the inner service to use in call can mean a not-ready clone gets used which violates the tower service preconditions. Replace the cloned service with the ready service to ensure the right copy gets used. See https://docs.rs/tower/0.4.13/tower/trait.Service.html#be-careful-when-cloning-inner-services for more details Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
This commit is contained in:
parent
f628617601
commit
1cec99e522
1 changed files with 3 additions and 0 deletions
|
|
@ -342,6 +342,9 @@ where
|
|||
|
||||
fn call(&mut self, req: Request<ReqBody>) -> Self::Future {
|
||||
let inner = self.inner.clone();
|
||||
// take the service that was ready
|
||||
let inner = std::mem::replace(&mut self.inner, inner);
|
||||
|
||||
let auth_fut = self.authorize(req);
|
||||
|
||||
ResponseFuture {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue