SSO(Single Sign On)单点登录系统,是在多个系统中值要求只要登录一次,就可以用已登录的身份访问多个系统,去掉了每次访问不同的系统都要重新登录的弊端。

CAS(中央/集中认证服务):The Central Authentication Service project, more commonly referred to as CAS is an authentication system originally created by Yale University to provide a trusted way for an application to authenticate a user.

CAS是实现SSO的一个开源项目,最初由耶鲁大学创建。很明显冲名字就可以看出其原理是:多个系统使用一个相同的“中央认证服务”来实现的。

1. CAS 架构

1) 系统组成:分成了一个 CAS server 和 多个CAS clients 两大物理组成部分。

2)CAS Clients

The term “CAS client” has two distinct meanings in its common use. A CAS client is any CAS-enabled application that can communicate with the server via a supported protocol. A CAS client is also a software package that can be integrated with various software platforms and applications in order to communicate with the CAS server via some authentication protocol (e.g. CAS, SAML, OAuth). CAS clients supporting a number of software platforms and products have been developed.

CAS clients: 也就是 多个业务系统。我们用户在访问业务系统时,业务系统作为 CAS client, 来访问CAS server进行认证。实现方式是,将我们redirect到CAS server上,然后我们输入用户名密码,CAS server进行认证。所以相对于CAS server,我们用浏览器访问多个业务系统就是 CAS clients。

3)CAS Server

The CAS server is Java servlet built on the Spring Framework whose primary responsibility is to authenticate users and grant access to CAS-enabled services, commonly called CAS clients, by issuing and validating tickets. An SSO session is created when the server issues a ticket-granting ticket (TGT) to the user upon successful login. A service ticket (ST) is issued to a service at the user’s request via browser redirects using the TGT as a token. The ST is subsequently validated at the CAS server via back-channel communication. These interactions are described in great detail in the CAS Protocol document.

CAS server是一个基于spring的系统,其首要职责就是对登录用户进行认证,然后授权给它们去访问“业务系统”也就是CAS clients。其实现方式:发出票据和验证票据。比如,一个用户要登录一个“业务系统A”,那么该业务系统,将我们重定向到 CAS server, 然后我们输入用户名和密码等,然后CAS server进行认证,也就是验证用户名和密码是否正确,如果正确,就发给我们一个 TGT 票据,然后针对该“业务系统A”, CAS server 又根据TGT 生产一个专门针对该业务系统的 ST 票据。然后如果我们又去访问另外一个“业务系统B”,那么这个“业务系统B”又将我们重定向到 CAS server,但是这一次,我们携带了 TGT 票据,我们不用再次输入用户名和密码,CAS server 会根据我们的 TGT 针对该“业务系统B” 又生产一个专门针对该业务系统的 ST 票据。 然后我们又要访问“业务系统A”,此时我们有了 TGT 和 针对“业务系统A”的 ST 票据,这次,业务系统A会将自己的 ST 票据,发送给 CAS server 进行验证,如果存在。那么就认证通过。

总结一下:

1>第一次没有 TGT 和 ST 票据,需要输入 用户名和密码 在 CAS server上进行认证;

2>认证通过之后会 生成  TGT 票据和针对该 CAS client 的 ST 票据;

3>有了 ST 票据之后,CAS client 将 ST 票据发送给 CAS server 进行查找,如果存在则通过认证;

4>如果只有 TGT 票据,那么将 TGT 票据发给 CAS server,生成一个专门针对该 CAS client 的 ST 票据;

5> TGT 票据应该是基于cookie,也就是保存在cookie中的,而各个业务系统的 ST 票据是保存在自己的业务系统的内存中的;

4)第一次登陆时的交互过程:

5)Software Components

It is helpful to describe the CAS server in terms of three layered subsystems:

  • Web (Spring MVC/Spring Webflow)
  • Ticketing
  • Authentication

Almost all deployment considerations and component configuration involve those three subsystems. The Web tier is the endpoint for communication with all external systems including CAS clients. The Web tier delegates to the ticketing subsystem to generate tickets for CAS client access. The SSO session begins with the issuance of a ticket-granting ticket on successful authentication, thus the ticketing subsystem frequently delegates to the authentication subsystem.

The authentication system is typically only processing requests at the start of the SSO session, though there are other cases when

it can be invoked (e.g. forced authentication).

CAS Server 系统的架构有三部组成(三个子系统): 1> web端;2> 票据系统; 3>认证系统;

web端代理了 CAS clients,来向票据系统申请票据和验证票据,票据系统根据要求产生票据和验证票据;而认证系统就是对输入的用户名和密码进行验证,验证成功之后,通知票据系统生成票据。所以认证系统只有在第一次登陆时才会使用到。票据系统应该是三个子系统中最繁忙的。

参考:

1)http://jasig.github.io/cas/4.0.x/planning/Architecture.html

2)http://sowow.sinaapp.com/archives/57

3)http://jasig.github.io/cas/4.0.x/index.html

单点登录系统(SSO)之CAS(中央认证服务)的更多相关文章

  1. 单点登录系统SSO实现

    前些天被问到单点登录了,而据我当时做的这个模块两年了,现在重新温习并记录下,方便以后快速回忆起来 一.什么是单点登录系统 SSO全称Single Sign On.SSO是用户只需要登录一次就可以访问所 ...

  2. 单点登录系统(SSO)的开发思路

    单点登录并不是一个新鲜的玩意儿,比较官方的解释是企业业务整合的解决方案之一,通俗来讲SSO就是一个通用的用户中心,国内比较流行的UCenter就是一套单点登录解决方案.而近期以CSDN明文存储用户密码 ...

  3. 单点登录系统---SSO

    1.------------------SSO介绍--------------------------------- 有什么卵用?搞什么飞机的? 大家看看这个图,一个系统是没有问题.如果是分布式的系统 ...

  4. 多平台的网站实现单点登录系统(SSO)的开发思路 让你的会员中心更加统一(参考资料)

    单点登录并不是一个新鲜的玩意儿,比较官方的解释是企业业务整合的解决方案之一,通俗来讲SSO就是一个通用的用户中心,国内比较流行的UCenter就是一套单点登录解决方案.而近期以CSDN明文存储用户密码 ...

  5. 单点登录系统(SSO)详细设计说明书(上篇)

    1.引言 1.1编写目的 为了单点登录系统(SSO系统)的可行性,完整性,并能按照预期的设想实现该系统,特编写需求说明书.         同时,说明书也发挥与策划和设计人员更好地沟通的作用. 1.2 ...

  6. 第04项目:淘淘商城(SpringMVC+Spring+Mybatis)【第十天】(单点登录系统实现)

    https://pan.baidu.com/s/1bptYGAb#list/path=%2F&parentPath=%2Fsharelink389619878-229862621083040 ...

  7. 单点登录系统CAS筹建及取得更多用户信息的实现

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  8. CAS实现的单点登录系统

    单点登录(single sign on ),简称SSO. 纯属学习用,对来自网络的部分如果侵害了您的权力,请联系我.QQ:262800095 SSO的定义是在多个应用系统中,用户只需要登录一次就可以访 ...

  9. 【Java EE 学习 68】【单点登录】【两种单点登录类型:SSO/CAS、相同一级域名的SSO】

    单点登录:SSO(Single Sign On) 什么是单点登录:大白话就是多个网站共享一个用户名和密码的技术,对于普通用户来说,只需要登录其中任意一个网站,登录其他网站的时候就能够自动登陆,不需要再 ...

随机推荐

  1. 【推荐】iOS汉字转拼音第三方库

    PinYin4Objc是一个在git汉字转拼音的开源库,支持简体和繁体中文.效率POAPinyin等其他库要高,转换库也完整下面简单介绍 实现原理 使用unicode_to_hanyu_pinyin. ...

  2. IntelliTrace简介

    解决无法复现bug所使用的策略是在遇到bug时捕获尽可能多的信息,在使用IntelliTrace进行调试时可以充分利用这些信息.最令人称道的一个功能在于bug本身可以自动修复. 打开IntelliTr ...

  3. MVC bundle(包扎)CSS或是JS文件

    以前写asp.net网页时,会在<head>节点中引用很多样式文件或是javascript文件,如下图左大括号的引用语句. 现在在MVC应用程序中,可以使用使用Bundle来捆一起, 在S ...

  4. [CLR via C#]10. 属性

    一.无参属性 对于字段,强烈建议将所有的字段都设为private.如果允许用户或类型获取或设置状态信息,就公开一个针对该用途的方法.封装了字段访问的方法通常称为访问器(accessor)方法.访问器方 ...

  5. jquery实现表格中点击相应行变色功能

    对于一个表格,为了使我们选中的项更容易区分,需要为选中项添加高亮,同时也需要,将其他项的高亮形式去除.类似于: <!DOCTYPE html> <html lang="en ...

  6. 重新想象 Windows 8 Store Apps (37) - 契约: Settings Contract

    [源码下载] 重新想象 Windows 8 Store Apps (37) - 契约: Settings Contract 作者:webabcd 介绍重新想象 Windows 8 Store Apps ...

  7. 重新想象 Windows 8.1 Store Apps (72) - 新增控件: AppBar, CommandBar

    [源码下载] 重新想象 Windows 8.1 Store Apps (72) - 新增控件: AppBar, CommandBar 作者:webabcd 介绍重新想象 Windows 8.1 Sto ...

  8. Represent code in math equations

    Introduce The article shows a way to use math equations to represent code's logical. Key ideas logic ...

  9. java线程控制、状态同步、volatile、Thread.interupt以及ConcurrentLinkedQueue

    在有些严格的系统中,我们需要做到干净的停止线程并清理相关状态.涉及到这个主题会带出很多的相关点,简单的总结如下: 我们知道,在java中,有一个volatile关键字,其官方说明(https://do ...

  10. mysql=null的优雅解决方法

    对于不是采用所有字段都是not null的mysql表设计而言,mysql提供了一个<=>操作符. 在oracle中我们的处理方式通常类似: where a = #{var} or #{v ...