Skip to content

Commit

Permalink
Fix bug related to jwks url (#17)
Browse files Browse the repository at this point in the history
These properties should not have been renamed, since the url is exposed
on the jwks_uri property according OIDC specification.
  • Loading branch information
Dunklas authored Oct 29, 2024
1 parent 67bebcc commit bf81bc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tower-oauth2-resource-server/src/oidc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::error::StartupError;

#[derive(Clone, Debug, Deserialize)]
pub(crate) struct OidcConfig {
pub jwks_url: Url,
pub jwks_uri: Url,
pub claims_supported: Option<Vec<String>>,
}

Expand Down
4 changes: 2 additions & 2 deletions tower-oauth2-resource-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async fn resolve_config(
claims_spec = claims_spec.nbf(true);
}
}
Ok((oidc_config.jwks_url, claims_spec))
Ok((oidc_config.jwks_uri, claims_spec))
}

#[cfg(test)]
Expand All @@ -146,7 +146,7 @@ mod tests {
ctx.expect()
.returning(|_| {
Ok(OidcConfig {
jwks_url: "http://some-issuer.com/jwks".parse::<Url>().unwrap(),
jwks_uri: "http://some-issuer.com/jwks".parse::<Url>().unwrap(),
claims_supported: None,
})
})
Expand Down
4 changes: 2 additions & 2 deletions tower-oauth2-resource-server/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use wiremock::{
#[derive(Serialize)]
struct OpenIdConfig {
pub issuer: String,
pub jwks_url: String,
pub jwks_uri: String,
}

#[derive(Serialize)]
Expand All @@ -41,7 +41,7 @@ pub async fn mock_oidc_config(mock_server: &MockServer, issuer: &str) {
.and(path("/.well-known/openid-configuration"))
.respond_with(ResponseTemplate::new(200).set_body_json(OpenIdConfig {
issuer: issuer.to_owned(),
jwks_url: format!("{}/jwks", &mock_server.uri()),
jwks_uri: format!("{}/jwks", &mock_server.uri()),
}))
.mount(mock_server)
.await;
Expand Down

0 comments on commit bf81bc3

Please sign in to comment.