以此方式,完成了cas-web-client,并为另一个Web客户端cas-web-client2制作了副本:

启动Cas Server所在的tomcat(Tomcat1),然后启动Web客户端所在的tomcat(Tomcat2). 目前,我们访问了两个Web客户端:
: 8080 / cas-web-client / index.jsp
: 8080 / cas-web-client2 / index.jsp
您将重置为想到CAS Server登录界面,其中一个成功登录(您将看到相应的index.jsp),然后刷新另一个(您还可以看到相应的index.jsp,因为您已经登录),即使服务器和客户端配置都正确.
-------------------------------- ------ -------

1. 创建一个新的WEB项目cas-auth-server,您需要将cas-server-webapp-3.5.2.war中的资源复制到该项目,然后在下载包中查看cas-server-webapp的源代码. 在该项目中,由于基于的身份验证,必须将cas-server-support-jdbc-3.5.2.jar和mysql-connector驱动程序包复制到WEB-INF / lib目录,该目录构成了一个纯cas服务器项目当然,您也可以通过maven进行构建,官方网站上也有说明,如图所示:
2. 我们要做的是修改一些配置,即WEB-INF / deployerConfigContext.xml文件,首先配置mysql数据源:

<!-- DataSource,根据你的环境来定 -->
<bean id="mysqlDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://192.168.141.129:3306/blog?useUnicode=true&characterEncoding=utf-8"/>
<property name="username" value="mysqladmin" />
<property name="password" value="mysqladmin" />
</bean>
3. 修改authenticationManagerbean的属性authenticationHandlers:
<property name="authenticationHandlers">
<list>
<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" p:httpClient-ref="httpClient" />
<!--注释掉默认的的认证实现<bean
class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />-->
<!-- 查询认证处理器 -->
<bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="dataSource" ref="mysqlDataSource"/>
<property name="sql"
value="select password from t_user where username = ?" />
<property name="passwordEncoder" ref="myPasswordEncoder"></property>
</bean>
</list>
</property>
<!-- 自己定义的密码转译器,你可以自己定义,也可以用CAS提供的 -->
<bean id="myPasswordEncoder" class="org.jasig.cas.custom.encoder.MyPasswordEncoder" />

此配置已完成,将war软件包导出到项目并将其部署到运行tomcat1的计算机上. 效果将与以前相同.
工作已关闭.
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-169961-2.html
海军总吨位已经超过了北洋水师
考验党维护祖国领土不受外来侵略的时候到了
应该大力提升女性的经济地位