0 Star 1 Fork 0

niceprice / niceprice-authorization

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Authorization

本项目为微服务架构中业务组件——身份认证和鉴权中心

NicePrice 为项目名称,如需改造中间件可忽略


依赖
  • 分布式事务中心 —— txlcn-tc (具体内容参见 快速开始
  • 服务注册与发现中心 —— Consul
  • 应用健康监控 —— SpringBoot Actuator
  • 分布式链路追踪 —— sleuth & zipkin
  • 关系型数据库 —— MySQL

工作原理

内含分组角色的权限控制

因系统中仅使用 Password 和 Client Credentials 两种认证模式, 故系统中只提供部分接口,且用例有限

  • config/ResourceConfig —— controller 路径访问的权限配置

  • controller/OAuth2UserController —— 系统内其他 client 验证 token

  • controller/UserController —— 为系统内其他 client 提供用户信息服务

  • controller/GroupController —— 为系统内其他 client 提供用户组信息服务


注意
  • 分布式事务

UserController、GroupController 各方法均有 Lcn 分布式事务注解, 如需启用仅在其他 client 调用处使用 @LcnTransaction(propagation = DTXPropagation.REQUIRED) 即可, 若无注解,各方法将仅开启本地事务,不新建分布式事务组

  • 资源服务认证

UserController、GroupController 各方法调用需要权限认证, 该系统中默认各方法仅以 client 角色使用, 故其他 client 中 OAuth2RestTemplate 和 Openfeign 的配置仅需配置 client 属性 并注入 DefaultClientContext 让方法调用以 client 角色实行

如果需要自定义传递令牌,或者限制 client 访问 resource server , 仅需修改 oauth_client_details 中各属性,可参见 spring-security-oauthOAuth-2.0-Migration-Guide

MIT License Copyright (c) 2020 精神病人思路很广 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

微服务架构 业务组件 身份认证和鉴权中心 展开 收起
Kotlin
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Kotlin
1
https://gitee.com/niceprice/niceprice-authorization.git
git@gitee.com:niceprice/niceprice-authorization.git
niceprice
niceprice-authorization
niceprice-authorization
master

搜索帮助