sso java_GitHub - shaojintian/sso-java: 分布式单点登录

sjt-sso

a distributed single sign-on framework

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f7368616f6a696e7469616e2f73736f2d6a6176612e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f7368616f6a696e7469616e2f73736f2d6a6176612e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7368616f6a696e7469616e2f73736f2d6a6176612e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f7368616f6a696e7469616e2f73736f2d6a6176612e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7368616f6a696e7469616e2f73736f2d6a6176612e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4c696e6b6564496e2d626c61636b2e7376673f7374796c653d666c61742d737175617265266c6f676f3d6c696e6b6564696e26636f6c6f72423d353535

68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f70616e6a66323030302f676e65743f7374796c653d666c61742d737175617265266c6f676f3d6170707665796f72

68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f70616e6a66323030302f676e65743f7374796c653d666c61742d737175617265266c6f676f3d6170707665796f72

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d4c696e75782532302537432532306d61634f5325323025374325323057696e646f77732d3534393638383f7374796c653d666c61742d737175617265266c6f676f3d6170707665796f72

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f676f2d253345253344312e392d3330646666333f7374796c653d666c61742d737175617265266c6f676f3d6170707665796f72

68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f70616e6a66323030302f676e65742e7376673f636f6c6f723d313631383233267374796c653d666c61742d737175617265266c6f676f3d6170707665796f72

68747470733a2f2f676f6c616e6763692e636f6d2f6261646765732f6769746875622e636f6d2f70616e6a66323030302f676e65742e737667

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6170692d7265666572656e63652d3864346262622e7376673f7374796c653d666c61742d737175617265266c6f676f3d6170707665796f72

68747470733a2f2f736f7572636567726170682e636f6d2f6769746875622e636f6d2f70616e6a66323030302f676e65742f2d2f62616467652e7376673f7374796c653d666c61742d737175617265

68747470733a2f2f617765736f6d652e72652f6d656e74696f6e65642d62616467652d666c61742e737667

logo.png

Best-README-Template

An awesome README template to jumpstart your projects!

Explore the docs »

View Demo

·

Report Bug

·

Request Feature

本篇README.md面向开发者

🚀 功能

concise: clean API, easy to go

lightweight: less dependencies ,lower cost in deploy and join up

single sign-on: only login in once to visit all verified & authorised app or website

distribution: support distributed deployment when join up SSO verified center

HA: Server & Client both support cluster deployment ,promote availability in system

cross-domain: support cross-domain app join up SSO verified center

Cookie+Token : support based on Cookie and Token way to join up separately ,give independent sample to refer

Web+APP: support web or app join up

real-time: system login in , logout , share together between all Server and Client

CS-structure: based on Client-Server ,eg:include Server Verified Center and Client Protected App

Remember password: when you dont remember pw, close browser then login state close;

when you remember pw,postpone login state ;

you can customize delay time (even infinity delay time).

Path exclude: support customize multiple excluding paths, Ant expression to exclude paths that dont need to filter

目录

上手指南

开发前的配置要求

JDK 1.7+

Redis 4.0+

安装步骤

Get a free API Key at https://example.com

Clone the repo

git clone https://github.com/shaojintian/sso-java.git

文件目录说明

eg:

开发的架构

sso-java

1.1 登录流程剖析

用户于Client端应用访问受限资源时,将会自动 redirect 到 SSO Server 进入统一登录界面

用户登录成功之后将会为用户分配 SSO SessionId 并 redirect 返回来源Client端应用,同时附带分配的 SSO SessionId

在Client端的SSO Filter里验证 SSO SessionId 无误,将 SSO SessionId 写入到用户浏览器Client端域名下 cookie 中

SSO Filter验证 SSO SessionId 通过,受限资源请求放行

1.2 注销流程剖析

用户与Client端应用请求注销Path时,将会 redirect 到 SSO Server 自动销毁全局 SSO SessionId,实现全局销毁

然后,访问接入SSO保护的任意Client端应用时,SSO Filter 均会拦截请求并 redirect 到 SSO Server 的统一登录界面

##1.3 基于Cookie,相关概念

登陆凭证存储:登陆成功后,用户登陆凭证被自动存储在浏览器Cookie中

Client端校验登陆状态:通过校验请求Cookie中的是否包含用户登录凭证判断

系统角色模型:

SSO Server:认证中心,提供用户登陆、注销以及登陆状态校验等功能

Client应用:受SSO保护的Client端Web应用,为用户浏览器访问提供服务

用户:发起请求的用户,使用浏览器访问

##1.4 基于Token,相关概念

登陆凭证存储:登陆成功后,获取到登录凭证(xxl_sso_sessionid=xxx),需要主动存储,如存储在 localStorage、Sqlite 中

Client端校验登陆状态:通过校验请求 Header参数 中的是否包含用户登录凭证(xxl_sso_sessionid=xxx)判断;因此,发送请求时需要在 Header参数 中设置登陆凭证

系统角色模型:

SSO Server:认证中心,提供用户登陆、注销以及登陆状态校验等功能

Client应用:受SSO保护的Client端Web应用,为用户请求提供接口服务

用户:发起请求的用户,如使用Android、IOS、桌面客户端等请求访问

##1.5 未登录状态请求处理

基于Cookie,未登录状态请求:

页面请求:redirect 到SSO Server登录界面

JSON请求:返回未登录的JSON格式响应数据

数据格式:

code:501 错误码

msg:sso not login.

基于Token,未登录状态请求:

返回未登录的JSON格式响应数据

数据格式:

code:501 错误码

msg:sso not login.

##1.6 登录态自动延期

支持自定义登录态有效期窗口,默认24H,当登录态有效期窗口过半时,自动顺延一个周期。

##1.7 记住密码

未记住密码时,关闭浏览器则登录态失效;记住密码时,登录态自动延期,在自定义延期时间的基础上,原则上可以无限延期。

##1.8 路径排除

自定义路径排除Path,允许设置多个,且支持Ant表达式。用于排除SSO客户端不需要过滤的路径。

部署

暂无

使用到的框架

💡核心设计

xxxxx

xxxxx

xxxxx

📊性能测试

xxxxx

xxxxx

贡献者

请阅读CONTRIBUTING.md 查阅为该项目做出贡献的开发者。

如何参与开源项目

贡献使开源社区成为一个学习、激励和创造的绝佳场所。你所作的任何贡献都是非常感谢的。

Fork the Project

Create your Feature Branch (git checkout -b feature/AmazingFeature)

Commit your Changes (git commit -m 'Add some AmazingFeature')

Push to the Branch (git push origin feature/AmazingFeature)

Open a Pull Request

版本控制

该项目使用Git进行版本管理。您可以在repository参看当前可用版本。

作者

知乎:笃行er   qq:1075803623

您也可以在贡献者名单中参看所有参与该项目的开发者。

版权说明

该项目签署了MIT 授权许可,详情请参阅 LICENSE.txt

鸣谢

赞助

If you like this project and want to sponsor the author, you can reward the author using Wechat or Alipay by scanning the following QR code.

reward_wechat.png

reward_alipay.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值