# sureness **Repository Path**: bk-saas/sureness ## Basic Information - **Project Name**: sureness - **Description**: 面向REST API的高性能认证鉴权框架,致力于管理保护API安全 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://sureness.dromara.org - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 257 - **Created**: 2025-04-25 - **Last Updated**: 2025-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
# Dromara Sureness | [English Documentation](README.md) > 面向`REST API`的高性能认证鉴权框架 [](https://www.apache.org/licenses/LICENSE-2.0.html) [](https://search.maven.org/artifact/com.usthe.sureness/sureness-core)  [](https://gitter.im/usthe/sureness)  [](https://gitee.com/dromara/sureness/stargazers) [](https://github.com/dromara/sureness) **官网: [sureness.dromara.org](https://sureness.dromara.org)** **代码托管** | GitCode | Gitee |GitHub | ## 介绍 **Dromara Sureness** 是全新设计开发的一个认证鉴权框架,提供一个面向**REST API**,可以**动态修改权限**,**多认证策略**,**更快速度**,**易用易扩展**的认证鉴权框架。 - 面向 `REST API` 的认证鉴权,基于 `RBAC` (用户-角色-资源)主要关注于对 `API` 的安全保护 - 无特定Web框架依赖(已有 `Spring Boot,Quarkus,Javalin,Ktor,Micronaut,Jfinal,Solon` 等集成样例) - 支持动态修改权限配置(动态修改配置每个 `API` 谁有权访问) - 支持 `Websocket` ,主流 `HTTP` 容器 `Servlet` 和 `JAX-RS` - 支持多种认证策略, `JWT, Basic Auth, Digest Auth` ... 可扩展自定义认证方式 - 基于改进的字典匹配树拥有的高性能 - 良好的扩展接口, 样例和文档助急速理解扩展使用 ##### 高性能匹配  ##### 框架支持样例 - [x] Sureness集成**Spring Boot**样例(配置文件方案) [sample-bootstrap](sample-bootstrap) - [x] Sureness集成**Spring Boot**样例(数据库方案) [sample-tom](sample-tom) - [x] Sureness集成**Quarkus**样例 [sample-quarkus](samples/quarkus-sureness) - [x] Sureness集成**Javalin**样例 [sample-javalin](samples/javalin-sureness) - [x] Sureness集成**Ktor**样例 [sample-ktor](samples/ktor-sureness) - [x] Sureness集成**Spring Webflux**样例 [sample-spring-webflux](samples/spring-webflux-sureness) - [x] Sureness集成**Micronaut**样例 [sample-micronaut](samples/micronaut-sureness) - [x] Sureness集成**Jfinal**样例 [sample-jfinal](samples/jfinal-sureness) - [x] Sureness集成**Solon**样例 [sample-solon](samples/solon-sureness) - [x] Sureness集成**Spring Gateway**样例 [sample-spring-gateway](samples/spring-gateway-sureness) - [x] Sureness集成**Zuul**样例 [sample-zuul](samples/zuul-sureness) - [x] Sureness使用Session样例 [sureness-session](samples/sureness-session) - [x] Sureness分布式缓存Session样例 [sureness-redis-session](samples/sureness-redis-session) - [x] More samples todo ## 鉴权框架对比 ##### Sureness VS Shiro VS Spring Security | ~ | Sureness | Shiro | Spring Security | | --- | --- | --- | --- | | **多框架支持** | 支持 | 需改动支持 | 不支持 | | **REST API** | 支持 | 需改动支持 | 支持 | | **Websocket** | 支持 | 不支持 | 不支持 | | **过滤链匹配** | 优化的字典匹配树 | ant匹配 | ant匹配 | | **注解支持** | 支持 | 支持 | 支持 | | **Servlet** | 支持 | 支持 | 支持| | **JAX-RS** | 支持 | 不支持 | 不支持| | **权限动态修改** | 支持 | 需改动支持 | 需改动支持| | **性能速度** | 较快 | 较慢 | 较慢| | **学习曲线** | 简单 | 简单 | 陡峭| ##### 基准性能测试  **基准测试显示Sureness对比无权限框架应用损耗0.026ms性能,Shiro损耗0.088ms,Spring Security损耗0.116ms, 相比之下Sureness性能(参考TPS损耗)是Shiro的3倍,Spring Security的4倍** **性能差距会随着api匹配链的增加而进一步拉大** , 详见[基准测试](https://github.com/tomsun28/sureness-shiro-spring-security) ## 快速开始 #### 使用前一些约定 - `Sureness`基于`RBAC`,即用户-角色-资源: 用户所属角色--角色拥有资源(API)--用户就能访问资源(API) - 我们将`REST API`请求视作一个资源,资源格式为: `requestUri===httpMethod` 即请求的路径加上其请求方式(`post,get,put,delete...`)作为一个整体被视作资源来赋权配置 `eg: /api/v2/book===get` `get`方式请求`/api/v2/book`接口数据 资源路径匹配详见 [URI路径匹配](docs/cn/path-match.md) #### 项目中加入Sureness 项目使用`maven`或`gradle`构建,加入坐标 ```
QQ Group: 390083213
[Github Discussion](https://github.com/dromara/sureness/discussions)
[Gitter Channel](https://gitter.im/dromara/sureness)
## 开源推荐
* **```HertzBeat```** 易用友好的实时监控系统,无需Agent,强大自定义监控能力: [Github](https://github.com/dromara/hertzbeat)
* **```JustAuth```** 小而全而美的第三方登录开源组件: [Gitee](https://gitee.com/yadong.zhang/JustAuth)
* **```MaxKey```** 业界领先的企业级开源IAM身份管理和身份认证产品: [Gitee](https://gitee.com/dromara/MaxKey)
* **```PhalApi```** 一个轻量级PHP开源接口框架: [官网](https://www.phalapi.net/)
## License
[`Apache License, Version 2.0`](https://www.apache.org/licenses/LICENSE-2.0.html)
## Thanks
[](https://www.jetbrains.com/community/opensource/#support)