8 Star 10 Fork 10

合杰 / xjj_sso

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

xjj_sso

  • xjj_sso是基于SSM快速开发框架xjj的一款单点登陆服务实现。可以帮助企业快速搭建单点登陆服务,使用户一次登陆就可以畅游于各互相信任的信息系统。
  • xjj开发框架,请移步https://gitee.com/zhanghejie/xjj
  • jeexjj开发框架(xjj的spring boot版本),请移步https://gitee.com/zhanghejie/xjj
  • QQ交流群:174266358。

项目介绍

xjj_sso是基于SSM快速开发框架xjj的一款单点登陆服务实现。可以帮助企业快速搭建单点登陆服务,使用户一次登陆就可以畅游于各互相信任的信息系统。

技术选型

后端技术:

技术 名称 官网
Spring Framework 容器 http://projects.spring.io/spring-framework/
SpringMVC MVC框架 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#mvc
MyBatis ORM框架 http://www.mybatis.org/mybatis-3/zh/index.html
Maven 项目构建管理 http://maven.apache.org/
freemarker 页面模板引擎 http://freemarker.foofun.cn/
freemarker 页面模板引擎 http://freemarker.foofun.cn/

前端技术:

技术 名称 官网
jQuery 函式库 http://jquery.com/
Bootstrap 前端框架 http://getbootstrap.com/
Font-awesome 字体图标 http://fontawesome.io/
zTree 树插件 http://www.treejs.cn/v3/
layui 前端框架 http://layer.layui.com/
ace 前端框架 http://ace.jeka.by/

实现原理

1.名词解释

  • GrantingTicket:登陆用户的唯一标识票据。(基于cookie实现,简写:GT)

  • ServiceTicket:用户登陆成功后,每访问一个应用信息,都会再为它生成一个st票据。例:如果一个用户登陆了基于sso的三个互相信我任的系统。那么对应该用户总共有1个GrantingTicket,3个ServiceTicket。 2.下面通过时序图的方式来介绍sso的登陆验证流程。

  • 登陆窗口在client端的登陆流程如下:

  • 已经登陆sso的用户首次访问某信任系统时的验证流程

  • 单点退出流程

搭建步骤

  1. 下载xjj_sso项目 https://gitee.com/zhanghejie/xjj_sso
  2. 使用xjj_sso/doc/db/db_init.sql 创建单点登陆服务端的数据库
  3. 下载xjj_sso_client项目 https://gitee.com/zhanghejie/xjj_sso_client
  4. 修改服务端的配置文件 xjj_sso_server.properties,配置介绍如下:
sso.path.authentication=/sso/authentication  #单点登陆验证url,一般默认就行
sso.path.signin=/sso/signin                  #单点登陆url,一般默认就行

sso.path.signout=/sso/signout                #单点退出url,一般默认
sso.path.validateTicket=/sso/validateTicket  #ticket验证url,一般默认
sso.url.index=/sso/index.jsp                 #
sso.url.login=http://localhost:8080/xjj_sso  #服务端访问url,根据情况修改

sso.cookie.maxage=-1                         #cookie相关,一般默认
sso.cookie.name=XJJTC
sso.cookie.path=/

sso.server.error=ssoerror                    #登陆失败返回参数
#unit minute
sso.grantingticket.invalidate=300            #GT缓存时间(分钟)
#sso project app
sso.login.type=project                       #登陆方式

#mcmcache config 
memcache.is.use=false                        #是否使用memcache做为缓存
memcache.servers=192.168.54.223\:11211
memcache.ticket.expiry=24
memcache.user.expiry=120


#sso notification type http|rabbitmq         #通知方式(http或rabbitmq)
sso.notification.type=http
#rabbitmq config test                        #rabbit服务相关
rabbitmq.server=192.168.54.204
rabbitmq.port=5672
rabbitmq.username=admin
rabbitmq.password=admin
rabbitmq.exchange=sso_topic
修改client端配置文件xjj_sso_client.properties

sso.client.sessionHandle=com.xjj.sso.client.session.SessionHandleImpl  #接口实现,客户端实现,
sso.client.projectCode=zhj                                             #项目编码,登陆服务端后台添加
sso.server.url=http://localhost:8080/xjj_sso                           #单点登陆服务地址

#sso client
sso.client.receipt=sso.client.receipt
sso.client.ssoLogonUrl=/jsp/ssoLogon                                   #单点登陆验证地址,可以修改,对应登陆页面的提交地址。
sso.client.loginUrl=/sso/login.jsp                                     #该系统的登陆地址
sso.client.login.isredirect=true 
sso.client.nofilter=/*/bb/*,/*login*                                   #sso排除拦截地址列表,用逗号隔开。

#sso server url config
sso.server.authentication=/sso/authentication
sso.server.validateTicket=/sso/validateTicket
sso.server.ssoLogoutUrl=/sso/signout
sso.server.signin=/sso/signin
sso.server.error=ssoerror

#sso notification type http|rabbitmq
sso.notification.type=http

#rabbitmq config
rabbitmq.server=192.168.54.204
rabbitmq.port=5672
rabbitmq.username=admin
rabbitmq.password=admin
rabbitmq.exchange=sso_topic

运行系统

  1. 修改Host文件:域名方式访问信任系统,模拟跨域与线上真实环境
  2. 使用tomcat发布运行系统xjj_sso和xjj_sso_client系统
  3. 使用http://clienta.sso.com进行登陆。看登陆能否成功。登陆成功后,再开一个浏览器tab.输入地址http://clientb.sso.com,查看它的登陆状态,如果还是登陆的,说明搭建成功。在服务端后台菜单【最近在线用户】中可以看到登陆的用户。
  4. 在host文件中添加内容
127.0.0.1 clienta.sso.com
127.0.0.1 clientb.sso.com

技术交流

  1. QQ群:174266358
The MIT License (MIT) Copyright (c) 2018 指间遗憾 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.

简介

xjj_sso是基于SSM快速开发框架xjj的一款单点登陆服务实现。可以帮助企业快速搭建单点登陆服务,使用户一次登陆就可以畅游于企业各应用服务。 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/zhanghejie/xjj_sso.git
git@gitee.com:zhanghejie/xjj_sso.git
zhanghejie
xjj_sso
xjj_sso
master

搜索帮助