feat: Enable access to OpenAPI spec and Swagger UI
This commit is contained in:
parent
c462614d8d
commit
5dde208e72
2 changed files with 27 additions and 1 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -40,3 +40,6 @@ out/
|
|||
### Test files ###
|
||||
sqLiteDb.db
|
||||
dev/
|
||||
|
||||
### Development settings ###
|
||||
application.properties
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue