1.从github上获取
https://github.com/apereo/cas-overlay-template
2.shell窗口构建脚本
右键,进入shell
当前目录下运行.\build.cmd run
3.当出现端口被占用的情况下,
如果是别的端口,关闭之后重新运行
如果端口是 java.exe 进行以下操作 (修改HTTP协议)
(1)在cas-overlay-template-5.3目录下创建src文件夹,在src中继续创建\main\resources 文件夹
(2)进入cas-overlay-template-5.3\target\cas\WEB-INF\classes目录,将services文件夹与application.properties文件复制到第(1)步中所创建的文件夹中
(3)修改复制后的application.properties文件
将 sever.port=8443 下的 这三句话进行注释(#注释)
#server.ssl.key-store=file:/etc/cas/thekeystore
#server.ssl.key-store-password=changeit
#server.ssl.key-password=changeit
在文件末尾加入以下两个配置项
cas.tgc.secure=false
cas.serviceRegistry.initFromJson=true
(4)修改services\HTTPSandIMAPS-10000001.json
增加http协议配置
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^(https|imaps|http)://.*",
"name" : "HTTPS and IMAPS",
"id" : 10000001,
"description" : "This service definition authorizes all application urls that support HTTPS and IMAPS protocols.",
"evaluationOrder" : 10000
}
(5)再次执行.\build.cmd run 命令
4.出现reday 图样为成功
5.验证是否成功
浏览器访问:http://localhost:8443/cas
输入默认用户名casuser与密码Mellon,点击登录按钮
显示登录成功为成功
=========================================================================
连接数据库
1.引入相关依赖
以postgreSQL为例
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-jdbc</artifactId>
<version>${cas.version}</version>
</dependency>
<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-authentication</artifactId>
<version>${cas.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.25</version>
</dependency>
2.配置application.properties文件。 以下以postgreSQL为例
cas.authn.jdbc.query[0].url=jdbc:postgresql://127.0.0.1:5432/asset
cas.authn.jdbc.query[0].user=xxx
cas.authn.jdbc.query[0].password=xxx
cas.authn.jdbc.query[0].sql=select password from sys_user WHERE login_name=?
cas.authn.jdbc.query[0].fieldPassword=password
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.PostgreSQLDialect
cas.authn.jdbc.query[0].driverClass=org.postgresql.Driver
3.JDBC加密
#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
解释:
QueryJdbcAuthenticationProperties中有一个加密的对象PasswordEncoderProperties,主要支持如下几种加密方式:
NONE 不加密(默认的)
DEFAULT 使用encodingAlgorithm来定义加密方式(MD5,SHA)
STANDARD 标准加密,使用1024的SHA-256散列迭代和随机8字节随机盐值进行加密。
BCRYPT 使用BCryptPasswordEncoder方法加密
SCRYPT 使用SCryptPasswordEncoder方法加密
PBKDF2 使用Pbkdf2PasswordEncoder方法加密
本文介绍如何从GitHub获取CAS源码并完成部署过程,包括解决端口冲突问题及配置HTTP协议支持。此外,还详细说明了如何配置CAS使用PostgreSQL数据库进行身份验证。
1409

被折叠的 条评论
为什么被折叠?



