本文主要给大家介绍CAS4.0连接mysql数据库的详细步骤,文章内容都是笔者用心摘选和编辑的,具有一定的针对性,对大家的参考意义还是比较大的,下面跟笔者一起了解下CAS4.0连接mysql数据库的详细步骤吧。

步骤如下
一:
在cas-4.0.0\cas-server-webapp\pom.xml中添加依赖后(如下方所示),打开cmd在cas-4.0.0\cas-server-webapp文件夹下运行mvn clean package,然后将cas-4.0.0\cas-server-webapp\target下的cas.war包部署至tomcat
Xml代码  
- org.jasig.cas 
- cas-server-support-jdbc 
- ${project.version} 
- jar 
- commons-dbcp 
- commons-dbcp 
- 1.4 
- mysql 
- mysql-connector-java 
- 5.1.6 
 
二:
本地创建数据库,并新建表 cas_user,创建语句如下载
Sql代码  
- create table cas_user ( 
- id bigint not null auto_increment, 
- email varchar(255), 
- username varchar(255) not null unique, 
- name varchar(255), 
- password varchar(255), 
- primary key (id) 
- ) ENGINE=InnoDB; 
三:
配置数据库相关文件,在tomcat-for-cas\webapps\cas\WEB-INF\deployerConfigContext.xml中配置对应的datasource,数据库地址,用户名,密码,以及查询用户的sql。需要注意的是,如果是自己建的表,要把相应的字段名,数据库名替换掉,以及,不要忘记注释掉默认用户名密码的配置(casuser/Mellon)。下载以下配置可以全拷贝
Xml代码  
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
- xmlns:p="http://www.springframework.org/schema/p" 
- xmlns:c="http://www.springframework.org/schema/c" 
- xmlns:tx="http://www.springframework.org/schema/tx" 
- xmlns:util="http://www.springframework.org/schema/util" 
- xmlns:sec="http://www.springframework.org/schema/security" 
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd 
- http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd 
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> 
- 下载 
- class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" 
- p:httpClient-ref="httpClient" p:requireSecure="true" /> 
- class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler"> 
- class="org.jasig.cas.authentication.principal.BasicPrincipalResolver" /> 
- class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver" > 
- p:backingMap-ref="attrRepoBackingMap" /> 
- p:registeredServices-ref="registeredServicesList" /> 
- p:id="0" p:name="HTTP and IMAP" p:description="Allows HTTP(S) and IMAP(S) protocols" 
- p:serviceId="^(https?|imaps?)://.*" p:evaluationOrder="10000001" /> 
- 下载 
- p:ticketRegistry-ref="ticketRegistry" 
- p:serviceTicketCountWarnThreshold="5000" 
- p:sessionCountWarnThreshold="100000" /> 
- com.mysql.jdbc.Driver 
- jdbc:mysql://localhost:3306/test 
- root 
- 123456 
- class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao"> 
- value="select username,password from cas_user where {0}" /> 
看完以上关于CAS4.0连接mysql数据库的详细步骤,很多读者朋友肯定多少有一定的了解,如需获取更多的行业知识信息 ,可以持续关注我们的行业资讯栏目的。
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
文章名称:CAS4.0连接mysql数据库的详细步骤-创新互联
当前链接:http://www.scyingshan.cn/article/pjpeg.html

 建站
建站
 咨询
咨询 售后
售后
 建站咨询
建站咨询 
 