Skip to content

Commit a998ae7

Browse files
committed
Correct graphql auth token extraction
Getting an optional T is different from getting a required Option<T>
1 parent cd9df8c commit a998ae7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/graphql.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,13 @@ where
347347
{
348348
if let Some(policy) = ctx.data::<Option<PolicyCheck>>()? {
349349
trace!("Auth enabled: checking token");
350-
let token = ctx.data::<Authorization<Bearer>>().ok();
351-
check(policy, token)
350+
let token = ctx.data::<Option<Authorization<Bearer>>>()?;
351+
check(policy, token.as_ref())
352352
.await
353353
.inspect_err(|e| info!("Authorization failed: {e:?}"))
354354
.map_err(async_graphql::Error::from)
355355
} else {
356+
trace!("No authorization configured");
356357
Ok(())
357358
}
358359
}

0 commit comments

Comments
 (0)