bug fixed

This commit is contained in:
병준 박 2022-08-28 16:29:45 +00:00
parent 135bc3b5e2
commit 62f76d5c1d
2 changed files with 6 additions and 5 deletions

View File

@ -10,12 +10,12 @@ name = "beteran_common_rust"
path = "./src/lib.rs" path = "./src/lib.rs"
[dependencies] [dependencies]
chrono = { version = "0" }
jsonwebtoken = { version = "8" } jsonwebtoken = { version = "8" }
lazy_static = { version = "1" } lazy_static = { version = "1" }
prost = { version = "0" } prost = { version = "0" }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" } serde_json = { version = "1" }
time = { version = "0.3" }
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.79-snapshot" } beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.79-snapshot" }

View File

@ -50,12 +50,13 @@ pub fn encode(issuer: &str, session_id: &str) -> Result<String, Error> {
let header = Header::new(Algorithm::RS256); let header = Header::new(Algorithm::RS256);
let issued_at = time::OffsetDateTime::now_utc(); let issued_at = (chrono::Utc::now()).timestamp();
let expiration_at = issued_at + time::Duration::days(1); let expiration_at = (chrono::Utc::now() + chrono::Duration::days(1)).timestamp();
let claims = Claims { let claims = Claims {
iss: issuer.to_string(), iss: issuer.to_string(),
iat: issued_at.unix_timestamp(), iat: issued_at,
exp: expiration_at.unix_timestamp(), exp: expiration_at,
session_id: session_id.to_string(), session_id: session_id.to_string(),
}; };