mirror of
https://github.com/lldap/lldap.git
synced 2026-04-05 14:48:10 +00:00
auth: serialize exp and iat claims as NumericDate to comply with RFC7519 (#1289)
Add `jti` claim to the JWT to avoid hashing collisions
This commit is contained in:
@@ -136,7 +136,7 @@ features = ["full"]
|
||||
version = "1.25"
|
||||
|
||||
[dependencies.uuid]
|
||||
features = ["v1", "v3"]
|
||||
features = ["v1", "v3", "v4"]
|
||||
version = "1"
|
||||
|
||||
[dependencies.tracing-forest]
|
||||
|
||||
@@ -35,6 +35,7 @@ use std::{
|
||||
};
|
||||
use time::ext::NumericalDuration;
|
||||
use tracing::{debug, info, instrument, warn};
|
||||
use uuid::Uuid;
|
||||
|
||||
type Token<S> = jwt::Token<jwt::Header, JWTClaims, S>;
|
||||
type SignedToken = Token<jwt::token::Signed>;
|
||||
@@ -56,6 +57,7 @@ async fn create_jwt<Handler: TcpBackendHandler>(
|
||||
let claims = JWTClaims {
|
||||
exp: Utc::now() + chrono::Duration::days(1),
|
||||
iat: Utc::now(),
|
||||
jti: Uuid::new_v4(),
|
||||
user: user.to_string(),
|
||||
groups: groups
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user