热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

【工欲善其事必先利其器·单点登录】使用CASWAROverlays部署CAS

CASWAROverlays是CAS官网最为推荐的安装部署方式,为何最为推荐,可阅读《CAS部署建议》了解。本篇文章详细介绍CASWAROverlays

CAS WAR Overlays是CAS官网最为推荐的安装部署方式,为何最为推荐,可阅读《CAS 部署建议》了解。本篇文章详细介绍CAS WAR Overlays部署步骤。


一、安装JDK 11

安装JDK 11具体步骤本文不赘述,请另行参考。


二、下载CAS WAR Overlays 模板工程

项目下载地址:https://github.com/apereo/cas-overlay-template

使用git命令下载最新的CAS WAR Overlays 模板工程

git clone https://github.com/apereo/cas-overlay-template.git 


三、构建前准备

配置阿里云gradle镜像:

cd cas-overlay-template

vim build.gradle

将mavenCentral() 和 jcenter()注释掉,添加阿里的maven仓库地址,如下:

buildscript {repositories {mavenLocal()//mavenCentral()//jcenter()maven { url 'https://maven.aliyun.com/repository/google'}maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}maven { url 'https://maven.aliyun.com/repository/public'}maven { url 'https://maven.aliyun.com/repository/jcenter'}}dependencies {classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}"classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}"classpath "io.freefair.gradle:maven-plugin:${project.gradleMavenPluginVersion}"}
}repositories {mavenLocal()//mavenCentral()//jcenter()maven { url 'https://maven.aliyun.com/repository/google'}maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}maven { url 'https://maven.aliyun.com/repository/public'}maven { url 'https://maven.aliyun.com/repository/jcenter'}
}

四、构建项目

cd cas-overlay-template

./gradlew clean build 

如果您想观察详细构建过程和细节,可使用 --info 或 --debug 打印构建日志(示例:./gradlew clean build  --info)

[root@bogon cas-overlay-template]# ./gradlew clean build --info
Initialized native services in: /root/.gradle/native
Removing 0 daemon stop events from registry
Starting a Gradle Daemon (subsequent builds will be faster)
Starting process 'Gradle build daemon'. Working directory: /root/.gradle/daemon/5.6.3
……
BUILD SUCCESSFUL in 16s
3 actionable tasks: 3 executed

如果出现以下错误请切换其他分支进行构建:

例如切换到 6.1版本分支

git checkout 6.1

然后重新执行编译命令

五、查看CAS的gradlew的可用任务

./gradlew tasks

[root@bogon cas-overlay-template]# ./gradlew tasks> Task :tasks------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------Build tasks
-----------
allDependencies - Display a graph of all project dependencies
allDependenciesInsight - Produce insight information for all dependencies
assemble - Assembles the outputs of this project.
bootJar - Assembles an executable jar archive containing the main classes and their dependencies.
bootWar - Assembles an executable war archive containing webapp content, and the main classes and their dependencies.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
casVersion - Display the current CAS version
classes - Assembles main classes.
clean - Deletes the build directory.
copyCasConfiguration - Copy the CAS configuration from this project to /etc/cas/config
createKeystore - Create CAS keystore
debug - Debug the CAS web application in embedded mode on port 5005
executable - Run the CAS web application in standalone executable mode
explodeWar - Explodes the CAS archive and resources jar from the CAS web application archive
explodeWarOnly - Explodes the CAS web application archive
getResource - Fetch a CAS resource and move it into the overlay
jar - Assembles a jar archive containing the main classes.
listTemplateViews - List all CAS views
run - Run the CAS web application in embedded container mode
setExecutable - Configure the project to run in executable mode
showConfiguration - Show configurations for each dependency, etc
testClasses - Assembles test classes.
war - Generates a war archive with all the compiled classes, the web-app content and the libraries.Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.Docker tasks
------------
copyConfigIntoJib - Copy the CAS configuration into Docker image
copyWebAppIntoJib - Copy the web application into Docker image
deleteWebAppFromJib - Explodes the CAS web application archiveDocumentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'cas'.
components - Displays the components produced by root project 'cas'. [incubating]
dependencies - Displays all dependencies declared in root project 'cas'.
dependencyInsight - Displays the insight into a specific dependency in root project 'cas'.
dependentComponents - Displays the dependent components of components in root project 'cas'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'cas'. [incubating]
projects - Displays the sub-projects of root project 'cas'.
properties - Displays the properties of root project 'cas'.
tasks - Displays the tasks runnable from root project 'cas'.IDE tasks
---------
cleanEclipse - Cleans all Eclipse files.
cleanEclipseWtp - Cleans Eclipse wtp configuration files.
cleanIdea - Cleans IDEA project files (IML, IPR)
eclipse - Generates all Eclipse files.
eclipseWtp - Generates Eclipse wtp configuration files.
idea - Generates IDEA project files (IML, IPR, IWS)
openIdea - Opens the IDEA projectJib tasks
---------
jib - Builds a container image to a registry.
jibBuildTar - Builds a container image to a tarball.
jibDockerBuild - Builds a container image to a Docker daemon.Shell tasks
-----------
debugShell - Run the CAS shell with debug options, wait for debugger on port 5005
downloadShell - Download CAS shell jar from snapshot or release maven repo
runShell - Run the CAS shellVerification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.Rules
-----
Pattern: clean: Cleans the output files of a task.
Pattern: build: Assembles the artifacts of a configuration.
Pattern: upload: Assembles and uploads the artifacts belonging to a configuration.……BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

六、下载并启动CAS 命令行工具

./gradlew downloadShell runShell


七、获取或覆盖CAS的资源(resource)或UI(view)

资源清单可查看:

./gradlew getResource -PresourceName=[resource-name]


八、列出CAS的视图和模板清单

./gradlew listTemplateViews


九、解压CAS web应用程序文件和内部资源的jar

./gradlew explodeWar


十、配置CAS

CAS的配置文件被放置在CAS WAR Overlays 模板工程的etc目录下,我们在启动CAS时需要将其拷贝到系统的/etc/cas/config目录,可以使用以下命令完成拷贝:

./gradlew copyCasConfiguration


十一、添加其他CAS模块

首先需要编辑build.gradle文件,将需要添加的模块加入以下依赖描述中:

dependencies {

    compile "org.apereo.cas:cas-server-some-module:${project.casVersion}"

    ...

}

然后执行以下命令将依赖下载并加入到项目中:

./gradlew allDependencies


十二、清除Gradle的缓存

仅当真实需要的时候才执行,例如缓存的jar有错误

rm -rf $HOME/.gradle/caches/


十三、部署CAS Server步骤

1.创建密钥/证书

可以使用JDK的keytool来生成,也可以通过以下命令来完成:

./gradlew createKeystore

2.具体的部署安装步骤可参考以下博文

《手把手教Apereo CAS5.2.3服务端Server的开发环境》https://blog.csdn.net/u010588262/article/details/79741626


推荐阅读
  • 解决github访问慢的问题的方法集锦
    本文总结了国内用户在访问github网站时可能遇到的加载慢的问题,并提供了解决方法,其中包括修改hosts文件来加速访问。 ... [详细]
  • 本文讨论了clone的fork与pthread_create创建线程的不同之处。进程是一个指令执行流及其执行环境,其执行环境是一个系统资源的集合。在调用系统调用fork创建一个进程时,子进程只是完全复制父进程的资源,这样得到的子进程独立于父进程,具有良好的并发性。但是二者之间的通讯需要通过专门的通讯机制,另外通过fork创建子进程系统开销很大。因此,在某些情况下,使用clone或pthread_create创建线程可能更加高效。 ... [详细]
  • MateCloud 3.5.8 发布,基于 Spring Cloud Alibaba 的微服务框架
    基于SpringCloudAlibaba的微服务框架MateCloud3.5.8已经发布。此版本更新内容包括:功能升级针对MybatisPlus3.4.3新特性进行微调依赖升级升级至SpringCloud2020.0.3升级至Mybatis-Plus3.4.3详 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 使用在线工具jsonschema2pojo根据json生成java对象
    本文介绍了使用在线工具jsonschema2pojo根据json生成java对象的方法。通过该工具,用户只需将json字符串复制到输入框中,即可自动将其转换成java对象。该工具还能解析列表式的json数据,并将嵌套在内层的对象也解析出来。本文以请求github的api为例,展示了使用该工具的步骤和效果。 ... [详细]
  • 关于我们EMQ是一家全球领先的开源物联网基础设施软件供应商,服务新产业周期的IoT&5G、边缘计算与云计算市场,交付全球领先的开源物联网消息服务器和流处理数据 ... [详细]
  • 【MicroServices】【Arduino】装修甲醛检测,ArduinoDart甲醛、PM2.5、温湿度、光照传感器等,数据记录于SD卡,Python数据显示,UI5前台,微服务后台……
    这篇文章介绍了一个基于Arduino的装修甲醛检测项目,使用了ArduinoDart甲醛、PM2.5、温湿度、光照传感器等硬件,并将数据记录于SD卡,使用Python进行数据显示,使用UI5进行前台设计,使用微服务进行后台开发。该项目还在不断更新中,有兴趣的可以关注作者的博客和GitHub。 ... [详细]
  • 树莓派语音控制的配置方法和步骤
    本文介绍了在树莓派上实现语音控制的配置方法和步骤。首先感谢博主Eoman的帮助,文章参考了他的内容。树莓派的配置需要通过sudo raspi-config进行,然后使用Eoman的控制方法,即安装wiringPi库并编写控制引脚的脚本。具体的安装步骤和脚本编写方法在文章中详细介绍。 ... [详细]
  • 本文详细介绍了git常用命令及其操作方法,包括查看、添加、提交、删除、找回等操作,以及如何重置修改文件、抛弃工作区修改、将工作文件提交到本地暂存区、从版本库中删除文件等。同时还介绍了如何从暂存区恢复到工作文件、恢复最近一次提交过的状态,以及如何合并多个操作等。 ... [详细]
  • SpringMVC接收请求参数的方式总结
    本文总结了在SpringMVC开发中处理控制器参数的各种方式,包括处理使用@RequestParam注解的参数、MultipartFile类型参数和Simple类型参数的RequestParamMethodArgumentResolver,处理@RequestBody注解的参数的RequestResponseBodyMethodProcessor,以及PathVariableMapMethodArgumentResol等子类。 ... [详细]
  • Spring Batch中多线程配置及实现例子
    本文介绍了在Spring Batch中开启多线程的配置方法,包括设置线程数目和使用线程池。通过一个示例演示了如何实现多线程从数据库读取数据并输出。同时提到了在多线程情况下需要考虑Reader的线程安全问题,并提供了解决方法。 ... [详细]
  • Java如何导入和导出Excel文件的方法和步骤详解
    本文详细介绍了在SpringBoot中使用Java导入和导出Excel文件的方法和步骤,包括添加操作Excel的依赖、自定义注解等。文章还提供了示例代码,并将代码上传至GitHub供访问。 ... [详细]
  • 本文介绍了自学Vue的第01天的内容,包括学习目标、学习资料的收集和学习方法的选择。作者解释了为什么要学习Vue以及选择Vue的原因,包括完善的中文文档、较低的学习曲线、使用人数众多等。作者还列举了自己选择的学习资料,包括全新vue2.5核心技术全方位讲解+实战精讲教程、全新vue2.5项目实战全家桶单页面仿京东电商等。最后,作者提出了学习方法,包括简单的入门课程和实战课程。 ... [详细]
  • 寻求更强大的身份和访问管理(IAM)平台的企业正在转向云,并接受身份即服务(IDaaS)的灵活性。要为IAM选择正确的场外解决方案,业务管理人员和IT专业人员必须在实施之前评估安全 ... [详细]
  • 初始化初始化本地空版本库,仓库,英文名repositorymkdirtest&&cdtestgitinit克隆项目到本地gitclone远程同 ... [详细]
author-avatar
手机用户2502869883
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有