ext {
problemVersion = '0.27.1'
logstashLogbackVersion = '7.2'
- springCloudWiremockVersion = '4.0.3'
+ springCloudWiremockVersion = '4.1.5'
micrometerVersion = '1.0.0'
liquibaseCoreVersion = '4.31.0'
}
@Bean
public SecurityWebFilterChain springSecurityWebFilterChain(ServerHttpSecurity http) {
- return http.httpBasic().disable()
- .formLogin().disable()
- .csrf().disable()
- .cors()
- .and()
- .authorizeExchange()
- .pathMatchers(HttpMethod.GET, "/actuator/**").permitAll()
- .anyExchange().authenticated()
- .and()
- .oauth2ResourceServer(ServerHttpSecurity.OAuth2ResourceServerSpec::jwt)
- .build();
+ return http.httpBasic(basic -> basic.disable()
+ .formLogin(login -> login.disable()
+ .csrf(csrf -> csrf.disable()
+ .cors())))
+ .authorizeExchange(exchange -> exchange
+ .pathMatchers(HttpMethod.GET, "/actuator/**").permitAll()
+ .anyExchange().authenticated())
+ .oauth2ResourceServer(ServerHttpSecurity.OAuth2ResourceServerSpec::jwt)
+ .build();
}
}
WireMock.stubFor(
WireMock.get(
WireMock.urlMatching(
- String.format("/realms/%s/protocol/openid-connect/certs", realm)))
+ "/realms/%s/protocol/openid-connect/certs".formatted(realm)))
.willReturn(
WireMock.aResponse()
.withHeader("Content-Type", JWKSet.MIME_TYPE)
WireMock.stubFor(
WireMock.post(
WireMock.urlMatching(
- String.format("/realms/%s/protocol/openid-connect/token", realm)))
+ "/realms/%s/protocol/openid-connect/token".formatted(realm)))
.withBasicAuth("test", "test")
.withRequestBody(WireMock.containing("grant_type=client_credentials"))
.willReturn(
@Builder.Default private final List<String> roles = Collections.emptyList();
public String issuer() {
- return String.format("http://localhost:%d/realms/%s", port, realm);
+ return "http://localhost:%d/realms/%s".formatted(port, realm);
}
}
}
@Test
void thatUserPreferencesCanBeSaved() {
Preferences expectedResponse = new Preferences()
- .properties("{\n" +
- " \"properties\": { \"appStarter\": \"value1\",\n" +
- " \"dashboard\": {\"key1:\" : \"value2\"}\n" +
- " } \n" +
- "}");
+ .properties("""
+ {
+ "properties": { "appStarter": "value1",
+ "dashboard": {"key1:" : "value2"}
+ }\s
+ }\
+ """);
Preferences actualResponse = requestSpecification()
.given()
.accept(MediaType.APPLICATION_JSON_VALUE)
void thatUserPreferencesCanBeUpdated() {
// First save a user preference before a GET can run
Preferences initialPreferences = new Preferences()
- .properties("{\n" +
- " \"properties\": { \"appStarter\": \"value1\",\n" +
- " \"dashboard\": {\"key1:\" : \"value2\"}\n" +
- " } \n" +
- "}");
+ .properties("""
+ {
+ "properties": { "appStarter": "value1",
+ "dashboard": {"key1:" : "value2"}
+ }\s
+ }\
+ """);
preferencesService
.savePreferences(X_REQUEST_ID,"test-user", initialPreferences)
.block();
Preferences expectedResponse = new Preferences()
- .properties("{\n" +
- " \"properties\": { \"appStarter\": \"value3\",\n" +
- " \"dashboard\": {\"key2:\" : \"value4\"}\n" +
- " } \n" +
- "}");
+ .properties("""
+ {
+ "properties": { "appStarter": "value3",
+ "dashboard": {"key2:" : "value4"}
+ }\s
+ }\
+ """);
Preferences actualResponse = requestSpecification("test-user")
.given()
.accept(MediaType.APPLICATION_JSON_VALUE)
dependencies {
compileOnly 'org.openapitools:openapi-generator:7.0.0-beta'
- compileOnly 'org.springframework.boot:spring-boot-starter-webflux:3.1.2'
+ compileOnly 'org.springframework.boot:spring-boot-starter-webflux:3.3.10'
compileOnly 'jakarta.validation:jakarta.validation-api:3.0.2'
constraints {
}
}
}
+tasks.withType(Test).configureEach {
+ useJUnitPlatform()
+}
pluginManagement {
// https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management
plugins {
- id 'io.spring.dependency-management' version '1.1.2'
- id 'org.springframework.boot' version '3.1.2'
+ id 'io.spring.dependency-management' version '1.1.7'
+ id 'org.springframework.boot' version '3.3.10'
id 'com.github.hierynomus.license' version '0.16.1'
id 'com.gorylenko.gradle-git-properties' version '2.4.1'
id 'org.openapi.generator' version '7.0.0-beta'