This Spring Boot project shows an example configuration of Spring Security and OpenAPI that ensures that only authenticated users can call endpoints available through Swagger UI:
- JDK 13+
- Maven (or you can use mvnw provided in the project)
First, clone this repository.
Then, build it locally with:
mvn clean install
You can run the app in a command line with:
mvn spring-boot:run
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI specification: http://localhost:8080/v3/api-docs
- username:
spring
- password:
spring
- Spring Security
- Basic Authentication in Swagger UI
- OpenAPI 3 specification