一、配置文件介绍

关于spring的配置信息只需放入WEB-INF/spring-configuration目录即可,cas启动时会自动加载。这个目录下的spring配置文件几乎不需要改动。

在web.xml中配置

在WEB-INF/spring-configuration中

1./WEB-INF/spring-configuration/applicationContext.xml
这个配置文件是cas的核心类配置,你不需要改动。

2./WEB-INF/spring-configuration/argumentExtractorsConfiguration.xml
这个配置文件主要是cas参数的提取。比如从应用端重定向到cas 服务器的url地址中的service参数,为什么cas认识,service起什么作用,换一参数名,是否可以?就是这里配置的类来处理的。但是这个你也不需要改动,cas默认是支持cas1.0,cas2.0及saml协议的。

3./WEB-INF/spring-configuration/propertyFileConfigurer.xml
加载cas.properties文件。

4./WEB-INF/spring-configuration/securityContext.xml
关于安全上下文配置,比如登出,认证等,一般情况下不需要改动它

5./WEB-INF/spring-configuration/ticketExpirationPolicies.xml
从文件名就可以知道,它是关于ticket的过期策略配置的,包括ST,TGT.

6./WEB-INF/spring-configuration/ticketGrantingTicketCookieGenerator.xml
关于cookie的生成

7./WEB-INF/spring-configuration/ticketRegistry.xml
ticket的存储

8./WEB-INF/spring-configuration/uniqueIdGenerators.xml
ticket Id生成器

在WEB-INF/中

1./WEB-INF/cas-servlet.xml
spring mvc的启动类配置

2./WebContent/WEB-INF/deployerConfigContext.xml
cas的认证管理器,认证管理都在这个文件里,可以说进行cas开发,你需要更改的文件中,这是第一个。

3./WEB-INF/login-webflow.xml
spring web flow的流程配置文件。读懂了这个文件就可以了解cas的登录流程。

4./WEB-INF/restlet-servlet.xml
关于cas 的restlet对外接口服务的.

二、login-webflow配置信息

1、web.xml中,login-webflow的入口,如下/login,/remoteLogin

2、cas-servlet.xml中,在flow-registry里面注册webflow

3、cas-servlet.xml中,配置主题信息,可以定位到对应的css、js、jsp路径

  上图,在cas.properties中,找到cas.viewResolver.basename

  通过配置文件知道页面信息配置在default_views.properties文件中

三、web-flow.xml流程介绍

3.1基本介绍

  1、on-start(start-state)流程开始,end-state流程结束 decision-state判断,类似于if,view-state对应jsp页面 action-state对应执行程序的某段

  2、<evaluate expression="initialFlowSetupAction" />这些定义在cas-servlet.xml中

  3、view-state里面的view定义在default_views.properties中

3.2实例说明

<evaluate expression="initialFlowSetupAction" />

这句话的意思是执行

org.jasig.cas.web.flow.InitialFlowSetupAction中的doExecute方法

其中的变量都由spring注入了

具体看对应的配置文件

然后下一个流程是

<decision-state id="ticketGrantingTicketExistsCheck">
  <if test="flowScope.ticketGrantingTicketId neq null" then="hasServiceCheck" else="gatewayRequestCheck" />
 </decision-state>

进行判断

flowScope.ticketGrantingTicketId

这个在org.jasig.cas.web.flow.InitialFlowSetupAction中由

context.getFlowScope().put(
            "ticketGrantingTicketId", this.ticketGrantingTicketCookieGenerator.retrieveCookieValue(request));

这句话放入了,然后在这儿进行检测neq null是不为null的意思

then else都很好理解

view state


<view-state id="viewLoginForm" view="casLoginView" model="credentials">
        <var name="credentials" class="org.jasig.cas.authentication.principal.UsernamePasswordCredentials" />
        <binder>
            <binding property="username" />
            <binding property="password" />
        </binder>
        <on-entry>
            <set name="viewScope.commandName" value="'credentials'" />
        </on-entry>
  <transition on="submit" bind="true" validate="true" to="realSubmit">
            <set name="flowScope.credentials" value="credentials" />
            <evaluate expression="authenticationViaFormAction.doBind(flowRequestContext, flowScope.credentials)" />
        </transition>
 </view-state>

对应的是casLoginView.jsp

在这里对一些页面变量和对应的java类进行了绑定

action state


<action-state id="realSubmit">
        <evaluate expression="authenticationViaFormAction.submit(flowRequestContext, flowScope.credentials, messageContext)" />
  <transition on="warn" to="warn" />
  <transition on="success" to="sendTicketGrantingTicket" />
  <transition on="error" to="viewLoginForm" />
 </action-state>

执行对应的方法,这儿执行org.jasig.cas.web.flow.AuthenticationViaFormAction中的

submit方法,并根据返回值到不同的分支

CAS学习笔记(二)—— cas server端的login-webflow详细流程的更多相关文章

  1. Netty学习笔记(二) 实现服务端和客户端

    在Netty学习笔记(一) 实现DISCARD服务中,我们使用Netty和Python实现了简单的丢弃DISCARD服务,这篇,我们使用Netty实现服务端和客户端交互的需求. 前置工作 开发环境 J ...

  2. CAS学习笔记二:CAS单点登录流程

    背景 由于公司项目甲方众多,各甲方为了统一登录用户体系实现单点登录(SSO)开始要求各乙方项目对接其搭建的CAS单点登录服务,有段时间对CAS的流程很迷,各厂商还有基于CAS进行二次开发的情况,所以对 ...

  3. CAS学习笔记五:SpringBoot自动/手动配置方式集成CAS单点登出

    本文目标 基于SpringBoot + Maven 分别使用自动配置与手动配置过滤器方式实现CAS客户端登出及单点登出. 本文基于<CAS学习笔记三:SpringBoot自动/手动配置方式集成C ...

  4. AJax 学习笔记二(onreadystatechange的作用)

    AJax 学习笔记二(onreadystatechange的作用) 当发送一个请求后,客户端无法确定什么时候会完成这个请求,所以需要用事件机制来捕获请求的状态XMLHttpRequest对象提供了on ...

  5. [Firefly引擎][学习笔记二][已完结]卡牌游戏开发模型的设计

    源地址:http://bbs.9miao.com/thread-44603-1-1.html 在此补充一下Socket的验证机制:socket登陆验证.会采用session会话超时的机制做心跳接口验证 ...

  6. JMX学习笔记(二)-Notification

    Notification通知,也可理解为消息,有通知,必然有发送通知的广播,JMX这里采用了一种订阅的方式,类似于观察者模式,注册一个观察者到广播里,当有通知时,广播通过调用观察者,逐一通知. 这里写 ...

  7. python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法

    python3.4学习笔记(二十四) Python pycharm window安装redis MySQL-python相关方法window安装redis,下载Redis的压缩包https://git ...

  8. 学习笔记:CentOS7学习之二十一: 条件测试语句和if流程控制语句的使用

    目录 学习笔记:CentOS7学习之二十一: 条件测试语句和if流程控制语句的使用 21.1 read命令键盘读取变量的值 21.1.1 read常用见用法及参数 21.2 流程控制语句if 21.2 ...

  9. MongoDB学习笔记二- Mongoose

    MongoDB学习笔记二 Mongoose Mongoose 简介 之前我们都是通过shell来完成对数据库的各种操作, 在开发中大部分时候我们都需要通过程序来完成对数据库的操作 而Mongoose就 ...

  10. WPF的Binding学习笔记(二)

    原文: http://www.cnblogs.com/pasoraku/archive/2012/10/25/2738428.htmlWPF的Binding学习笔记(二) 上次学了点点Binding的 ...

随机推荐

  1. 未能加载文件或程序集“System.Data.SQLite”或它的一个依赖。试图加载格式不正确的程序

    Go to the IIS7 Application Pool -> advanced settings and set the 32-bit application to true.

  2. 2016 Multi-University Training Contest 4

    6/12 2016 Multi-University Training Contest 4官方题解 KMP+DP A Another Meaning(CYD) 题意: 给一段字符,同时给定你一个单词, ...

  3. android4.4源码下载简介

    1. $sudo apt-get install git-core curl2. mkdir ~/bin PATH=~/bin:$PATH3. curl http://commondatastorag ...

  4. java文件下载,上传,解压方法

    1.文件下载(亲测可用) private static final int BUFFER = 2 * 1024;// 缓冲区大小(2k)private boolean isSuccess = true ...

  5. PHP性能监测的工具介绍 - XHProf

    http://segmentfault.com/a/1190000003509917 http://www.cnblogs.com/casatwy/archive/2013/01/17/2865241 ...

  6. Proguard参数

    参数:?-include?{filename}?从给定的文件中读取配置参数?-basedirectory?{directoryname}?指定基础目录为以后相对的档案名称?-injars?{class ...

  7. Linux用过的命令

    -上传sudo -u b2b rz--创建文件夹sudo -u b2b mkdir--copysudo -u b2b cp /b2b/apache-tomcat-7.0.64/matt/DqN017S ...

  8. Alamofire 的使用

    最近,AFNetworking 的作者Mattt Thompson提交了一个新的类似于 AFNetworking 的网络 基础库,并且是专门使用最新的 Swift 语言来编写的,名为:Alamofir ...

  9. Week 1:2015/4/27~2015/5/3

    Update everyday.(Last edit:4/30 01:00) Task 1:TPO X 2.5(finish 1,then finish 2 more) Task 2:TC Tarja ...

  10. argparse解析参数模块

    一.简介: argparse是python用于解析命令行参数和选项的标准模块,用于代替已经过时的optparse模块.argparse模块的作用是用于解析命令行参数,例如python parseTes ...