a little cleanup

This commit is contained in:
Grant Limberg 2022-01-03 08:36:16 -08:00
parent 057356a725
commit cf411efd1d
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A

View file

@ -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);