JWT authentication and authorization for Spring Boot 3.5.x with token generation, refresh strategies, and role/permission-based access control.
Works with
Covers token generation with JJWT, Bearer/cookie authentication, and stateless session management using Spring Security 6.x
Supports database-backed and OAuth2 provider integration (Google, GitHub) with modern SecurityFilterChain configuration
Includes refresh token rotation, token blacklisting, and key rotation strategies for production secu
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionspring-boot-security-jwtExecute the skills CLI command in your project's root directory to begin installation:
Fetches spring-boot-security-jwt from giuseppe-trisciuoglio/developer-kit and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate spring-boot-security-jwt. Access via /spring-boot-security-jwt in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
0
total installs
0
this week
194
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
194
stars
JWT authentication and authorization patterns for Spring Boot 3.5.x using Spring Security 6.x and JJWT. Covers token generation, validation, refresh strategies, RBAC/ABAC, and OAuth2 integration.
This skill provides implementation patterns for stateless JWT authentication in Spring Boot applications. It covers the complete authentication flow including token generation with JJWT 0.12.6, Bearer/cookie-based authentication, refresh token rotation, and method-level authorization with @PreAuthorize expressions.
Key capabilities:
@PreAuthorize rulesActivate when user requests involve:
`@PreAuthorize`| Artifact | Scope |
|---|---|
spring-boot-starter-security |
compile |
spring-boot-starter-oauth2-resource-server |
compile |
io.jsonwebtoken:jjwt-api:0.12.6 |
compile |
io.jsonwebtoken:jjwt-impl:0.12.6 |
runtime |
io.jsonwebtoken:jjwt-jackson:0.12.6 |
runtime |
spring-security-test |
test |
See references/jwt-quick-reference.md for Maven and Gradle snippets.
| Property | Example Value | Notes |
|---|---|---|
jwt.secret |
${JWT_SECRET} |
Min 256 bits, never hardcode |
jwt.access-token-expiration |
900000 |
15 min in milliseconds |
jwt.refresh-token-expiration |
604800000 |
7 days in milliseconds |
jwt.issuer |
my-app |
Validated on every token |
jwt.cookie-name |
jwt-token |
For cookie-based auth |
jwt.cookie-http-only |
true |
Always true in production |
jwt.cookie-secure |
true |
Always true with HTTPS |
| Annotation | Example |
|---|---|
@PreAuthorize("hasRole('ADMIN')") |
Role check |
@PreAuthorize("hasAuthority('USER_READ')") |
Permission check |
@PreAuthorize("hasPermission(#id, 'Doc', 'READ')") |
Domain object check |
@PreAuthorize("@myService.canAccess(#id)") |
Spring bean check |
Include spring-boot-starter-security, spring-boot-starter-oauth2-resource-server, and the three JJWT artifacts in your build file. See references/jwt-quick-reference.md for exact Maven/Gradle snippets.
jwt:
secret: ${JWT_SECRET:change-me-min-32-chars-in-production}
access-token-expiration: 900000
refresh-token-expiration: 604800000
issuer: my-app
cookie-name: jwt-token
cookie-http-only: true
cookie-secure: false # true in production
See references/jwt-complete-configuration.md for the full properties reference.
Core operations: generate access token, generate refresh token, extract username, validate token.
@Service
public class JwtService {
public String generateAccessToken(UserDetails userDetails) {
return Jwts.builder()
.subject(userDetails.getUsername())
.issuer(issuer)
.issuedAt(new Date())
.expiration(new Date(System.currentTimeMillis() + accessTokenExpiration))
.claim("authorities", getAuthorities(userDetails))
.signWith(getSigningKey())
.compact();
}
public boolean isTokenValid(String token, UserDetails userDetails) {
try {
String username = extractUsername(token);
return username.equals(userDetails.getUsername()) && !isTokenExpired(token);
} catch (JwtException e) {
return false;
}
}
}
See references/jwt-complete-configuration.md for the complete JwtService including key management and claim extraction.
Extend OncePerRequestFilter to extract a JWT from the Authorization: Bearer header (or HttpOnly cookie), validate it, and set the SecurityContext.
@Component
public class JwtAuthenticationFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
String authHeader = request.getHeader("Authorization");
if (authHeader == null || !authHeader.startsWith("Bearer ")) {
chain.doFilter(request, response);
return;
}
String jwt = authHeader.substring(7);
String username = jwtService.extractUsername(jwt);
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
if (jwtService.isTokenValid(jwt, userDetails)) {
UsernamePasswordAuthenticationToken authToken =
new UsernamePasswordAuthenticationToken(
userDetails, null, userDetails.getAuthorities());
authToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(authToken);
}
}
chain.doFilter(request, response);
}
}
See references/configuration.md for the cookie-based variant.
@Configuration
@EnableWebSecurity
@EnableMethodSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http
.csrf(AbstractHttpConfigurer::disable)
.sessionManagement(s -> s.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.Make data-driven prioritization decisions faster
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Prerequisites
Time Estimate
30-60 minutes to see productivity improvements
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid when
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
shadcn/improve
mattpocock/skills
parcadei/continuous-claude-v3
cursor/plugins
ailabs-393/ai-labs-claude-skills
pproenca/dot-skills
spring-boot-security-jwt has been reliable in day-to-day use. Documentation quality is above average for community skills.
spring-boot-security-jwt is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
spring-boot-security-jwt reduced setup friction for our internal harness; good balance of opinion and flexibility.
Solid pick for teams standardizing on skills: spring-boot-security-jwt is focused, and the summary matches what you get after install.
Registry listing for spring-boot-security-jwt matched our evaluation — installs cleanly and behaves as described in the markdown.
Keeps context tight: spring-boot-security-jwt is the kind of skill you can hand to a new teammate without a long onboarding doc.
Useful defaults in spring-boot-security-jwt — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Useful defaults in spring-boot-security-jwt — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Registry listing for spring-boot-security-jwt matched our evaluation — installs cleanly and behaves as described in the markdown.
spring-boot-security-jwt fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
showing 1-10 of 75