{"id":51712483,"url":"https://github.com/helloworldtang/sa-token-quickstart","last_synced_at":"2026-07-16T23:06:05.056Z","repository":{"id":351212524,"uuid":"1203481442","full_name":"helloworldtang/sa-token-quickstart","owner":"helloworldtang","description":"Sa-Token 快速入门项目","archived":false,"fork":false,"pushed_at":"2026-04-14T03:49:12.000Z","size":274,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T05:13:06.451Z","etag":null,"topics":["java","maven-repository","sa-token"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helloworldtang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-07T04:37:32.000Z","updated_at":"2026-04-14T03:49:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/helloworldtang/sa-token-quickstart","commit_stats":null,"previous_names":["helloworldtang/sa-token-quickstart"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/helloworldtang/sa-token-quickstart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworldtang%2Fsa-token-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworldtang%2Fsa-token-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworldtang%2Fsa-token-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworldtang%2Fsa-token-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helloworldtang","download_url":"https://codeload.github.com/helloworldtang/sa-token-quickstart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworldtang%2Fsa-token-quickstart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35560452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-16T02:00:06.687Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","maven-repository","sa-token"],"created_at":"2026-07-16T23:06:04.265Z","updated_at":"2026-07-16T23:06:05.052Z","avatar_url":"https://github.com/helloworldtang.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sa-Token 多模块示例项目\n\n## 项目结构\n\n本项目展示了 Sa-Token 框架的基础使用和优雅实践，采用多模块结构设计：\n\n```\nsa-token-quickstart/\n├── sa-token-basic/                     # 基础示例模块\n├── sa-token-elegant-demo/              # 优雅实践模块\n├── sa-token-apikey/                    # API Key 管理模块\n├── sa-token-apisign/                   # API 接口参数签名模块\n├── sa-token-websocket-authentication/  # WebSocket 鉴权模块\n└── pom.xml                             # 父POM\n```\n\n## 模块说明\n\n### sa-token-basic\n- **定位**: 基础功能演示\n- **端口**: 8080\n- **特点**: 简单直接，快速上手\n- **文档**: http://localhost:8080/doc.html\n\n### sa-token-elegant-demo\n- **定位**: 优雅实践示例\n- **端口**: 8081\n- **特点**: 展示框架设计与工程实践\n- **文档**: http://localhost:8081/doc.html\n- **包含**:\n  - 声明式权限控制（@SaCheckLogin, @SaCheckRole, @SaCheckPermission）\n  - 统一异常处理\n  - 统一响应封装\n  - 完整的单元测试\n  - Redis集成示例\n  - 优雅的代码组织\n  - **在线会话管理**（查看和踢掉在线用户会话）\n  - **改进的踢人功能**（支持按用户ID和会话ID踢人）\n\n### sa-token-apikey\n- **定位**: API Key 管理系统\n- **端口**: 8082\n- **特点**: 基于 Sa-Token 官方 API Key 插件的完整实现\n- **管理后台**: http://localhost:8082/\n- **默认账号**: admin / admin123\n- **包含**:\n  - API Key 创建、查询、删除\n  - API Key 认证（Bearer sk-xxx 格式）\n  - **双重限流机制**（IP 限流 + API Key 限流）\n  - API Key 使用统计\n  - Web 管理后台\n  - Redis 持久化\n- **详细文档**: [sa-token-apikey/README.md](sa-token-apikey/README.md)\n\n### sa-token-apisign\n- **定位**: API 接口参数签名模块\n- **端口**: 8083\n- **特点**: 基于 Sa-Token Sign 插件，防止参数篡改和重放攻击\n- **签名帮助**: http://localhost:8083/sign/help\n- **API 文档**: http://localhost:8083/doc.html\n- **包含**:\n  - API 接口参数签名校验（一行代码完成）\n  - 签名生成帮助接口（方便理解和使用）\n  - 模拟转账业务接口\n  - 完整的签名生成工具类\n  - 单元测试示例\n- **详细文档**: [sa-token-apisign/README.md](sa-token-apisign/README.md)\n\n### sa-token-websocket-authentication\n- **定位**: WebSocket 鉴权模块\n- **端口**: 8084\n- **特点**: 基于 Sa-Token + Spring WebSocket 的完整鉴权方案\n- **API 文档**: http://localhost:8084/doc.html\n- **包含**:\n  - WebSocket 握手时 Token 验证（HandshakeInterceptor）\n  - 支持 3 种 Token 传递方式（URL 参数、Header、Authorization）\n  - 在线用户管理\n  - 消息广播和私聊功能\n  - 完整的集成测试（13 个用例）\n  - 登出后 Token 失效验证\n- **详细文档**: [sa-token-websocket-authentication/README.md](sa-token-websocket-authentication/README.md)\n\n## 技术栈\n\n- Spring Boot 3.3.0\n- Sa-Token 1.45.0\n- Java 17\n- Lombok\n- Knife4j (Swagger)\n- Testcontainers\n- Redis（sa-token-apikey 模块必需）\n\n## 快速开始\n\n### 前置要求\n- JDK 17+\n- Maven 3.6+\n- Redis 6.0+（运行 sa-token-apikey 模块需要）\n\n### 构建项目\n```bash\n# 构建所有模块\nmvn clean install\n\n# 跳过测试构建\nmvn clean install -DskipTests\n```\n\n### 运行测试\n```bash\n# 运行所有模块的测试\nmvn test\n\n# 运行特定模块的测试\ncd sa-token-elegant-demo\nmvn test\n```\n\n### 启动应用\n\n#### 启动基础示例\n```bash\ncd sa-token-basic\nmvn spring-boot:run\n```\n访问: http://localhost:8080/doc.html\n\n#### 启动优雅实践示例\n\n**重要提示**：推荐使用 IntelliJ IDEA 启动，Maven 命令行编译时 Java 21 与 Lombok 存在兼容性问题。\n\n在 IDEA 中：\n1. 打开项目\n2. 找到 `SaTokenElegantApplication.java`\n3. 右键 → Run\n\n访问: http://localhost:8081/doc.html\n\n详细启动指南请参考 [STARTUP_GUIDE.md](STARTUP_GUIDE.md)\n\n#### 启动 API Key 管理系统\n\n**前置要求**：\n- Redis 服务必须运行\n\n```bash\n# 启动 Redis\nredis-server\n\n# 启动应用\ncd sa-token-apikey\nmvn spring-boot:run\n```\n\n访问: http://localhost:8082/\n\n默认账号：\n- 用户名：admin\n- 密码：admin123\n\n详细使用说明请参考 [sa-token-apikey/README.md](sa-token-apikey/README.md)\n\n#### 启动 API 接口参数签名模块\n\n```bash\ncd sa-token-apisign\nmvn spring-boot:run\n```\n\n访问: http://localhost:8083/sign/help\n\n详细使用说明请参考 [sa-token-apisign/README.md](sa-token-apisign/README.md)\n\n## 学习路径\n\n### 1. 从基础开始\n1. 启动 sa-token-basic 模块\n2. 阅读代码，了解 Sa-Token 的基本用法\n3. 使用 Knife4j 测试各个接口\n\n### 2. 进阶学习\n1. 启动 sa-token-elegant-demo 模块\n2. 阅读代码，学习优雅实践\n3. 理解声明式权限控制\n4. 学习统一异常处理\n5. 查看单元测试，了解测试方法\n\n### 3. API Key 管理\n1. 启动 sa-token-apikey 模块（需先启动 Redis）\n2. 登录管理后台创建 API Key\n3. 了解 API Key 认证机制\n4. 学习双重限流实现\n5. 查看使用统计功能\n\n### 4. API 接口参数签名\n1. 启动 sa-token-apisign 模块\n2. 访问签名帮助接口了解签名生成过程\n3. 学习签名校验的使用方法\n4. 理解如何防止参数篡改和重放攻击\n5. 查看单元测试，了解测试方法\n\n## 优雅实践亮点\n\n### 1. 框架设计的优雅\n- API设计简洁（一行代码完成登录）\n- 配置灵活（支持多种配置选项）\n- 开箱即用（无需复杂配置）\n\n### 2. 工程实践的优雅\n- 声明式权限控制（注解驱动）\n- 统一异常处理（集中管理）\n- 统一响应封装（前端友好）\n- 完整的单元测试（保证质量）\n- 清晰的代码组织（易于维护）\n\n## 相关资源\n\n- [Sa-Token 官网](https://sa-token.cc/)\n- [Sa-Token GitHub](https://github.com/dromara/sa-token)\n- [Sa-Token 文档](https://sa-token.cc/doc.html)\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloworldtang%2Fsa-token-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelloworldtang%2Fsa-token-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloworldtang%2Fsa-token-quickstart/lists"}