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 Mar 9, 2023
1 parent 0db8ad1 commit 320b5d8
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 @@ -800,7 +800,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 @@ -825,8 +825,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 @@ -849,7 +847,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 @@ -889,9 +887,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 @@ -977,7 +977,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 320b5d8

Please sign in to comment.