码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS安装CAS 5.3.4服务端

时间:2019-01-16 21:46:20      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:sid   efault   apach   query   连接数   md5   code   sch   服务   

下载cas-overlay
https://github.com/apereo/cas-overlay-template/tree/5.3

解压cas-overlay-template-5.3.zip
进入cas-overlay-template-5.3目录
执行:mvn clean package
将生成的cas目录复制到tomcat下

利用maven为cas下载连接数据库的依赖包
pom.xml内容如下:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>fxma</groupId>
    <artifactId>Word2Html</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Word2Html</name>
    <url>http://maven.apache.org</url>

<dependencies>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-jdbc-drivers</artifactId>
            <version>${cas.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apereo.cas</groupId>
            <artifactId>cas-server-support-jdbc</artifactId>
            <version>${cas.version}</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.12</version>
        </dependency>

    </dependencies>

    <properties>
        <cas.version>5.3.4</cas.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mysql.driver.version>8.0.12</mysql.driver.version>
    </properties>
</project>

mvn -f pom.xml dependency:copy-dependencies

将下载的jar包复制到cas的lib目录下

设置cas的配置文件application.properties

将默认的静态用户名和密码配置注释掉

#cas.authn.accept.users=casuser::Mellon

增加如下内容:

#配置数据库连接
cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/dsideal_db?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
#数据库用户名
cas.authn.jdbc.query[0].user=root
#数据库密码
cas.authn.jdbc.query[0].password=123456
#mysql驱动
cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver

#添加jdbc认证
cas.authn.jdbc.query[0].sql=SELECT * FROM login WHERE login_name =?
#哪个字段作为密码字段
cas.authn.jdbc.query[0].fieldPassword=login_password
#哪个字段作为过期字段 0:未过期  1:已过期
cas.authn.jdbc.query[0].fieldExpired=expired
#哪个字段作为是否可用字段 0:未禁用  1:已禁用
cas.authn.jdbc.query[0].fieldDisabled=disabled

注:如上配置为明文密码

增加密码MD5加密配置

修改配置文件application.properties增加如下内容:

#配置加密策略
cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULT
cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5

 

CentOS安装CAS 5.3.4服务端

标签:sid   efault   apach   query   连接数   md5   code   sch   服务   

原文地址:https://www.cnblogs.com/xiaofengfree/p/10279359.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!