
sa-token-integration
Sa-Token 集成扩展技能。覆盖 JWT 集成(Simple/Mixin/Stateless三种模式对比表)、Redis持久化(JDK序列化/JSON序列化)、Alone-Redis独立Redis(鉴权缓存与业务缓存隔离)、AOP注解鉴权(Service层使用注解)、SpEL表达式注解(@SaCheckEL)、Quick-Login快速登录(零代码登录页)、JSON序列化扩展(Jackson/Fastjson/Fastjson2/Snack3)、模板引擎集成(Thymeleaf/Freemarker标签方言)、RPC集成(Dubbo/Dubbo3/gRPC上下文传播)。 当用户需要集成JWT实现无状态认证、配置Redis分布式会话、缓存隔离、Service层注解鉴权、快速搭建登录页面时使用。 基础登录认证请先使用 sa-token 技能。
- Installs
- 76
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/full-stack-skills/java-skills --skill sa-token-integration- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads sa-token-integration automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Sa-Token 集成扩展
基于 sa-token-doc/plugin/ 集成类文档。
适用场景
当用户需要以下场景时,激活此技能:
- JWT无状态认证 — 将登录信息编码到Token中,减少Redis查询,适合高并发场景
- 分布式Session共享 — 多实例部署时需要共享会话数据
- Redis缓存隔离 — 将Sa-Token的Redis与业务Redis物理分开
- Service层注解鉴权 — 在Service层(非Controller)使用@SaCheckLogin等注解
- 快速搭建登录页面 — 开发环境或内管系统零代码登录页
- 模板引擎鉴权标签 — Thymeleaf/Freemarker页面中控制按钮显隐
Workflow
Step 1. 确定集成需求 — 选择JWT/Redis/AOP/模板等模块 Step 2. 引入依赖 — 添加对应Maven/Gradle依赖 Step 3. 配置参数 — 配置jwt-secret-key/Redis连接/Alone-Redis等 Step 4. 注入实现 — 注入StpLogic、注册过滤器、配置模板引擎 Step 5. 验证测试 — 确认集成生效,测试核心功能是否正常
Capability Boundaries
✅ Strong Suits
- JWT集成 — Simple/Mixin/Stateless三种模式选择
- Redis持久化 — JDK序列化/JSON序列化两种方式
- Alone-Redis独立Redis — 认证缓存与业务缓存物理隔离
- AOP注解鉴权 — 在Service层使用@SaCheckLogin等注解
- SpEL表达式 — @SaCheckEL使用Spring表达式
- Quick-Login快速登录 — 零代码注入登录页面
- JSON序列化扩展 — Jackson/Fastjson/Fastjson2/Snack3/Snack4
- 模板引擎集成 — Thymeleaf/Freemarker自定义标签
- RPC集成 — Dubbo/Dubbo3/gRPC上下文传播
⚠️ Requirements
- JWT需要配置
jwt-secret-key - Redis需要配置
spring.redis连接信息 - AOP注解与拦截器注解不能同时使用
❌ Out of Scope
- 基础登录/权限/注解鉴权 → sa-token
- SSO → sa-token-sso
- OAuth2.0 → sa-token-oauth2
- 微服务鉴权 → sa-token-micro
参考文档
| 主题 | 文件 | 来源 |
|---|---|---|
| JWT三模式(Simple/Mixin/Stateless) | references/jwt-extend.md | GitHub |
| Redis持久化+Alone-Redis | references/dao-extend.md | dao-extend、integ-redis |
FAQ
Q: JWT三种模式怎么选? A: Simple模式推荐(功能完整:踢人、封禁、会话管理都支持)。需要无状态选Stateless(但踢人/封禁不可用)。Mixin介于两者之间。
Q: Redis两种序列化方式选哪个? A: 推荐RedisTemplate JSON序列化(数据可读,方便排查)。JDK序列化兼容性更好但数据是乱码。
Q: Alone-Redis和普通Redis有什么区别? A: Alone-Redis使用独立的Redis连接和数据库,与业务Redis完全隔离,保证认证缓存不受业务影响。
Q: AOP注解鉴权和拦截器鉴权能同时用吗? A: 不能同时使用。AOP用于Service层,拦截器用于Controller层,选择一种即可。
Q: Quick-Login适合生产环境吗? A: 适合小系统或内部管理系统。生产环境建议自定义登录页面。
Q: 模板引擎标签支持哪些功能?
A: 支持 sa:login(登录校验)、sa:hasRole(角色判断)、sa:hasPermission(权限判断)等标签。
Gotchas
- Simple模式
is-share恒等于false — 与Extra数据不兼容,无法共用token - Mixin模式
is-concurrent必须为true — 否则踢人下线API不可用 - JWT集成后Token变为JWT格式 — 不再是uuid格式,内容可解码查看
- Alone-Redis有独立的配置前缀
sa-token-alone-redis— 不是spring.redis - Redis JSON序列化后Session数据在Redis中可读 — 可在Redis客户端中直接查看
- AOP注解和拦截器注解不能混用 — 选了AOP就不能再用拦截器
- Quick-Login默认账号密码 sa/123456 — 生产环境务必修改
- Dubbo集成自动处理上下文传播 — 无需额外代码,引入依赖即可
Data Privacy
本技能不收集、存储或传输任何用户数据。所有代码示例仅供本地开发参考。
FAQ
What does the sa-token-integration skill do?
Sa-Token 集成扩展技能。覆盖 JWT 集成(Simple/Mixin/Stateless三种模式对比表)、Redis持久化(JDK序列化/JSON序列化)、Alone-Redis独立Redis(鉴权缓存与业务缓存隔离)、AOP注解鉴权(Service层使用注解)、SpEL表达式注解(@SaCheckEL)、Quick-Login快速登录(零代码登录页)、JSON序列化扩展(Jackson/Fastjson/Fastjson2/Snack3)、模板引擎集成(Thymeleaf/Freemarker标签方言)、RPC集成(Dubbo/Dubbo3/gRPC上下文传播)。 当用户需要集成JWT实现无状态认证、配置Redis分布式会话、缓存隔离、Service层注解鉴权、快速搭建登录页面时使用。 基础登录认证请先使用 sa-token 技能。
How do I install sa-token-integration?
Run npx skills add https://github.com/full-stack-skills/java-skills --skill sa-token-integration in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sa-token-integration/ (personal) or .claude/skills/sa-token-integration/ (project).
Which AI agents can use sa-token-integration?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is sa-token-integration safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains sa-token-integration?
It is published by full-stack-skills in full-stack-skills/java-skills. It has 76 recorded installs.
More from full-stack-skills/java-skills
java-development-manual
full-stack-skills/java-skills
Java开发手册规约集合,基于阿里巴巴Java开发手册(嵩山版)。 涵盖7大维度:编程规约、异常日志、单元测试、安全规约、MySQL数据库、工程结构、设计规约。 当用户需要:(1) 编写或审查Java代码 (2) 检查命名/代码规范 (3) 处理异常和日志 (4) 编写单元测试 (5) 安全编码 (6) 数据库设计 (7) 工程架构设计时使用此skill。 触发词:Java规范、阿里规约、代码规范、开发手册、编程规约、异常处理、单元测试、安全、MySQL、工程结构、设计模式。
mybatis-plus-patterns
full-stack-skills/java-skills
Open the skill to read its SKILL.md instructions.
java-code-comments
full-stack-skills/java-skills
Provides comprehensive guidance for adding Java code comments following industry standards and best practices. This skill helps add class-level comments, method-level comments, and field-level comments to Java code. Use when the user wants to add comments to Java code, needs to document Java classes/methods/fields, wants to improve code documentation, or needs to generate JavaDoc comments. This skill covers Controller, Service, ServiceImpl, Mapper, Model, Entity, BO (Business Object), DTO, VO, and other common Java component types. The skill follows a systematic workflow: scan codebase, identify components, create todo list, and add comments in order (class comments → method comments → field comments).
java-conventions
full-stack-skills/java-skills
统一 Java 项目编码规范与注释规范(SLF4J+Lombok 日志、Bean Lombok 注解选择、判空 Objects/Optional、工具类优先级 Spring→Apache Commons→Hutool→Guava、复杂逻辑用设计模式/简单逻辑不拆分、Controller/Service/ServiceImpl/Mapper 注释一致性)。当需要“按 Java 规范重构/Review/补全注释/统一日志/统一工具类使用/补全 JavaDoc”时使用。
mybatis-patterns
full-stack-skills/java-skills
Open the skill to read its SKILL.md instructions.
redis-redisson-patterns
full-stack-skills/java-skills
Redis + Redisson 缓存与分布式锁技能。覆盖缓存Key命名规范、过期时间设置原则、RedisTemplate序列化选择(JSON vs JDK vs String)、Redisson分布式锁三大模式(watchDog/tryLock 有leaseTime/无leaseTime 决策)、缓存穿透(布隆/空值缓存)/击穿(互斥锁)/雪崩(随机TTL)防护、Caffeine vs Redis选择决策。 纠正 LLM:不设过期时间、StringRedisTemplate和RedisTemplate混用、Redisson锁不 try-finally unlock、看门狗在指定 leaseTime 时不生效。
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.