mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-01 00:00:14 +02:00
update examples
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user