Skip to content

Commit 4e4656f

Browse files
committed
Apply consistent naming for jwkSet
Issue gh-143
1 parent eb97e12 commit 4e4656f

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2AuthorizationServerConfigurer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public void configure(B builder) {
221221

222222
JwkSetEndpointFilter jwkSetEndpointFilter = new JwkSetEndpointFilter(
223223
getKeySource(builder),
224-
providerSettings.jwksEndpoint());
224+
providerSettings.jwkSetEndpoint());
225225
builder.addFilterBefore(postProcess(jwkSetEndpointFilter), AbstractPreAuthenticatedProcessingFilter.class);
226226

227227
AuthenticationManager authenticationManager = builder.getSharedObject(AuthenticationManager.class);

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfiguration.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public Builder tokenEndpointAuthenticationMethods(Consumer<List<String>> authent
142142
/**
143143
* Use this {@code jwks_uri} in the resulting {@link OidcProviderConfiguration}, REQUIRED.
144144
*
145-
* @param jwksUri the URL of the OpenID Provider's JSON Web Key Set document
145+
* @param jwkSetUri the URL of the OpenID Provider's JSON Web Key Set document
146146
* @return the {@link Builder} for further configuration
147147
*/
148-
public Builder jwksUri(String jwksUri) {
149-
return claim(OidcProviderMetadataClaimNames.JWKS_URI, jwksUri);
148+
public Builder jwkSetUri(String jwkSetUri) {
149+
return claim(OidcProviderMetadataClaimNames.JWKS_URI, jwkSetUri);
150150
}
151151

152152
/**

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettings.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ProviderSettings extends Settings {
3030
public static final String ISSUER = PROVIDER_SETTING_BASE.concat("issuer");
3131
public static final String AUTHORIZATION_ENDPOINT = PROVIDER_SETTING_BASE.concat("authorization-endpoint");
3232
public static final String TOKEN_ENDPOINT = PROVIDER_SETTING_BASE.concat("token-endpoint");
33-
public static final String JWKS_ENDPOINT = PROVIDER_SETTING_BASE.concat("jwks-endpoint");
33+
public static final String JWK_SET_ENDPOINT = PROVIDER_SETTING_BASE.concat("jwk-set-endpoint");
3434
public static final String TOKEN_REVOCATION_ENDPOINT = PROVIDER_SETTING_BASE.concat("token-revocation-endpoint");
3535

3636
/**
@@ -111,18 +111,18 @@ public ProviderSettings tokenEndpoint(String tokenEndpoint) {
111111
*
112112
* @return the JWK Set endpoint
113113
*/
114-
public String jwksEndpoint() {
115-
return setting(JWKS_ENDPOINT);
114+
public String jwkSetEndpoint() {
115+
return setting(JWK_SET_ENDPOINT);
116116
}
117117

118118
/**
119119
* Sets the Provider's JWK Set endpoint.
120120
*
121-
* @param jwksEndpoint the JWK Set endpoint
121+
* @param jwkSetEndpoint the JWK Set endpoint
122122
* @return the {@link ProviderSettings} for further configuration
123123
*/
124-
public ProviderSettings jwksEndpoint(String jwksEndpoint) {
125-
return setting(JWKS_ENDPOINT, jwksEndpoint);
124+
public ProviderSettings jwkSetEndpoint(String jwkSetEndpoint) {
125+
return setting(JWK_SET_ENDPOINT, jwkSetEndpoint);
126126
}
127127

128128
/**
@@ -148,7 +148,7 @@ protected static Map<String, Object> defaultSettings() {
148148
Map<String, Object> settings = new HashMap<>();
149149
settings.put(AUTHORIZATION_ENDPOINT, "/oauth2/authorize");
150150
settings.put(TOKEN_ENDPOINT, "/oauth2/token");
151-
settings.put(JWKS_ENDPOINT, "/oauth2/jwks");
151+
settings.put(JWK_SET_ENDPOINT, "/oauth2/jwks");
152152
settings.put(TOKEN_REVOCATION_ENDPOINT, "/oauth2/revoke");
153153
return settings;
154154
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OidcProviderConfigurationEndpointFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
8080
.tokenEndpoint(asUrl(this.providerSettings.issuer(), this.providerSettings.tokenEndpoint()))
8181
.tokenEndpointAuthenticationMethod("client_secret_basic") // TODO: Use ClientAuthenticationMethod.CLIENT_SECRET_BASIC in Spring Security 5.5.0
8282
.tokenEndpointAuthenticationMethod("client_secret_post") // TODO: Use ClientAuthenticationMethod.CLIENT_SECRET_POST in Spring Security 5.5.0
83-
.jwksUri(asUrl(this.providerSettings.issuer(), this.providerSettings.jwksEndpoint()))
83+
.jwkSetUri(asUrl(this.providerSettings.issuer(), this.providerSettings.jwkSetEndpoint()))
8484
.responseType(OAuth2AuthorizationResponseType.CODE.getValue())
8585
.grantType(AuthorizationGrantType.AUTHORIZATION_CODE.getValue())
8686
.grantType(AuthorizationGrantType.CLIENT_CREDENTIALS.getValue())

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfigurationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class OidcProviderConfigurationTests {
3838
.issuer("https://example.com/issuer1")
3939
.authorizationEndpoint("https://example.com/issuer1/oauth2/authorize")
4040
.tokenEndpoint("https://example.com/issuer1/oauth2/token")
41-
.jwksUri("https://example.com/issuer1/oauth2/jwks")
41+
.jwkSetUri("https://example.com/issuer1/oauth2/jwks")
4242
.scope("openid")
4343
.responseType("code")
4444
.subjectType("public");
@@ -49,7 +49,7 @@ public void buildWhenAllRequiredClaimsAndAdditionalClaimsThenCreated() {
4949
.issuer("https://example.com/issuer1")
5050
.authorizationEndpoint("https://example.com/issuer1/oauth2/authorize")
5151
.tokenEndpoint("https://example.com/issuer1/oauth2/token")
52-
.jwksUri("https://example.com/issuer1/oauth2/jwks")
52+
.jwkSetUri("https://example.com/issuer1/oauth2/jwks")
5353
.scope("openid")
5454
.responseType("code")
5555
.grantType("authorization_code")
@@ -77,7 +77,7 @@ public void buildWhenOnlyRequiredClaimsThenCreated() {
7777
.issuer("https://example.com/issuer1")
7878
.authorizationEndpoint("https://example.com/issuer1/oauth2/authorize")
7979
.tokenEndpoint("https://example.com/issuer1/oauth2/token")
80-
.jwksUri("https://example.com/issuer1/oauth2/jwks")
80+
.jwkSetUri("https://example.com/issuer1/oauth2/jwks")
8181
.scope("openid")
8282
.responseType("code")
8383
.subjectType("public")

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcProviderConfigurationHttpMessageConverterTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void writeInternalWhenProviderConfigurationThenSuccess() {
149149
.issuer("https://example.com/issuer1")
150150
.authorizationEndpoint("https://example.com/issuer1/oauth2/authorize")
151151
.tokenEndpoint("https://example.com/issuer1/oauth2/token")
152-
.jwksUri("https://example.com/issuer1/oauth2/jwks")
152+
.jwkSetUri("https://example.com/issuer1/oauth2/jwks")
153153
.scope("openid")
154154
.responseType("code")
155155
.grantType("authorization_code")
@@ -191,7 +191,7 @@ public void writeInternalWhenWriteFailsThenThrowsException() {
191191
.issuer("https://example.com/issuer1")
192192
.authorizationEndpoint("https://example.com/issuer1/oauth2/authorize")
193193
.tokenEndpoint("https://example.com/issuer1/oauth2/token")
194-
.jwksUri("https://example.com/issuer1/oauth2/jwks")
194+
.jwkSetUri("https://example.com/issuer1/oauth2/jwks")
195195
.responseType("code")
196196
.subjectType("public")
197197
.build();

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/config/ProviderSettingsTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,29 @@ public void constructorWhenDefaultThenDefaultsAreSet() {
3434
assertThat(providerSettings.issuer()).isNull();
3535
assertThat(providerSettings.authorizationEndpoint()).isEqualTo("/oauth2/authorize");
3636
assertThat(providerSettings.tokenEndpoint()).isEqualTo("/oauth2/token");
37-
assertThat(providerSettings.jwksEndpoint()).isEqualTo("/oauth2/jwks");
37+
assertThat(providerSettings.jwkSetEndpoint()).isEqualTo("/oauth2/jwks");
3838
assertThat(providerSettings.tokenRevocationEndpoint()).isEqualTo("/oauth2/revoke");
3939
}
4040

4141
@Test
4242
public void settingsWhenProvidedThenSet() {
4343
String authorizationEndpoint = "/oauth2/v1/authorize";
4444
String tokenEndpoint = "/oauth2/v1/token";
45-
String jwksEndpoint = "/oauth2/v1/jwks";
45+
String jwkSetEndpoint = "/oauth2/v1/jwks";
4646
String tokenRevocationEndpoint = "/oauth2/v1/revoke";
4747
String issuer = "https://example.com:9000";
4848

4949
ProviderSettings providerSettings = new ProviderSettings()
5050
.issuer(issuer)
5151
.authorizationEndpoint(authorizationEndpoint)
5252
.tokenEndpoint(tokenEndpoint)
53-
.jwksEndpoint(jwksEndpoint)
53+
.jwkSetEndpoint(jwkSetEndpoint)
5454
.tokenRevocationEndpoint(tokenRevocationEndpoint);
5555

5656
assertThat(providerSettings.issuer()).isEqualTo(issuer);
5757
assertThat(providerSettings.authorizationEndpoint()).isEqualTo(authorizationEndpoint);
5858
assertThat(providerSettings.tokenEndpoint()).isEqualTo(tokenEndpoint);
59-
assertThat(providerSettings.jwksEndpoint()).isEqualTo(jwksEndpoint);
59+
assertThat(providerSettings.jwkSetEndpoint()).isEqualTo(jwkSetEndpoint);
6060
assertThat(providerSettings.tokenRevocationEndpoint()).isEqualTo(tokenRevocationEndpoint);
6161
}
6262

@@ -106,7 +106,7 @@ public void tokenRevocationEndpointWhenNullThenThrowIllegalArgumentException() {
106106
@Test
107107
public void jwksEndpointWhenNullThenThrowIllegalArgumentException() {
108108
ProviderSettings settings = new ProviderSettings();
109-
assertThatThrownBy(() -> settings.jwksEndpoint(null))
109+
assertThatThrownBy(() -> settings.jwkSetEndpoint(null))
110110
.isInstanceOf(IllegalArgumentException.class)
111111
.hasMessage("value cannot be null");
112112
}

oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/web/OidcProviderConfigurationEndpointFilterTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ public void doFilterWhenConfigurationRequestPostThenNotProcessed() throws Except
8282
public void doFilterWhenConfigurationRequestThenConfigurationResponse() throws Exception {
8383
String authorizationEndpoint = "/oauth2/v1/authorize";
8484
String tokenEndpoint = "/oauth2/v1/token";
85-
String jwksEndpoint = "/oauth2/v1/jwks";
85+
String jwkSetEndpoint = "/oauth2/v1/jwks";
8686

8787
ProviderSettings providerSettings = new ProviderSettings()
8888
.issuer("https://example.com/issuer1")
8989
.authorizationEndpoint(authorizationEndpoint)
9090
.tokenEndpoint(tokenEndpoint)
91-
.jwksEndpoint(jwksEndpoint);
91+
.jwkSetEndpoint(jwkSetEndpoint);
9292
OidcProviderConfigurationEndpointFilter filter =
9393
new OidcProviderConfigurationEndpointFilter(providerSettings);
9494

0 commit comments

Comments
 (0)