bug fixed
This commit is contained in:
parent
135bc3b5e2
commit
62f76d5c1d
|
@ -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" }
|
||||||
|
|
||||||
|
|
|
@ -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(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user