mirror of
https://github.com/TECHNOFAB11/jwt-authorizer.git
synced 2025-12-11 23:50:07 +01:00
chore: Merge branch 'NotNorom/main' into main
This commit is contained in:
commit
157cdfa396
3 changed files with 36 additions and 10 deletions
13
Cargo.lock
generated
13
Cargo.lock
generated
|
|
@ -830,7 +830,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"time 0.3.21",
|
||||
"time 0.3.23",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -875,6 +875,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"time 0.3.23",
|
||||
"tokio",
|
||||
"tonic",
|
||||
"tower",
|
||||
|
|
@ -1638,7 +1639,7 @@ dependencies = [
|
|||
"num-bigint",
|
||||
"num-traits",
|
||||
"thiserror",
|
||||
"time 0.3.21",
|
||||
"time 0.3.23",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1756,9 +1757,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.21"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc"
|
||||
checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"serde",
|
||||
|
|
@ -1774,9 +1775,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
|
|||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.9"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b"
|
||||
checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4"
|
||||
dependencies = [
|
||||
"time-core",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ keywords = ["jwt","axum","authorisation","jwks"]
|
|||
|
||||
[dependencies]
|
||||
axum = { version = "0.6", features = ["headers"] }
|
||||
chrono = "0.4"
|
||||
chrono = { version = "0.4", optional = true }
|
||||
futures-util = "0.3"
|
||||
futures-core = "0.3"
|
||||
headers = "0.3"
|
||||
|
|
@ -29,6 +29,7 @@ tower-service = "0.3"
|
|||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
tonic = { version = "0.9.2", optional = true }
|
||||
time = { version = "0.3.22", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
hyper = { version = "0.14", features = ["full"] }
|
||||
|
|
@ -38,7 +39,7 @@ tower = { version = "0.4", features = ["util", "buffer"] }
|
|||
wiremock = "0.5"
|
||||
|
||||
[features]
|
||||
default = ["default-tls"]
|
||||
default = ["default-tls", "chrono"]
|
||||
default-tls = ["reqwest/default-tls"]
|
||||
native-tls = ["reqwest/native-tls"]
|
||||
native-tls-vendored = ["reqwest/native-tls-vendored"]
|
||||
|
|
@ -47,6 +48,8 @@ rustls-tls = ["reqwest/rustls-tls"]
|
|||
rustls-tls-manual-roots = ["reqwest/rustls-tls-manual-roots"]
|
||||
rustls-tls-webpki-roots = ["reqwest/rustls-tls-webpki-roots"]
|
||||
rustls-tls-native-roots = ["reqwest/rustls-tls-native-roots"]
|
||||
time = ["dep:time"]
|
||||
chrono = ["dep:chrono"]
|
||||
|
||||
[[test]]
|
||||
name = "tonic"
|
||||
|
|
|
|||
|
|
@ -1,17 +1,36 @@
|
|||
use chrono::{DateTime, TimeZone, Utc};
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
/// Seconds since the epoch
|
||||
#[derive(Deserialize, Clone, PartialEq, Eq, Debug)]
|
||||
pub struct NumericDate(i64);
|
||||
|
||||
impl NumericDate {
|
||||
/// Get the underlying unix timestamp
|
||||
pub fn inner(&self) -> i64 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "chrono")]
|
||||
use chrono::{DateTime, TimeZone, Utc};
|
||||
|
||||
#[cfg(feature = "chrono")]
|
||||
impl From<NumericDate> for DateTime<Utc> {
|
||||
fn from(t: NumericDate) -> Self {
|
||||
Utc.timestamp_opt(t.0, 0).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "time")]
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[cfg(feature = "time")]
|
||||
impl From<NumericDate> for OffsetDateTime {
|
||||
fn from(t: NumericDate) -> Self {
|
||||
OffsetDateTime::from_unix_timestamp(t.0).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Clone, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum OneOrArray<T> {
|
||||
|
|
@ -28,6 +47,9 @@ impl<T> OneOrArray<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Clone)]
|
||||
pub struct StringList(Vec<String>);
|
||||
|
||||
/// Claims mentioned in the JWT specifications.
|
||||
///
|
||||
/// https://www.rfc-editor.org/rfc/rfc7519#section-4.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue