mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
a little cleanup
This commit is contained in:
parent
057356a725
commit
cf411efd1d
1 changed files with 61 additions and 55 deletions
|
@ -22,7 +22,7 @@ use bytes::Bytes;
|
|||
use jsonwebtoken::{dangerous_insecure_decode};
|
||||
use openidconnect::core::{CoreClient, CoreProviderMetadata, CoreResponseType};
|
||||
use openidconnect::reqwest::http_client;
|
||||
use openidconnect::{AccessToken, AccessTokenHash, AuthorizationCode, AuthenticationFlow, ClientId, CsrfToken, IssuerUrl, Nonce, NonceVerifier, OAuth2TokenResponse, PkceCodeChallenge, PkceCodeVerifier, RedirectUrl, RefreshToken, Scope, TokenResponse};
|
||||
use openidconnect::{AccessToken, AccessTokenHash, AuthorizationCode, AuthenticationFlow, ClientId, CsrfToken, IssuerUrl, Nonce, OAuth2TokenResponse, PkceCodeChallenge, PkceCodeVerifier, RedirectUrl, RefreshToken, Scope, TokenResponse};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::from_utf8;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -72,6 +72,7 @@ fn nonce_func(nonce: String) -> Box<dyn Fn() -> Nonce> {
|
|||
return Box::new(move || Nonce::new(nonce.to_string()));
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
fn systemtime_strftime<T>(dt: T, format: &str) -> String
|
||||
where T: Into<OffsetDateTime>
|
||||
{
|
||||
|
@ -244,22 +245,24 @@ impl ZeroIDC {
|
|||
return true;
|
||||
});
|
||||
|
||||
match verified {
|
||||
let v = match verified {
|
||||
Some(verified) => {
|
||||
if !verified {
|
||||
println!("not verified.");
|
||||
(*inner_local.lock().unwrap()).running = false;
|
||||
break;
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
},
|
||||
None => {
|
||||
println!("no verification performed?");
|
||||
(*inner_local.lock().unwrap()).running = false;
|
||||
break;
|
||||
}
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if v {
|
||||
match res.id_token() {
|
||||
Some(id_token) => {
|
||||
let params = [("id_token", id_token.to_string()),("state", "refresh".to_string())];
|
||||
|
@ -321,6 +324,9 @@ impl ZeroIDC {
|
|||
println!("no id token?!?");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("claims not verified");
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
println!("token error: {}", e);
|
||||
|
|
Loading…
Add table
Reference in a new issue