提交 e437742e 编写于 作者: sinat_25235033's avatar sinat_25235033

modify docs layout

上级 14ff1af1
......@@ -11,11 +11,11 @@
> `shiro`对于`restful api`原生支持不是太友好,需要改写一些代码,2年前一个项目就是改造`shiro`,使其在过滤链就能匹配不同的`rest`请求进行权限校验,项目传送门:[booshiro](https://gitee.com/tomsun28/bootshiro),之后给`shiro commit`几次`pr`,`fix`其在过滤链匹配时的危险漏洞,`PR`传送门:[SHIRO-682](https://github.com/apache/shiro/pull/127),总的来说`shiro`很强大但其起源并非面向`web`,对`restful`不是很友好
> `spring security`很强大,与`spring`深度集成,离开`spring`,比如`google`的精简`guice`,之前用过的`osgi`框架`karaf`就用不了了
> 它们都会在链式匹配这块,用请求的url和配置的链一个一个`ant`匹配(匹配过程中会有缓存等提高性能),但匹配的链过多时还是比较耗性能
> 所以想写一个权限包吸取上面的优秀设计,加一些自己的想法
> 所以写了一个权限包吸取上面的优秀设计,加一些我们的想法
## <font color="green">`Introduction`</font>
> `sureness` 是作者在使用`java`权限框架`shiro`之后,吸取其良好的设计加上一些自己想法实现的全新认证鉴权项目
> `sureness` 是我们在使用`java`权限框架`shiro`之后,吸取其良好的设计加上一些自己想法实现的全新认证鉴权项目
> 面对`restful api`的认证鉴权,基于`RBAC`主要关注于对`restful api`的保护
> 原生支持 `restful api, websocket protection`
> 原生支持动态权限(权限配置的动态加载)
......
......@@ -30,9 +30,9 @@
`eg: /api/v2/book===get`
- User belongs some Role -- Role owns Resource -- User can access the resource
### Add sureness in project
### Add sureness In Project
1. when use maven build project, add maven coordinate
1. When use maven build project, add maven coordinate
```
<!-- https://mvnrepository.com/artifact/com.usthe.sureness/sureness-core -->
<dependency>
......@@ -41,26 +41,26 @@
<version>0.0.2.6</version>
</dependency>
```
2. when use gradle build project, add gradle coordinate
2. When use gradle build project, add gradle coordinate
```
compile group: 'com.usthe.sureness', name: 'sureness-core', version: '0.0.2.6'
```
3. when not java build project, add sureness-core.jar to classPath
3. When not java build project, add sureness-core.jar to classPath
```
download this jar at mvnrepository
https://mvnrepository.com/artifact/com.usthe.sureness/sureness-core
```
### Add an interceptor intercepting all requests
### Add an Interceptor Intercepting All Requests
the interceptor can be a filter or a spring interceptor.
the interceptor intercepts all request to check them.
The interceptor can be a filter or a spring interceptor.
The interceptor intercepts all request to check them.
```
SurenessSecurityManager.getInstance().checkIn(servletRequest)
```
### Implement exception flow when exception throw
### Implement Exception Flow When Exception Throw
Authentication passed directly, failure throw exception, catch exception and do something:
```
......@@ -92,14 +92,14 @@ IncorrectCredentialsException | authenticated, incorrect credential
ExpiredCredentialsException | authenticated,expired credential
UnauthorizedException | authorized,no permission access this resource
custom exception should extend SurenessAuthenticationException or SurenessAuthorizationException
Custom exception should extend SurenessAuthenticationException or SurenessAuthorizationException
### Load config dataSource
### Load Config DataSource
sureness need dataSource to authenticate and authorize, eg: role data, user data etc.
the dataSource can load from txt, dataBase or no dataBase etc.
we provide interfaces `SurenessAccountProvider`, `PathTreeProvider` for user implement to load data from the dataSource where they want.
also, we provide default dataSource implement which load dataSource from txt(sureness.yml), user can defined their data in sureness.yml.
Sureness need dataSource to authenticate and authorize, eg: role data, user data etc.
The dataSource can load from txt, dataBase or no dataBase etc.
We provide interfaces `SurenessAccountProvider`, `PathTreeProvider` for user implement to load data from the dataSource where they want.
Also, we provide default dataSource implement which load dataSource from txt(sureness.yml), user can defined their data in sureness.yml.
eg:
```
## -- sureness.yml txt dataSource-- ##
......@@ -151,15 +151,15 @@ account:
If the configuration resource data comes from text, please refer to [10 Minute Tutorial's Program--sample-bootstrap](https://github.com/tomsun28/sureness/tree/master/sample-bootstrap)
If the configuration resource data comes from dataBase, please refer to [30 Minute Tutorial's Program--sample-tom](https://github.com/tomsun28/sureness/tree/master/sample-tom)
**Have Fun**
**Have Fun**
## Advanced Use
if know sureness [Process flow](#Process flow), maybe know the extend point
If know sureness [Process flow](#Process Flow), maybe know the extend point
sureness supports custom subject, custom subjectCreator, custom processor and more.
Sureness supports custom subject, custom subjectCreator, custom processor and more.
suggest look these interface before extending:
Suggest look these interface before extending:
- `Subject`: Authenticated authorized user's account interface, provide the account's username,password, request resources, roles, etc.
- `SubjectCreate`: create subject interface, provider create method
......@@ -168,21 +168,21 @@ suggest look these interface before extending:
- `SurenessAccountProvider`: account data provider, it can load data from txt or database,etc
1. **custom datasource**
1. **Custom Datasource**
`implment PathTreeProvider, load in DefaultPathRoleMatcher`
`implment SurenessAccountProvide, load in processor`
`Implment PathTreeProvider, load in DefaultPathRoleMatcher`
`Implment SurenessAccountProvide, load in processor`
2. **custom subject**
2. **Custom Subject**
`implment Subject, add custom subject content`
`implment SubjectCreate to create custom subject`
`implment Processor to support custom subject`
`Implment Subject, add custom subject content`
`Implment SubjectCreate to create custom subject`
`Implment Processor to support custom subject`
3. **custom processor**
3. **Custom Processor**
`a subject also can support by different processor, so we can custom processor to support custom subject`
`implment Processor, set which subject can support and implment processing details`
`A subject also can support by different processor, so we can custom processor to support custom subject`
`Implment Processor, set which subject can support and implment processing details`
Detail please refer to [30 Minute Tutorial's Program--sample-tom](sample-tom)
......@@ -190,7 +190,7 @@ Detail please refer to [30 Minute Tutorial's Program--sample-tom](sample-tom)
![pathRoleMatcher](docs/_images/PathRoleMatcher.svg)
### Process flow
### Process Flow
![sureness-core](docs/_images/sureness-core.svg)
......
......@@ -10,11 +10,11 @@
> `shiro`对于`restful api`原生支持不是太友好,需要改写一些代码,2年前一个项目就是改造`shiro`,使其在过滤链就能匹配不同的`rest`请求进行权限校验,项目传送门[booshiro](https://gitee.com/tomsun28/bootshiro),之后给`shiro commit`几次`pr`,`fix`其在过滤链匹配时的危险漏洞,`PR`传送门[SHIRO-682](https://github.com/apache/shiro/pull/127),总的来说`shiro`很强大但其起源并非面向`web`,对`restful`不是很友好
> `spring security`很强大,与`spring`深度集成,离开`spring`,比如`google`的精简`guice`,之前用过的`osgi`框架`karaf`就用不了了
> 它们都会在链式匹配这块,用请求的url和配置的链一个一个`ant`匹配(匹配过程中会有缓存等提高性能),但匹配的链过多时还是比较耗性能
> 所以想写一个权限包吸取上面的优秀设计,加一些自己的想法
> 所以写了一个权限包吸取上面的优秀设计,加一些我们的想法
### <font color="green">`Introduction`</font>
> `sureness` 是作者在使用`java`权限框架`shiro`之后,吸取其良好的设计加上一些自己想法实现的全新认证鉴权项目
> `sureness` 是我们在使用`java`权限框架`shiro`之后,吸取其良好的设计加上一些自己想法实现的全新认证鉴权项目
> 面对`restful api`的认证鉴权,基于`RBAC`主要关注于对`restful api`的保护
> 原生支持 `restful api, websocket protection`
> 原生支持动态权限(权限配置的动态加载)
......
- 仓库
- 仓库
- [GITHUB](https://github.com/tomsun28/sureness ':ignore')
- [GITEE](https://gitee.com/tomsun28/sureness ':ignore')
- [GITHUB](https://github.com/tomsun28/sureness ':ignore')
- [GITEE](https://gitee.com/tomsun28/sureness ':ignore')
- :cn: 中文Chinese
- [:us: English](/en/)
- 其它
- [About Me](https://usthe.com)
- [回到主页](/)
- [:cn: 中文](/)
- [:us: 英文](/en/)
\ No newline at end of file
- 其它
- [About Me](https://usthe.com)
- [回到主页](/)
\ No newline at end of file
......@@ -5,8 +5,8 @@
- 进阶扩展
- [扩展点](extend-point.md)
- [自定义数据源](custom-datasource.md)
- [自定义subject](custom-subject.md)
- [自定义processor](custom-processor.md)
- [自定义Subject](custom-subject.md)
- [自定义Processor](custom-processor.md)
- 集成案例
- [10分钟项目集成](sample-bootstrap.md)
......@@ -15,4 +15,4 @@
- 其它
- [设计文档](design.md)
- [参与贡献](contributing.md)
- [changelog](https://github.com/tomsun28/sureness/releases ':ignore')
- [Changelog](https://github.com/tomsun28/sureness/releases ':ignore')
- Repository
- Repository
- [GITHUB](https://github.com/tomsun28/sureness ':ignore')
- [GITEE](https://gitee.com/tomsun28/sureness ':ignore')
- Other
- [About Me](https://usthe.com)
- [HOME](/en/)
- [:cn: Chinese](/)
- [:us: English](/en/)
\ No newline at end of file
- :us: 英文English
- [:cn: Chinese](/)
- Other
- [About Me](https://usthe.com)
- [HOME](/en/)
\ No newline at end of file
......@@ -3,10 +3,10 @@
- [Quick Start](en/quickstart.md "quick start greatest")
- Advanced Extend
- [extend point](en/extend-point.md)
- [custom datasource](en/custom-datasource.md)
- [custom subject](en/custom-subject.md)
- [custom processor](en/custom-processor.md)
- [Extend Point](en/extend-point.md)
- [Custom Datasource](en/custom-datasource.md)
- [Custom Subject](en/custom-subject.md)
- [Custom Processor](en/custom-processor.md)
- Integration Demo
- [10 Minute Tutorial](en/sample-bootstrap.md)
......@@ -14,5 +14,5 @@
- Others
- [Design](en/design.md)
- [Contribute to us](en/contributing.md)
- [changelog](https://github.com/tomsun28/sureness/releases ':ignore')
- [Contribute To Us](en/contributing.md)
- [Changelog](https://github.com/tomsun28/sureness/releases ':ignore')
## custom datasource
## Custom Datasource
`implment PathTreeProvider, load in DefaultPathRoleMatcher`
`implment SurenessAccountProvide, load in processor`
`Implment PathTreeProvider, load in DefaultPathRoleMatcher`
`Implment SurenessAccountProvide, load in processor`
Detail please refer to [30 Minute Tutorial's Program--sample-tom](https://github.com/tomsun28/sureness/tree/master/sample-tom)
## custom processor
## Custom Processor
`a subject also can support by different processor, so we can custom processor to support custom subject`
`A subject also can support by different processor, so we can custom processor to support custom subject`
`implment Processor, define which subject can support and implment processing details`
Detail please refer to [30 Minute Tutorial's Program--sample-tom](https://github.com/tomsun28/sureness/tree/master/sample-tom)
## custom subject
## Custom Subject
`implment Subject, add custom subject content`
`implment SubjectCreate to create custom subject`
`implment Processor to support custom subject`
`Implment Subject, add custom subject content`
`Implment SubjectCreate to create custom subject`
`Implment Processor to support custom subject`
Detail please refer to [30 Minute Tutorial's Program--sample-tom](https://github.com/tomsun28/sureness/tree/master/sample-tom)
## Advanced Use
if know sureness Process flow, maybe know the extends point.
sureness supports custom subject, custom subjectCreator, custom processor and more.
suggest look these interface before extending:
If know sureness Process flow, maybe know the extends point.
Sureness supports custom subject, custom subjectCreator, custom processor and more.
Suggest look these interface before extending:
- `Subject`: Authenticated authorized user's account interface, provide the account's username,password, request resources, roles, etc.
- `SubjectCreate`: create subject interface, provider create method.
- `Processor`: process subject interface, where happen authentication and authorization.
- `PathTreeProvider`: resource data provider, it can load data from txt or database,etc.
- `SurenessAccountProvider`: account data provider, it can load data from txt or database,etc.
- `SubjectCreate`: Create subject interface, provider create method.
- `Processor`: Process subject interface, where happen authentication and authorization.
- `PathTreeProvider`: Resource data provider, it can load data from txt or database,etc.
- `SurenessAccountProvider`: Account data provider, it can load data from txt or database,etc.
......@@ -8,9 +8,9 @@
`eg: /api/v2/book===get`
- User belongs some Role -- Role owns Resource -- User can access the resource
### Add sureness in project
### Add sureness In Project
1. when use maven build project, add maven coordinate
1. When use maven build project, add maven coordinate
```
<!-- https://mvnrepository.com/artifact/com.usthe.sureness/sureness-core -->
<dependency>
......@@ -19,26 +19,26 @@
<version>0.0.2.6</version>
</dependency>
```
2. when use gradle build project, add gradle coordinate
2. When use gradle build project, add gradle coordinate
```
compile group: 'com.usthe.sureness', name: 'sureness-core', version: '0.0.2.6'
```
3. when not java build project, add sureness-core.jar to classPath
3. When not java build project, add sureness-core.jar to classPath
```
download this jar at mvnrepository
https://mvnrepository.com/artifact/com.usthe.sureness/sureness-core
```
### Add an interceptor intercepting all requests
### Add an Interceptor Intercepting All Requests
the interceptor can be a filter or a spring interceptor.
the interceptor intercepts all request to check them.
The interceptor can be a filter or a spring interceptor.
The interceptor intercepts all request to check them.
```
SurenessSecurityManager.getInstance().checkIn(servletRequest)
```
### Implement exception flow when exception throw
### Implement Exception Flow When Exception Throw
Authentication passed directly, failure throw exception, catch exception and do something:
```
......@@ -70,14 +70,14 @@ IncorrectCredentialsException | authenticated, incorrect credential
ExpiredCredentialsException | authenticated,expired credential
UnauthorizedException | authorized,no permission access this resource
custom exception should extend SurenessAuthenticationException or SurenessAuthorizationException
Custom exception should extend SurenessAuthenticationException or SurenessAuthorizationException
### Load config dataSource
### Load Config DataSource
sureness need dataSource to authenticate and authorize, eg: role data, user data etc.
the dataSource can load from txt, dataBase or no dataBase etc.
we provide interfaces `SurenessAccountProvider`, `PathTreeProvider` for user implement to load data from the dataSource where they want.
also, we provide default dataSource implement which load dataSource from txt(sureness.yml), user can defined their data in sureness.yml.
Sureness need dataSource to authenticate and authorize, eg: role data, user data etc.
The dataSource can load from txt, dataBase or no dataBase etc.
We provide interfaces `SurenessAccountProvider`, `PathTreeProvider` for user implement to load data from the dataSource where they want.
Also, we provide default dataSource implement which load dataSource from txt(sureness.yml), user can defined their data in sureness.yml.
eg:
```
## -- sureness.yml txt dataSource-- ##
......
## sample-bootstrap
## Sample-bootstrap
[sureness 10 Minute Tutorial](https://github.com/tomsun28/sureness/tree/master/sample-bootstrap)
- based on `springboot`
- load data from default dataSource - `sureness.yml`
- use default sureness config
- use default `jwt,basic auth` to authenticate and authorize
- contain `restful api,websocket`
- project's protected entrance is `SurenessFilterExample`
- suggest use postman to test, test case is in `sample-bootstrap-postman.json`, user can load it in postman
- Based on `springboot`
- Load data from default dataSource - `sureness.yml`
- Use default sureness config
- Use default `jwt,basic auth` to authenticate and authorize
- Contain `restful api,websocket`
- Project's protected entrance is `SurenessFilterExample`
- Suggest use postman to test, test case is in `sample-bootstrap-postman.json`, user can load it in postman
## sample-tom
## Sample-tom
[sureness 30 Minute Tutorial](https://github.com/tomsun28/sureness/tree/master/sample-tom)
- based on `springboot`
- load data from mysql dataBase dataSource, then user can modify their data dynamically
- apart from having default `jwt,basic auth`, it adds custom `subject subjectCreator processor` to define new auth type.
- project's protected entrance is `SurenessFilterExample`
- suggest use postman to test, test case is in `sample-tom-postman.json`, user can load it in postman
- Based on `springboot`
- Load data from mysql dataBase dataSource, then user can modify their data dynamically
- Apart from having default `jwt,basic auth`, it adds custom `subject subjectCreator processor` to define new auth type.
- Project's protected entrance is `SurenessFilterExample`
- Suggest use postman to test, test case is in `sample-tom-postman.json`, user can load it in postman
## sample-bootstrap
## Sample-bootstrap
[sureness 10分钟例子项目](https://github.com/tomsun28/sureness/tree/master/sample-bootstrap)
......
## sample-tom
## Sample-tom
[sureness 30分钟例子项目](https://github.com/tomsun28/sureness/tree/master/sample-tom)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册