Skip to content

Commit

Permalink
Don't set empty JWK signing algorithms in Client::new (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlaltf24 authored and ramosbugs committed Mar 9, 2023
1 parent a0434bb commit 8e550ab
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ where
issuer: IssuerUrl,
userinfo_endpoint: Option<UserInfoUrl>,
jwks: JsonWebKeySet<JS, JT, JU, K>,
id_token_signing_algs: Vec<JS>,
id_token_signing_algs: Option<Vec<JS>>,
use_openid_scope: bool,
_phantom: PhantomData<(AC, AD, GC, JE, P)>,
}
Expand All @@ -828,8 +828,6 @@ where
{
///
/// Initializes an OpenID Connect client.
/// If you need to configure the algorithms used for signing, ...,
/// do this directly on the respected components. (e.g. IdTokenVerifier)
///
pub fn new(
client_id: ClientId,
Expand All @@ -852,7 +850,7 @@ where
issuer,
userinfo_endpoint,
jwks,
id_token_signing_algs: vec![],
id_token_signing_algs: None,
use_openid_scope: true,
_phantom: PhantomData,
}
Expand Down Expand Up @@ -892,9 +890,11 @@ where
issuer: provider_metadata.issuer().clone(),
userinfo_endpoint: provider_metadata.userinfo_endpoint().cloned(),
jwks: provider_metadata.jwks().to_owned(),
id_token_signing_algs: provider_metadata
.id_token_signing_alg_values_supported()
.to_owned(),
id_token_signing_algs: Some(
provider_metadata
.id_token_signing_alg_values_supported()
.to_owned(),
),
use_openid_scope: true,
_phantom: PhantomData,
}
Expand Down Expand Up @@ -980,7 +980,11 @@ where
)
};

verifier.set_allowed_algs(self.id_token_signing_algs.clone())
if let Some(id_token_signing_algs) = self.id_token_signing_algs.clone() {
verifier.set_allowed_algs(id_token_signing_algs)
} else {
verifier
}
}

///
Expand Down

0 comments on commit 8e550ab

Please sign in to comment.