CAS客户端获取更多用户信息概要.doc

  1. 1、本文档共10页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
CAS客户端获取更多用户信息概要

CAS客户端获取更多用户信息 总述 首先,我是用的CAS Server版本是3..2,Servlet容器是Tomcat 程序中也可能遇到需要得到更多如姓名,手机号,email等更多用户信息的情况。 cas各种版本配置方式也不尽相同,这里讲的是3..2版本。 此文章中 CAS 基础环境: cas-server-3.5.2 CAS客户端:cas-client-3.2.1 第一种方式 服务器端配置 ? 一、首先需要配置属性attributeRepository 首先,你需要到WEB-INF目录找到? deployerConfigContext.xml文件,同时配置 attributeRepository 如下:? bean??class=org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao id=attributeRepository ????????constructor-arg index=0 ref=dataSource/ ????????constructor-arg index=1 value=select * from lead_system_user where {0}/ ????????property name=queryAttributeMapping ????????????map ????????????????entry key=username value=login_name/?? // 这里的key需写username,value对应数据库用户名字段 ????????????/map ????????/property ????????property name=resultAttributeMapping ????????????map ????????????????entry key=user_name value=user_name/ ????????????????entry key=user_mobile value=user_mobile/ ????????????????entry key=user_email value=user_email/ ????????????/map ????????/property ????/bean 其中: queryAttributeMapping 是组装sql用的查询条件属性,上述配置后,结合封装成查询sql就是?select * from where login_name=#username# resultAttributeMapping 是sql执行完毕后返回的结构属性,?key对应数据库字段,value对应客户端获取参数。 ?? 二、配置用户认证凭据转化的解析器 也是在 deployerConfigContext.xml 中,找到 credentialsToPrincipalResolvers,为 UsernamePasswordCredentialsToPrincipalResolver 注入 attributeRepository,那么 attributeRepository 就会被触发并通过此类进行解析,红色为新添部分。 property name=credentialsToPrincipalResolvers ????????????list???????? ????????????????bean class=org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver ????????????????????property name=attributeRepository ref=attributeRepository/ ????????????????/bean ????????????????bean class=org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver/ ????????????/list ?/property 三、registeredServices 修改?deployerConfigContext.xml 中的?org.jasig.cas.services.InMemoryServiceRegistryDaoImpl 的属性?registeredServices 修改?registeredServices??列表中的每个协议中的 allowedAttributes 属性的值。列出的每个

您可能关注的文档

文档评论(0)

yaocen + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档