mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-13 08:20:03 +00:00
get exp time out of correct token
This commit is contained in:
parent
1d92974447
commit
1efceb86fc
@ -203,6 +203,7 @@ impl ZeroIDC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(debug_assertions)] {
|
#[cfg(debug_assertions)] {
|
||||||
|
println!("now: {:?}\nexp: {:?}", now, exp);
|
||||||
println!("Refresh Token: {}", refresh_token.secret());
|
println!("Refresh Token: {}", refresh_token.secret());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,15 +520,17 @@ impl ZeroIDC {
|
|||||||
println!("Status: {}", res.status());
|
println!("Status: {}", res.status());
|
||||||
}
|
}
|
||||||
|
|
||||||
let at = tok.access_token().secret();
|
let idt = &id_token.to_string();
|
||||||
|
|
||||||
let t: Result<Token<jwt::Header, jwt::Claims, jwt::Unverified<'_>>, jwt::Error>= Token::parse_unverified(at);
|
let t: Result<Token<jwt::Header, jwt::Claims, jwt::Unverified<'_>>, jwt::Error>=
|
||||||
|
Token::parse_unverified(idt);
|
||||||
|
|
||||||
if let Ok(t) = t {
|
if let Ok(t) = t {
|
||||||
let claims = t.claims().registered.clone();
|
let claims = t.claims().registered.clone();
|
||||||
match claims.expiration {
|
match claims.expiration {
|
||||||
Some(exp) => {
|
Some(exp) => {
|
||||||
i.exp_time = exp;
|
i.exp_time = exp;
|
||||||
|
println!("Set exp time to: {:?}", i.exp_time);
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
panic!("expiration is None. This shouldn't happen")
|
panic!("expiration is None. This shouldn't happen")
|
||||||
|
Loading…
Reference in New Issue
Block a user