mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 04: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 jsonwebtoken::{dangerous_insecure_decode};
|
||||||
use openidconnect::core::{CoreClient, CoreProviderMetadata, CoreResponseType};
|
use openidconnect::core::{CoreClient, CoreProviderMetadata, CoreResponseType};
|
||||||
use openidconnect::reqwest::http_client;
|
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 serde::{Deserialize, Serialize};
|
||||||
use std::str::from_utf8;
|
use std::str::from_utf8;
|
||||||
use std::sync::{Arc, Mutex};
|
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()));
|
return Box::new(move || Nonce::new(nonce.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
fn systemtime_strftime<T>(dt: T, format: &str) -> String
|
fn systemtime_strftime<T>(dt: T, format: &str) -> String
|
||||||
where T: Into<OffsetDateTime>
|
where T: Into<OffsetDateTime>
|
||||||
{
|
{
|
||||||
|
@ -244,22 +245,24 @@ impl ZeroIDC {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
match verified {
|
let v = match verified {
|
||||||
Some(verified) => {
|
Some(verified) => {
|
||||||
if !verified {
|
if !verified {
|
||||||
println!("not verified.");
|
println!("not verified.");
|
||||||
(*inner_local.lock().unwrap()).running = false;
|
(*inner_local.lock().unwrap()).running = false;
|
||||||
break;
|
false
|
||||||
|
} else {
|
||||||
|
true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
println!("no verification performed?");
|
println!("no verification performed?");
|
||||||
(*inner_local.lock().unwrap()).running = false;
|
(*inner_local.lock().unwrap()).running = false;
|
||||||
break;
|
false
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if v {
|
||||||
match res.id_token() {
|
match res.id_token() {
|
||||||
Some(id_token) => {
|
Some(id_token) => {
|
||||||
let params = [("id_token", id_token.to_string()),("state", "refresh".to_string())];
|
let params = [("id_token", id_token.to_string()),("state", "refresh".to_string())];
|
||||||
|
@ -321,6 +324,9 @@ impl ZeroIDC {
|
||||||
println!("no id token?!?");
|
println!("no id token?!?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println!("claims not verified");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("token error: {}", e);
|
println!("token error: {}", e);
|
||||||
|
|
Loading…
Add table
Reference in a new issue