bugfix: permit access to Swagger UI (#134)
Co-authored-by: Michael Hoennig <michael@hoennig.de> Reviewed-on: #134 Reviewed-by: Marc Sandlus <marc.sandlus@hostsharing.net>
This commit is contained in:
parent
a05430a54b
commit
c7b17ee546
@ -17,10 +17,11 @@ public class WebSecurityConfig {
|
|||||||
return http
|
return http
|
||||||
.authorizeHttpRequests(authorize -> authorize
|
.authorizeHttpRequests(authorize -> authorize
|
||||||
.requestMatchers("/api/**").permitAll() // TODO.impl: implement authentication
|
.requestMatchers("/api/**").permitAll() // TODO.impl: implement authentication
|
||||||
|
.requestMatchers("/swagger-ui/**").permitAll()
|
||||||
|
.requestMatchers("/v3/api-docs/**").permitAll()
|
||||||
.requestMatchers("/actuator/**").permitAll()
|
.requestMatchers("/actuator/**").permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,20 @@ class WebSecurityConfigIntegrationTest {
|
|||||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldSupportSwaggerUi() {
|
||||||
|
final var result = this.restTemplate.getForEntity(
|
||||||
|
"http://localhost:" + this.managementPort + "/swagger-ui/index.html", String.class);
|
||||||
|
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldSupportApiDocs() {
|
||||||
|
final var result = this.restTemplate.getForEntity(
|
||||||
|
"http://localhost:" + this.managementPort + "/v3/api-docs/swagger-config", String.class);
|
||||||
|
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); // permitted but not configured
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldSupportHealthEndpoint() {
|
public void shouldSupportHealthEndpoint() {
|
||||||
final var result = this.restTemplate.getForEntity(
|
final var result = this.restTemplate.getForEntity(
|
||||||
|
Loading…
Reference in New Issue
Block a user