一、配置文件介绍关于spring的配置信息只需放入WEB-INF/spring-configuration目录即可,cas启动时会自动加载。这个目录下的spring配置文件几乎不需要改动。 在web.xml中配置
在WEB-INF/spring-configuration中 1./WEB-INF/spring-configuration/applicationContext.xml 2./WEB-INF/spring-configuration/argumentExtractorsConfiguration.xml 3./WEB-INF/spring-configuration/propertyFileConfigurer.xml 4./WEB-INF/spring-configuration/securityContext.xml 5./WEB-INF/spring-configuration/ticketExpirationPolicies.xml 6./WEB-INF/spring-configuration/ticketGrantingTicketCookieGenerator.xml 7./WEB-INF/spring-configuration/ticketRegistry.xml 8./WEB-INF/spring-configuration/uniqueIdGenerators.xml 在WEB-INF/中 1./WEB-INF/cas-servlet.xml 2./WebContent/WEB-INF/deployerConfigContext.xml 3./WEB-INF/login-webflow.xml 4./WEB-INF/restlet-servlet.xml 二、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 ="initialFlowSetupAction" />这些定义在cas-servlet.xml中 3、view-state里面的view定义在default_views.properties中 3.2实例说明<evaluate ="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 ="authenticationViaFormAction.doBind(flowRequestContext, flowScope.credentials)" /> </transition> </view-state> 对应的是casLoginView.jsp 在这里对一些页面变量和对应的java类进行了绑定 action state <action-state id="realSubmit">
<evaluate ="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方法,并根据返回值到不同的分支
|
|
来自: jackeyqing > 《学习整理360doc》