What problem does it solve?
This Skill provides best-practice security configurations for Spring Boot apps using Spring Security 6.x, covering JWT, OAuth2, CORS, CSRF, method-level security, and rate limiting, helping teams implement secure APIs quickly.
Core Features & Use Cases
- SecurityFilterChain configuration for stateless API security with JWT and method security.
- JWT authentication integration with a custom filter and token service.
- OAuth2 and CORS configuration for modern cloud-based apps.
- Password encoding and rate limiting to enforce strong credentials and protect endpoints.
- Secure headers and validation to harden the application and protect data.
Quick Start
Follow these steps to adopt the skill:
- Add a SecurityConfig class implementing a SecurityFilterChain bean and a password encoder (BCrypt with a cost factor of 12+).
- Implement a JwtAuthFilter and a JwtService to issue and validate tokens from your authentication flow.
- Configure basic HTTP security headers (HSTS, CSP) and enable method security annotations in your services.
- Ensure sensitive values (e.g., JWT secret) are loaded from environment variables or a secure vault rather than hard-coded.