diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfiguration.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfiguration.java index 02abc54..a91bc88 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfiguration.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfiguration.java @@ -62,7 +62,7 @@ public final class OidcProviderConfiguration implements OidcProviderMetadataClai * * @return the {@link Builder} */ - public static Builder withClaims() { + public static Builder builder() { return new Builder(); } diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java index 360d41d..cd51b3c 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/jwt/JwtClaimsSet.java @@ -59,7 +59,7 @@ public final class JwtClaimsSet implements JwtClaimAccessor { * * @return the {@link Builder} */ - public static Builder withClaims() { + public static Builder builder() { return new Builder(); } diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenIssuerUtil.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenIssuerUtil.java index f3bf3fb..603fc98 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenIssuerUtil.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenIssuerUtil.java @@ -48,7 +48,7 @@ class OAuth2TokenIssuerUtil { Instant issuedAt = Instant.now(); Instant expiresAt = issuedAt.plus(1, ChronoUnit.HOURS); // TODO Allow configuration for access token time-to-live - JwtClaimsSet jwtClaimsSet = JwtClaimsSet.withClaims() + JwtClaimsSet jwtClaimsSet = JwtClaimsSet.builder() .issuer(issuer) .subject(subject) .audience(Collections.singletonList(audience)) diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OidcProviderConfigurationEndpointFilter.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OidcProviderConfigurationEndpointFilter.java index 92a90da..ee699c8 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OidcProviderConfigurationEndpointFilter.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/OidcProviderConfigurationEndpointFilter.java @@ -74,7 +74,7 @@ public class OidcProviderConfigurationEndpointFilter extends OncePerRequestFilte return; } - OidcProviderConfiguration providerConfiguration = OidcProviderConfiguration.withClaims() + OidcProviderConfiguration providerConfiguration = OidcProviderConfiguration.builder() .issuer(this.providerSettings.issuer()) .authorizationEndpoint(asUrl(this.providerSettings.issuer(), this.providerSettings.authorizationEndpoint())) .tokenEndpoint(asUrl(this.providerSettings.issuer(), this.providerSettings.tokenEndpoint())) diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfigurationTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfigurationTests.java index 45ce178..8ea9f28 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfigurationTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/OidcProviderConfigurationTests.java @@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; */ public class OidcProviderConfigurationTests { private final OidcProviderConfiguration.Builder minimalConfigurationBuilder = - OidcProviderConfiguration.withClaims() + OidcProviderConfiguration.builder() .issuer("https://example.com/issuer1") .authorizationEndpoint("https://example.com/issuer1/oauth2/authorize") .tokenEndpoint("https://example.com/issuer1/oauth2/token") @@ -45,7 +45,7 @@ public class OidcProviderConfigurationTests { @Test public void buildWhenAllRequiredClaimsAndAdditionalClaimsThenCreated() { - OidcProviderConfiguration providerConfiguration = OidcProviderConfiguration.withClaims() + OidcProviderConfiguration providerConfiguration = OidcProviderConfiguration.builder() .issuer("https://example.com/issuer1") .authorizationEndpoint("https://example.com/issuer1/oauth2/authorize") .tokenEndpoint("https://example.com/issuer1/oauth2/token") @@ -73,7 +73,7 @@ public class OidcProviderConfigurationTests { @Test public void buildWhenOnlyRequiredClaimsThenCreated() { - OidcProviderConfiguration providerConfiguration = OidcProviderConfiguration.withClaims() + OidcProviderConfiguration providerConfiguration = OidcProviderConfiguration.builder() .issuer("https://example.com/issuer1") .authorizationEndpoint("https://example.com/issuer1/oauth2/authorize") .tokenEndpoint("https://example.com/issuer1/oauth2/token") @@ -409,14 +409,14 @@ public class OidcProviderConfigurationTests { @Test public void claimWhenNameIsNullThenThrowIllegalArgumentException() { - assertThatThrownBy(() -> OidcProviderConfiguration.withClaims().claim(null, "value")) + assertThatThrownBy(() -> OidcProviderConfiguration.builder().claim(null, "value")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("name cannot be empty"); } @Test public void claimWhenValueIsNullThenThrowIllegalArgumentException() { - assertThatThrownBy(() -> OidcProviderConfiguration.withClaims().claim("claim-name", null)) + assertThatThrownBy(() -> OidcProviderConfiguration.builder().claim("claim-name", null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("value cannot be null"); } diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcProviderConfigurationHttpMessageConverterTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcProviderConfigurationHttpMessageConverterTests.java index 2b41f9e..37b4284 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcProviderConfigurationHttpMessageConverterTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/core/oidc/http/converter/OidcProviderConfigurationHttpMessageConverterTests.java @@ -145,7 +145,7 @@ public class OidcProviderConfigurationHttpMessageConverterTests { @Test public void writeInternalWhenProviderConfigurationThenSuccess() { OidcProviderConfiguration providerConfiguration = - OidcProviderConfiguration.withClaims() + OidcProviderConfiguration.builder() .issuer("https://example.com/issuer1") .authorizationEndpoint("https://example.com/issuer1/oauth2/authorize") .tokenEndpoint("https://example.com/issuer1/oauth2/token") @@ -187,7 +187,7 @@ public class OidcProviderConfigurationHttpMessageConverterTests { this.messageConverter.setProviderConfigurationParametersConverter(failingConverter); OidcProviderConfiguration providerConfiguration = - OidcProviderConfiguration.withClaims() + OidcProviderConfiguration.builder() .issuer("https://example.com/issuer1") .authorizationEndpoint("https://example.com/issuer1/oauth2/authorize") .tokenEndpoint("https://example.com/issuer1/oauth2/token") diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimsSetTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimsSetTests.java index 2f23fe6..4319ac1 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimsSetTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/JwtClaimsSetTests.java @@ -29,7 +29,7 @@ public class JwtClaimsSetTests { @Test public void buildWhenClaimsEmptyThenThrowIllegalArgumentException() { - assertThatThrownBy(() -> JwtClaimsSet.withClaims().build()) + assertThatThrownBy(() -> JwtClaimsSet.builder().build()) .isInstanceOf(IllegalArgumentException.class) .hasMessage("claims cannot be empty"); } @@ -38,7 +38,7 @@ public class JwtClaimsSetTests { public void buildWhenAllClaimsProvidedThenAllClaimsAreSet() { JwtClaimsSet expectedJwtClaimsSet = TestJwtClaimsSets.jwtClaimsSet().build(); - JwtClaimsSet jwtClaimsSet = JwtClaimsSet.withClaims() + JwtClaimsSet jwtClaimsSet = JwtClaimsSet.builder() .issuer(expectedJwtClaimsSet.getIssuer().toExternalForm()) .subject(expectedJwtClaimsSet.getSubject()) .audience(expectedJwtClaimsSet.getAudience()) @@ -76,14 +76,14 @@ public class JwtClaimsSetTests { @Test public void claimWhenNameNullThenThrowIllegalArgumentException() { - assertThatThrownBy(() -> JwtClaimsSet.withClaims().claim(null, "value")) + assertThatThrownBy(() -> JwtClaimsSet.builder().claim(null, "value")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("name cannot be empty"); } @Test public void claimWhenValueNullThenThrowIllegalArgumentException() { - assertThatThrownBy(() -> JwtClaimsSet.withClaims().claim("name", null)) + assertThatThrownBy(() -> JwtClaimsSet.builder().claim("name", null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("value cannot be null"); } diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/TestJwtClaimsSets.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/TestJwtClaimsSets.java index 16a425c..51b994c 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/TestJwtClaimsSets.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/jwt/TestJwtClaimsSets.java @@ -30,7 +30,7 @@ public class TestJwtClaimsSets { Instant issuedAt = Instant.now(); Instant expiresAt = issuedAt.plus(1, ChronoUnit.HOURS); - return JwtClaimsSet.withClaims() + return JwtClaimsSet.builder() .issuer(issuer) .subject("subject") .audience(Collections.singletonList("client-1"))