count++; context.getFlowScope().put(\ return handlerError.getSimpleName(); } } } } final String messageCode = this.messageBundlePrefix + UNKNOWN; logger.trace(\by default...\messageContext.addMessage(new MessageBuilder().error().code(messageCode).build()); count++; context.getFlowScope().put(\return UNKNOWN; } 5.7. 修改配置cas-servlet.xml
修改src\\main\\webapp\\WEB-INF\\cas-servlet.xml 的 CaptchaVaditeAuthenticationViaFormAction 及 5.8. 修改配置login-webflow.xml 修改src\\main\\webapp\\WEB-INF\\login-webflow.xml文件,该文件采用了spring-web-flow.在这里定义描述了整个cas server的登录校验认证流程。接下来,需要在登录属性表单中添加验证码字段及添加修改有关涉及到验证码校验的流程 替换原来的credential配置为UsernamePasswordCaptchaCredential 通常情况下,cas server认证成功后返回的属性字段很少,但在很多场合下登录后需要获取到许多字段属性。这时候我们就需要个性化来定制cas server返回的字段属性了。这里为了方便演示期间,创建了一个MultipleAttributeUserDao类,并重写了IPersonAttributes方法,在这里模拟了一些字段属性。在生产环境时,可将该部分代码替换,根据业务需求换成从数据库中查询的业务逻辑代码。 6.1. 创建MultipleAttributeUserDao模拟用户自定义属性 package org.jasig.services.persondir.support; import org.jasig.services.persondir.IPersonAttributes; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 扩展用户自定义属性 * Created by Administrator on 2016/4/30 0030. */ public class MultipleAttributeUserDao extends StubPersonAttributeDao { @Override public IPersonAttributes getPerson(String uid) { Map 修改src\\main\\webapp\\WEB-INF\\deployerConfigContext.xml文件,添加配置我们自定义的MultipleAttributeUserDao 6.3. 修改casServiceValidationSuccess.jsp 至此为了能获取到我们的自定义属性还不需要修改src\\main\\webapp\\WEB-INF\\view\\jsp\\protocol\\2.0\\casServiceValidationSuccess.jsp和src\\main\\webapp\\WEB-INF\\view\\jsp\\protocol\\3.0\\casServiceValidationSuccess.jsp文件。添加获取用户自定义属性的代码块。 src\\main\\webapp\\WEB-INF\\view\\jsp\\protocol\\2.0\\casServiceValidationSuccess.jsp <%-- <%@ page session=\<%@ taglib prefix=\<%@ taglib uri=\ 当cas server被正式用在生产环境时,她需要支撑各个应用系统的登录服务。而cas server只进行一处部署时,这里就存在一个单点故障的问题。一旦出现该问题,就会导致各个应用系统无法正常登录。次问题是极为严重的。因此我们在线上使用的时候就需要将cas server进行集群部署,可cas server相对于其他web应用集群部署有所不同。我们知道cas server的用户身份校验是基于cas ticket的。Cas默认的ticket管理策略是不具备集群部署时ticket同步的。这里就需要我们自行拓展,以达到集群部署时ticket也能同步。 7.1. 添加redis依赖 在这里我们使用redis缓存策略来同步管理cas ticket。因此需要添加redis依赖