feat: Enable access to OpenAPI spec and Swagger UI

This commit is contained in:
Magnus Leßmann (@Mark.TwoFive) 2025-06-19 20:22:41 +02:00
parent c462614d8d
commit 5dde208e72
Signed by: Mark.TwoFive
GPG key ID: 58204042FE30B10C
2 changed files with 27 additions and 1 deletions

5
.gitignore vendored
View file

@ -39,4 +39,7 @@ out/
### Test files ###
sqLiteDb.db
dev/
dev/
### Development settings ###
application.properties

View file

@ -0,0 +1,23 @@
package de.mlessmann.certassist.config;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class SecurityConfiguration {
@Bean
public SecurityFilterChain securityFilters(HttpSecurity http) throws Exception {
// Allow unauthenticated access to OpenAPI and swagger documentation.
// This should be removed or at least configurable at some point, but for now, this is fine (tm)
http.authorizeHttpRequests(auth -> auth
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html")
.permitAll());
return http.build();
}
}