CAS 服务端3.5.2与客户端3.2.1配置
CAS服务端3.5.2 HTTP SSO 配置
四、数据库验证配置
配置数据源:
<bean id="casDataSource" class="http://www.77cn.com.cnmons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="jdbc:mysql://192.168.1.194:3306/authority"></property> <property name="username" value="root"></property> <property name="password" value="123456"></property> 在deployerConfigContext.xml中添加
<property name="maxActive" value="50"></property> <property name="maxIdle" value="30"></property> <property name="maxWait" value="500"></property> <property name="defaultAutoCommit" value="true"></property> </bean>
authenticationHandlers里添加
<bean class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler">
<property name="dataSource" ref="casDataSource" /> 数据源
<property name="tableUsers" value="user" /> 表名
<property name="fieldUser" value="user_name"/> 用户名字段
<property name="fieldPassword" value="psw"/>密码字段
</bean>
<bean id="passwordEncoder"
class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder" autowire="byName"> <constructor-arg value="MD5"/>
五,返回用户多个信息
<bean id="attributeRepository"
class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao"> <constructor-arg index="0" ref="casDataSource"/> <constructor-arg index="1" value="select user_code,user_name,name real_name,unit_code from <property name="queryAttributeMapping"> </bean> <property name="passwordEncoder" ref="passwordEncoder"/> 密码加密 user where user_name=?"/>
<map>
<entry key="username" value="user_name" /> 前面的key一定要是username,后面的user_name就是where后面的
</map>
</property>
<property name="resultAttributeMapping">
<map>
<!--key为对应的数据库字段名称,value为提供给客户端获取的属性名字,系统会自动填充值-->
<entry key="user_code" value="user_code"/> 前面是返回的,后面对应的字段名
<entry key="user_name" value="user_name"/> <entry key="real_name" value="real_name"/> <entry key="unit_code" value="unit_code"/>
</map>
</property>
修改
<bean class="org.jasig.cas.services.RegexRegisteredService">
<property name="id" value="0" />
<property name="name" value="HTTP and IMAP" />
<property name="description" value="Allows HTTP(S) and IMAP(S) protocols" /> <property name="serviceId" value="^(https?|imaps?)://.*" />
<property name="evaluationOrder" value="10000001" />
六.修改JSP文件
增加
<c:if
test="${fn:length(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes) > 0}">
<cas:attributes>
<c:forEach var="attr"
items="${assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes}">
<cas:${fn:escapeXml(attr.key)}>${fn:escapeXml(attr.value)}</cas:${fn:escapeXml(attr.key)}>
</c:forEach>
</cas:attributes>
</c:if>
<property name="allowedAttributes"> <list> <value>user_code</value> <value>real_name</value> <value>unit_code</value> </bean> </list> </property> </bean>
客户端配置:
客户端WEB.XML配置 <!-- cas client configure start -->
<filter> <filter-name>CAS Authentication Filter</filter-name>
<init-param> <param-name>casServerLoginUrl</param-name> <param-value>http://192.168.1.144:8000/cas</param-value> ilter-class> </init-param> <init-param> <param-name>serverName</param-name> <param-value>http://192.168.1.111:8080</param-value> </init-param> <init-param> <param-name>renew</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>gateway</param-name> <param-value>false</param-value> </init-param> </filter> <filter> <filter-name>CAS Validation Filter</filter-name> <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketVa <init-param> <param-name>casServerUrlPrefix</param-name> <param-value>http://192.168.1.144:8000/cas/</param-value> lidationFilter</filter-class> </init-param> <init-param> <param-name>serverName</param-name> <param-value>http://192.168.1.111:8080</param-value> </init-param> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </i …… 此处隐藏:2649字,全部文档内容请下载后查看。喜欢就下载吧 ……
相关推荐:
- [行业范文]美好的法语句子
- [行业范文]描写露珠的句子
- [行业范文]精彩禅语句子图片
- [行业范文]关于满嘴谎言的句子
- [行业范文]关于安静的句子48句
- [行业范文]关于小河的句子
- [行业范文]描写稻田的句子
- [行业范文]思念好朋友的句子
- [行业范文]赞美雪的句子
- [行业范文]早上激励人心的句子
- [行业范文]失恋忧伤的句子
- [行业范文]努力积极向上的句子
- [行业范文]对工作心灰意冷的句子
- [行业范文]失恋让人心疼的句子
- [行业范文]描写珍惜青春的句子
- [行业范文]表达思念的句子简短
- [行业范文]关于父爱的句子范例
- [行业范文]浪漫的英语句子
- [行业范文]关于周末的句子
- [行业范文]思念牵挂的句子
- 有关感恩班会课件简短(二篇)(感恩班会
- 2025年初二下乡军训心得体会800字(15篇
- 关于新员工培训方案汇编(关于新员工培
- 精选高考生寒假学习计划书(精)(高考生
- 毕业实训报告心得体会(3篇)(实训报告心
- 银行工作感悟及心得范文怎么写(四篇)(
- 精选领导干部个人政治画像报告通用(七
- 精选超市11.11活动促销方案(精品超市品
- 2025年怎么做自我介绍汇总(5篇)(至2025
- 最新企业错峰生产方案(26篇)(山西企业
- 最新暑期三下乡社会实践调研报告范本(
- 最新幼儿园大班教育教学总结怎么写(最
- 最新教师节主持词小学(优秀9篇)(教师节
- 关于小学安全教育教学方案(推荐)(关于
- 员工信模板范文怎么写(五篇)(员工信息
- 最新保险销售离职申请书(十六篇)(最新
- 最新XX小学防校园欺凌工作方案怎么写(2
- 有关特岗教师辞职信范文(推荐)(特岗教
- 精选党的建设工作要点简短(党的建设的
- 如何写安康杯竞赛活动总结汇总(4篇)(安




