update examples

This commit is contained in:
David Pedersen
2022-07-03 21:47:23 +02:00
parent 02f9ebaee9
commit 16ef59b6ce
38 changed files with 101 additions and 83 deletions
+4 -3
View File
@@ -62,7 +62,7 @@ async fn main() {
.with(tracing_subscriber::fmt::layer())
.init();
let app = Router::new()
let app = Router::without_state()
.route("/protected", get(protected))
.route("/authorize", post(authorize));
@@ -122,13 +122,14 @@ impl AuthBody {
}
#[async_trait]
impl<B> FromRequest<B> for Claims
impl<S, B> FromRequest<S, B> for Claims
where
S: Send,
B: Send,
{
type Rejection = AuthError;
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
async fn from_request(req: &mut RequestParts<S, B>) -> Result<Self, Self::Rejection> {
// Extract the token from the authorization header
let TypedHeader(Authorization(bearer)) =
TypedHeader::<Authorization<Bearer>>::from_request(req)