Skip to content

Latest commit

 

History

History
254 lines (183 loc) · 10.5 KB

README.md

File metadata and controls

254 lines (183 loc) · 10.5 KB

sjt-sso

a distributed single sign-on framework

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

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

目录

上手指南

开发前的配置要求
  1. JDK 1.7+
  2. Redis 4.0+
安装步骤
  1. Get a free API Key at https://example.com
  2. Clone the repo
git clone https://github.com/shaojintian/sso-java.git

文件目录说明

eg:

开发的架构

archi0

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客户端不需要过滤的路径。

请阅读ARCHITECTURE.md 查阅为该项目的架构。

部署

暂无

使用到的框架

💡核心设计

  1. xxxxx
  2. xxxxx
  3. xxxxx

📊性能测试

  1. xxxxx
  2. xxxxx

贡献者

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

如何参与开源项目

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

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

版本控制

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

作者

E-mail: sjt@hnu.edu.cn

知乎:笃行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.