SkillsReviewed · giuseppe-trisciuoglio

Spring Boot JWT Security

Spring Boot JWT Security is a coding-assistant skill for Java developers adding sign-in and access controls to APIs, but several security examples and helper scripts need correction before use. It targets Spring Boot 3.5.x, Spring Security 6.x and JJWT 0.12.6, with references covering token handling, roles, OAuth2 integration and security testing.

Researched 17 Nov 2026

In short.

Spring Boot JWT Security is a reusable coding-assistant guide for Java API developers, but it is reference material rather than secure, ready-to-deploy code. Its strongest feature is broad coverage of authentication and authorization design. Important problems include a validation cache that ignores signatures, incomplete separation of access and refresh tokens, inconsistent configuration examples, destructive temporary-file cleanup and faulty key-generation logic. Compilation, runtime security and performance are unverified.

Researched and written by an AI model and checked by a second AI model. How it works

Covers only plugins/developer-kit-java/skills/spring-boot-security-jwt in giuseppe-trisciuoglio/developer-kit at commit fe73fb33a09ee6562eeec7415a3f9a3bcf795177: SKILL.md, all 17 reference documents, assets/generate-jwt-keys.sh and scripts/test-jwt-setup.sh. The repository-root LICENSE supplies the related licence notice. Other developer-kit components and the contents behind external documentation links are outside this scope. Compilation, script behavior in an actual environment, authentication flows, security guarantees and performance remain unverified.

The overview

What it is

The spring-boot-security-jwt folder belongs to giuseppe-trisciuoglio/developer-kit. Its entry point is SKILL.md, an assistant instruction file with supporting reference documents and two shell utilities. It is not a hosted authentication service or a standalone Java security library.

The original resource is available at [https://github.com/giuseppe-trisciuoglio/developer-kit/tree/main/plugins/developer-kit-java/skills/spring-boot-security-jwt]. The skill describes Spring Boot 3.5.x authentication and authorization using Spring Security 6.x and JJWT, with additional Spring OAuth2 resource-server examples.

Overall assessment

The material is useful as a topic map and a source of patterns for experienced developers supervising a coding assistant. It connects token issuance, request authentication, permissions, persistence, logout and testing rather than treating JWT generation as the whole security design.

It is not suitable for unattended implementation or deployment by copying examples verbatim. Some defects affect authentication guarantees, not merely formatting or missing imports. Descriptions such as complete and production ready should not be interpreted as evidence of a coherent, validated application.

Who it suits

The best fit is a Java backend developer who already understands Spring dependency injection, HTTP APIs, database entities and Spring Security, and wants an assistant to help explore or adapt JWT patterns. The authorization reference is especially relevant when simple roles must expand into permissions, ownership checks or organizational rules.

Beginners can use it to learn the vocabulary and intended flow, but need help distinguishing illustrative code from a secure implementation. Teams needing turnkey identity management, a supported installer or an independently validated authentication component should look beyond this folder.

What it covers

The documents cover access and refresh token issuance, signature and claim validation, Bearer-header and cookie designs, database-backed refresh tokens, rotation, revocation lists and session tracking. Authorization examples include role-based access control, custom permission evaluators, attribute-based policies, temporary grants, IP restrictions and department-level access.

Additional references discuss OAuth2 provider login, token exchange, service-to-service authentication, gateway filtering, service-mesh integration, Spring Security migration, hardening, monitoring and performance tuning. These are example designs, not demonstrated working integrations. The structure document mentions optional LangChain4j analysis, but does not establish an implemented AI security-analysis feature.

Using it

Requirements and dependencies

Application examples assume a Spring Boot project and Maven or Gradle dependency management. The main skill lists Spring Security, the OAuth2 resource-server starter, JJWT API/implementation/Jackson artifacts at 0.12.6 and Spring Security test support. Database-backed examples need user and token repositories; Redis, OAuth2 credentials and other infrastructure depend on the chosen design.

The key utility requires Bash, JDK keytool and OpenSSL. The HTTP test utility requires Bash, curl, jq and an already running application with its expected endpoints; it does not provision that application. A CI example uses JDK 17, but a complete compatibility matrix is not established.

SKILL.md lists Read, Write, Edit, Bash, Glob and Grep as allowed tools. Actual permissions depend on the assistant host. Supported hosts, an assistant-specific installation command and model requirements are not documented in the available files.

How the patterns work

In the custom-filter design, login authenticates credentials and issues a signed JWT. A OncePerRequestFilter extracts the Bearer token, parses it, loads UserDetails and places an authenticated principal in Spring's SecurityContext. SecurityFilterChain rules and method annotations such as @PreAuthorize then control access.

Longer sessions use server-side refresh-token records, while revocation lists aim to invalidate tokens before their expiry. This means stateless request authentication does not eliminate database or cache state. An alternative design delegates JWT decoding to Spring Security's OAuth2 resource-server facilities. The documents present overlapping approaches that must be reconciled rather than enabled indiscriminately.

Getting started carefully

Obtain the whole skill folder from its original repository, retaining the references and relative paths rather than copying only SKILL.md. How to register that folder with a particular coding assistant is unknown. For application development, first choose between a custom JJWT authentication path and a Spring OAuth2 resource-server path, then define one consistent token and configuration contract.

The examples need reconciliation before implementation. The quick reference reads jwt.expiration while its YAML defines jwt.access-token-expiration. Other references bind expiration values as Duration strings rather than millisecond numbers, and cookie settings appear in both flat and nested forms. JJWT parser styles, entity fields, service methods and authority-claim names also vary. Remove fallback secrets and demonstration accounts, and do not run the helper scripts unchanged.

An example use

A suitable adaptation exercise is an orders API with authentication, refresh and logout endpoints under /api/auth, authenticated access to /api/orders and administrator-only access to /api/admin/users. The skill supplies patterns for short-lived access tokens, longer-lived refresh records and @PreAuthorize role checks.

Use those patterns to specify expected behavior before generating application code: unauthenticated requests are rejected, ordinary users cannot access administrator operations, refresh tokens cannot authenticate API requests, and a rotated refresh token cannot be reused. These are implementation and test targets, not observed results from this resource.

Assessment & evidence

Important limitations and hazards

The performance reference contains a serious validation-cache defect: CachingJwtDecoder keys entries using only the JWT header and payload, excluding the signature. A cache hit can therefore return a previously verified token object for an input with a different signature without calling the underlying decoder. Hits also do not visibly recheck expiry or revocation. Its payload-only parsing helper likewise must not be treated as authentication.

The complete-configuration guide builds access and refresh tokens through the same signing method without a token-type distinction, while its request-validation path checks subject and expiry after parsing. That path does not explicitly exclude refresh tokens from API authentication. Separately, the Redis blacklist example returns false after lookup exceptions, meaning revocation checks fail open when the store cannot be checked.

Cookie and claim-validation advice is inconsistent. Some security chains disable CSRF globally while cookie-based authentication is also promoted, and configuration examples disable audience validation despite the main skill requiring it. HttpOnly prevents JavaScript from reading a cookie; it does not make an application immune to XSS or remove the need to assess CSRF.

The HTTP test script registers users and performs login, refresh and logout operations against its target. Its exit trap runs rm -f /tmp/*.json, which can delete unrelated JSON files. Authentication responses are written to predictable temporary filenames without explicit restrictive permissions. Some failures only print messages, so completion does not reliably establish success.

The key-generation utility exports a certificate with keytool -rfc, producing PEM, but then asks OpenSSL to read it as DER. Its JWK n value is derived from an encoded whole public key rather than the RSA modulus. It also defaults passwords to changeit and writes password values into a properties file. These source-level problems need correction before relying on its output.

How to interpret its assurances

Breadth of coverage does not establish enforcement. One MockMvc suite disables filters with addFilters = false while including endpoint-protection tests. Method-security examples also instantiate services through Mockito rather than demonstrating calls through Spring's method-security proxies. Those arrangements cannot by themselves demonstrate that the real security chain and method interceptors work.

Tests and utilities do not consistently isolate the condition being checked. A hardcoded expired token may be rejected because its signature is untrusted, and samples disagree on expected 401 versus 403 responses and 200 versus 204 logout responses. Performance numbers are assertion thresholds, not recorded benchmark results. The testing material is best treated as a list of scenarios to redesign around one actual application.

Other approaches to consider

The folder itself presents a narrower Spring Security OAuth2 resource-server design using issuer-based JWT decoding. This is worth considering when a trusted external issuer already creates tokens, instead of maintaining a parallel custom JJWT filter. That design does not itself provide registration, password management or refresh-token storage.

For framework and API details, the resource links Spring Security's resource-server documentation [https://docs.spring.io/spring-security/reference/servlet/oauth2/resource-server/index.html] and JJWT documentation [https://github.com/jwtk/jjwt]. These are primary references to consult when reconciling examples; their current contents and alternative products are not assessed here.

What the source establishes

SKILL.md establishes the intended assistant behavior and target technologies. The reference documents supply Java, configuration and test examples; the shell files establish what the utilities would attempt; the root LICENSE establishes reuse permissions. These materials support analysis of documented designs and visible code defects.

They do not establish a successful build, passing test suite, working deployment, independent security audit or measured performance. The structure document mentions a README that is not present among the available folder files. Troubleshooting and health-check examples describe intended diagnostics, not proof that the application or skill is secure.

Access & freshness

Costs

The MIT notice grants permission free of charge, but the documents do not establish an end-to-end operating cost or a hosted-service price. Coding-assistant usage, application hosting, databases, optional Redis, identity providers and secret-management services may have separate costs; their amounts are unknown. The folder itself does not supply hosted authentication infrastructure.

Licence and reuse

The repository LICENSE is MIT, copyright 2025 Giuseppe Trisciuoglio. It permits use, copying, modification, publication, distribution, sublicensing and sale of the software and associated documentation, provided the copyright and permission notices accompany copies or substantial portions. It provides no warranty. These terms do not establish the licences or service terms of external dependencies and providers.

Version and currency limits

These findings apply to source commit fe73fb33a09ee6562eeec7415a3f9a3bcf795177, not an assumed current main branch. The declared target is Spring Boot 3.5.x, Spring Security 6.x and JJWT 0.12.6, while other references include Spring Security 6.3.0/6.3.1 and Nimbus JOSE+JWT 9.37.3 examples. Their compatibility as one dependency set is unverified. The commit's authoring date, later changes and current dependency suitability are unknown.

Recommended next steps

Use the skill to plan and review a design before asking an assistant to implement it. Choose one authentication architecture, align dependencies and configuration bindings, and define the subject, authority and token-type claims consistently. Remove the signature-insensitive cache, require the intended issuer and audience, separate access and refresh validation, and decide explicitly how cookie CSRF protection and revocation-store failures should behave.

Do not run the helper scripts unchanged. Replace wildcard temporary-file deletion with securely scoped per-run files, correct certificate and JWK generation, and ensure failures propagate reliably. Use only an isolated development application for HTTP exercises. Add tests through the real security chain for signature changes, expiration with the trusted signing key, incorrect claims, refresh-token misuse, concurrent rotation and logout revocation. Restrict diagnostic logging so token contents and personal data are not exposed.

Evidence for this report

LICENSEnotice · checked 2026-11-17