The java-spring-security-oauth2-resourceserver-plugin is a plugin to enable and configure Spring Security OAuth2 Resource Server in Spring Boot Java applications.
Applying this plugin into a Spring Boot project will prepare and configure it for all those features:
- Enables and configures Spring Security OAuth2 Resource Server;
- Configures an instance of
WebSecurityConfigurerAdapter
following good practices for REST API applications; - Configures access rules for both Spring Actuator and OpenAPI endpoints;
- Configures an error handler for Spring Security exceptions using the Problem-Spring-Web library;
- Generates production and test sample code so that you have a starting point for writing good integration tests for REST API protected by OAuth2 protocol;
- Configures Docker Compose with Keycloak Authorization Server so that you can run your application locally;
The following steps show how to apply the plugin to an existing Java Spring Boot application.
- First, import our stack if you haven't done it yet:
stk import stack https://github.com/zup-academy/java-springboot-restapi-stack
- Now, in the project directory, apply the plugin and answer all the questions:
stk apply plugin java-springboot-restapi-stack/java-spring-security-oauth2-resourceserver-plugin
- Still inside the project directory, you can verify whether the plugin was applied or not by checking the updated and created files:
git status
Nice! You're ready for production I guess š„³
See here the benefits and how to use the Java Spring Security OAuth2 Resource Server Plugin
If you need any help, please open an issue on Plugin's Github repository.