Skip to content

Commit 06efe85

Browse files
committed
fix: optimize imports and little code improvements
1 parent c46ebd1 commit 06efe85

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ toml = "0.8"
2424
openssl = "0.10.68"
2525
anyhow = "1.0.95"
2626
rand = "0.8"
27-
url = "2.5.4"
2827

2928
[dependencies.uuid]
3029
version = "1.11.0"

src/authn/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use openssl::{
1616
use rand::Rng;
1717
use std::{fmt::Write, iter};
1818
pub use oauth2::{basic::BasicTokenIntrospectionResponse, TokenIntrospectionResponse};
19-
use url::Url;
19+
use oauth2::url;
2020
use uuid::Uuid;
2121

2222
impl Sdk {
@@ -127,6 +127,9 @@ impl AuthSdk {
127127

128128
let mut validation = Validation::new(header.alg);
129129
validation.set_audience(&[&self.sdk.client_id]);
130+
validation.validate_aud = true;
131+
validation.validate_exp = true;
132+
validation.validate_nbf = true;
130133

131134
let pb_key = self.sdk.replace_cert_to_pub_key().unwrap();
132135

@@ -162,7 +165,7 @@ impl AuthSdk {
162165
let base = format!("{}/login/oauth/authorize", self.sdk.endpoint);
163166
let nonce = Uuid::new_v4();
164167

165-
let signing_url = Url::parse_with_params(
168+
let signing_url = url::Url::parse_with_params(
166169
base.as_str(),
167170
&[
168171
("client_id", self.client_id().as_str()),
@@ -181,7 +184,7 @@ impl AuthSdk {
181184
}
182185

183186
pub async fn logout(&self, id_token: &str, post_logout_redirect_uri: &str, state: &str) -> SdkResult<String> {
184-
let logout_url = Url::parse_with_params(
187+
let logout_url = url::Url::parse_with_params(
185188
self.logout_url("/api/logout".to_string()).as_str(),
186189
&[
187190
("id_token_hint", id_token),

src/sdk/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::fmt::Display;
2-
2+
use oauth2::url;
33
use crate::StatusCode;
44

55
#[derive(Debug)]

0 commit comments

Comments
 (0)