Every time I started a new Spring Boot project, I found myself writing the same JWT authentication setup over and over again. Configure Spring Security, set up token generation, validation, blacklisting.
So, I built JWT Spring Boot Starter to handle it automatically.
What It Does
This starter takes care of JWT authentication so you don’t have to. Just add the dependency, configure a few properties, and voila—you’re ready to go.
Token Generation & Validation: Automatically creates and verifies JWT tokens.
Token Blacklisting: Easily invalidate tokens with a built-in (and optionally replaceable) in-memory blacklist.
Custom Claims & Token Refresh: Supports adding custom claims and automatic token refresh logic.
Quick Start Guide
First, add the dependency in your pom.xml:
<dependency>
<groupId>io.github.seydoucisse</groupId>
<artifactId>jwt-spring-boot-starter</artifactId>
<version>0.1.0</version>
</dependency>
Then, configure your application.yml:
jwt:
secret: your-very-secure-secret-key-that-is-64-characters
issuer: your-app-name
And finally, define your UserDetailsService:
@Service
public class MyUserDetailsService implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
// Add with your user lookup logic
}
}
That’s it! The starter handles token generation, validation, blacklisting, and integrates seamlessly with Spring Security.
Why Use It?
- No need to write JWT auth from scratch
- Works out of the box with Spring Security
- Customizable token properties and security settings
- Supports token blacklisting and refresh tokens
If you’re tired of rewriting the same jwt-based authentication in your Spring Boot app, give JWT Spring Boot Starter a shot!
Check it out the full documentation on jwt-spring-boot-starter.
Feel free to open an issue or submit a pull request.
Top comments (0)