网站建设资讯

NEWS

网站建设资讯

CAS4.0连接mysql数据库的详细步骤-创新互联

本文主要给大家介绍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代码  CAS4.0连接mysql数据库的详细步骤

  1.     org.jasig.cas

  2.     cas-server-support-jdbc

  3.     ${project.version}

  4.     jar

  5.     commons-dbcp

  6.     commons-dbcp

  7.     1.4

  8.     mysql

  9.     mysql-connector-java

  10.     5.1.6

 CAS4.0连接mysql数据库的详细步骤

二:

本地创建数据库,并新建表 cas_user,创建语句如下载

Sql代码  CAS4.0连接mysql数据库的详细步骤

  1. create table cas_user (

  2.     id bigint not null auto_increment,

  3.     email varchar(255),

  4.     username varchar(255) not null unique,

  5.     name varchar(255),

  6.     password varchar(255),

  7.     primary key (id)

  8. ) ENGINE=InnoDB;

三:

配置数据库相关文件,在tomcat-for-cas\webapps\cas\WEB-INF\deployerConfigContext.xml中配置对应的datasource,数据库地址,用户名,密码,以及查询用户的sql。需要注意的是,如果是自己建的表,要把相应的字段名,数据库名替换掉,以及,不要忘记注释掉默认用户名密码的配置(casuser/Mellon)。下载以下配置可以全拷贝

Xml代码  CAS4.0连接mysql数据库的详细步骤

  1.        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  2.        xmlns:p="http://www.springframework.org/schema/p"

  3.        xmlns:c="http://www.springframework.org/schema/c"

  4.        xmlns:tx="http://www.springframework.org/schema/tx"

  5.        xmlns:util="http://www.springframework.org/schema/util"

  6.        xmlns:sec="http://www.springframework.org/schema/security"

  7.        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd

  8.        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd

  9.        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd

  10.        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

  11.       下载

  12.     

  13.         

  14.             

  15.                 

  16.                     

  17.                  

  18.             

  19.         

  20.         

  21.         

  22.         

  23.             

  24.         

  25.     

  26.     

  27.     

  28.           class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"

  29.           p:httpClient-ref="httpClient" p:requireSecure="true" />

  30.     

  31.     

  32.           class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">

  33.           

  34.           

  35.     

  36.     

  37.     

  38.           class="org.jasig.cas.authentication.principal.BasicPrincipalResolver" />

  39.     

  40.     

  41.           class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver" >

  42.         

  43.     

  44.     

  45.     

  46.             p:backingMap-ref="attrRepoBackingMap" />

  47.     

  48.         

  49.         

  50.         

  51.     

  52.     

  53.     

  54.             p:registeredServices-ref="registeredServicesList" />

  55.     

  56.         

  57.               p:id="0" p:name="HTTP and IMAP" p:description="Allows HTTP(S) and IMAP(S) protocols"

  58.               p:serviceId="^(https?|imaps?)://.*" p:evaluationOrder="10000001" />

  59.         

  60.         

  61.     

  62.     

  63.     

  64.     下载

  65.     

  66.       

  67.       

  68.       

  69.           p:ticketRegistry-ref="ticketRegistry"

  70.           p:serviceTicketCountWarnThreshold="5000"

  71.           p:sessionCountWarnThreshold="100000" />

  72.     

  73.     

  74.                    

  75.                            com.mysql.jdbc.Driver

  76.                    

  77.                    

  78.                             jdbc:mysql://localhost:3306/test

  79.                    

  80.                    

  81.                             root

  82.                    

  83.                    

  84.                             123456

  85.                    

  86.     

  87.     

  88.   class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">

  89.   

  90.   

  91.    value="select username,password from cas_user where {0}" />

  92.   

  93.   

  94.    

  95.        

  96.     

  97.     

  98.    

  99.   

  100.   

  101.    

  102.        

  103.     

  104.     

  105.    

  106.   

  107.  

看完以上关于CAS4.0连接mysql数据库的详细步骤,很多读者朋友肯定多少有一定的了解,如需获取更多的行业知识信息 ,可以持续关注我们的行业资讯栏目的。

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


文章标题:CAS4.0连接mysql数据库的详细步骤-创新互联
网页路径:http://cdweb.net/article/pjpeg.html