Skip to content

update to axum v0.7 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ license = "MIT"
repository = "https://github.com/cmackenzie1/axum-jwt-auth"

[dependencies]
axum = { version = "0.6", features = ["headers", "macros"] }
chrono = "0.4"
hyper = { version = "0.14", features = ["full"] }
jsonwebtoken = { version = "8" }
reqwest = { version = "0.11", default-features=false, features = ["json", "rustls-tls"] }
axum = { version = "0.7", features = ["macros"] }
axum-extra = { version = "0.9.6", features = ["typed-header"] }
jsonwebtoken = { version = "9" }
reqwest = { version = "0.12", default-features=false, features = ["json", "rustls-tls"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", default-features = false, features = [
"time"
] }

[dev-dependencies]
chrono = "0.4"
tokio = { version = "1", default-features = false, features = [
"rt-multi-thread",
"macros",
] }
tower = "0.4"


[[example]]
name = "local"
Expand Down
9 changes: 4 additions & 5 deletions examples/local/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ async fn main() {
.route("/login", post(login))
.with_state(state);

// run it with hyper on localhost:3000
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
// run it on localhost:3000
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();

axum::serve(listener, app).await.unwrap();
}
7 changes: 4 additions & 3 deletions src/axum.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use axum::extract::FromRef;
use axum::headers::authorization::Bearer;
use axum::headers::Authorization;
use axum::http::StatusCode;
use axum::response::Response;
use axum::RequestPartsExt;
use axum::{async_trait, http::request::Parts, response::IntoResponse};
use axum::{RequestPartsExt, TypedHeader};
use axum_extra::headers::authorization::Bearer;
use axum_extra::headers::Authorization;
use axum_extra::TypedHeader;
use serde::de::DeserializeOwned;
use serde::Deserialize;

Expand Down
Loading