Compare commits

...

99 Commits
6.0 ... master

Author SHA1 Message Date
Misagh Moayyed fad84305ee
update tomcat 2020-03-19 11:02:52 +03:30
Misagh Moayyed 75828fb101
Updated: code cleanup and styling; fixes test cases 2020-03-03 18:59:26 +03:30
Misagh Moayyed 4d26b4cc87
Updated: code cleanup and styling; fixes test cases 2020-02-26 19:36:32 +03:30
Misagh Moayyed cd8ff40c8c
switch to gradle 6.2 2020-02-18 09:55:40 +04:00
Misagh Moayyed 37d40bddac
minor adjustments to build 2020-02-12 12:03:41 +04:00
Misagh Moayyed a9137ac532
clean up build repos 2020-02-11 18:43:08 +04:00
Misagh Moayyed 9e88707343
bring bootRun back 2020-02-10 22:37:01 +04:00
Misagh Moayyed 5113450681
docker refinements 2020-01-31 16:02:49 +04:00
Misagh Moayyed b6cd25a9e5
Upgrade jib plugin (#44) 2020-01-29 13:11:43 +04:00
Hal Deadman 794331ff63
add missing gradle repository (#43)
* add missing gradle repository 

The CAS snapshot repository is needed if building a overlay on a snapshot version if you haven't been building CAS locally.

* Update tasks.gradle

Co-authored-by: Misagh Moayyed <mm1844@gmail.com>
2020-01-29 12:12:22 +04:00
Misagh Moayyed fbdcb23696
Updated: code cleanup and styling; fixes test cases 2020-01-21 18:14:22 +04:00
Misagh Moayyed 93ef556b98
Update gradle.properties 2020-01-21 18:12:49 +04:00
Misagh Moayyed c658edcef8
bump to spring boot 2.2.3 2020-01-18 11:03:31 +04:00
Misagh Moayyed 70097b86bf
Updated: code cleanup and styling; fixes test cases 2020-01-16 10:33:21 +04:00
Misagh Moayyed fee67b81e3
Updated: code cleanup and styling; fixes test cases 2020-01-16 10:29:56 +04:00
Misagh Moayyed 71889cfe5f
support payara micro deployments 2020-01-12 17:23:09 +04:00
Misagh Moayyed 57d82dc57e
fix image tag 2020-01-08 09:57:15 +04:00
Misagh Moayyed 5ad1e9e254
fix docker push scripts
(cherry picked from commit ecb2aa52b188d5a1ed040c4ad332df707f95283c)
2020-01-06 17:09:40 +04:00
Misagh Moayyed 9b4a5db948
workout boot-run in overlay. clean up build 2019-12-31 11:08:28 +04:00
Misagh Moayyed bbf788fd6e
build task for config metadata 2019-12-14 13:46:02 +04:00
Misagh Moayyed 704908dfae
Update gradle.properties 2019-12-08 12:49:17 +04:00
Misagh Moayyed 2466fbe872
switch to implementation from compile 2019-12-01 17:00:48 +04:00
Misagh Moayyed aa08664f70
Merge branch 'master' of github.com:apereo/cas-overlay-template 2019-12-01 16:46:56 +04:00
NgSekLong 37db128082 Feature request: Allow copy resource by name with suffix (#40)
* Update tasks.gradle

* Update tasks.gradle
2019-12-01 16:46:47 +04:00
Misagh Moayyed 4ba7fc6bed
upgrade build; add lombok for comfort 2019-12-01 16:45:39 +04:00
Misagh Moayyed 742b6cee08
switch to gradle 6 2019-12-01 16:28:25 +04:00
Misagh Moayyed 2a0dab938e
Update gradle.properties 2019-11-15 22:41:40 +04:00
Misagh Moayyed 3a159a043a
Update gradle.properties 2019-11-07 13:14:08 +04:00
Misagh Moayyed f3b7a4d9fc
Update gradle.properties 2019-10-30 21:44:23 +04:00
Misagh Moayyed b3d8698cba
update versions 2019-10-28 13:05:51 +04:00
Misagh Moayyed e9105bf459
fix jib issue with registry options 2019-10-20 13:18:40 +04:00
Misagh Moayyed ce08720a1e
upgrade gradle 2019-10-19 01:05:12 +04:00
Misagh Moayyed 3ebfa1da19
Update gradle.properties 2019-10-18 19:54:41 +04:00
Misagh Moayyed e9ec69cd1b
Updated: code cleanup and styling; fixes test cases 2019-10-06 20:21:32 +04:00
Misagh Moayyed e9aeca1d8f
Update gradle.properties 2019-10-06 20:20:13 +04:00
Misagh Moayyed cff2009b9a
Updated: code cleanup and styling; fixes test cases 2019-10-05 11:04:33 +03:30
Misagh Moayyed ea89c4aabf
Update gradle.properties 2019-09-15 15:18:12 +04:30
Misagh Moayyed d5ce5bc656
Update gradle.properties 2019-09-10 20:07:36 +04:30
Hal Deadman e043d0fcdf
fix deprecated jib setting (#35) 2019-09-06 21:46:22 -04:00
Misagh Moayyed 423502ba4e
Update gradle.properties 2019-09-03 21:41:53 +04:30
Misagh Moayyed 15d4ac2dd0 upgrade gradle 2019-09-02 10:07:39 +04:30
Misagh Moayyed ca8b564ecc
Update gradle.properties 2019-09-02 10:06:28 +04:30
Misagh Moayyed 1d71225bb5
updated 2019-08-20 11:49:36 +04:30
Hal Deadman a8ecb1af62 update overlay plugin version and add comment about excludes (#33) 2019-08-19 19:59:08 +04:30
Misagh Moayyed cad6f23f1b
Update jib plugin 2019-08-17 07:59:30 +04:30
Phạm Tiến Thành bd648186dc Remove duplicate repo definition (#32) 2019-08-14 13:17:59 +04:30
Misagh Moayyed 64f9d49f96
updated 2019-08-07 09:01:34 +04:30
Misagh Moayyed c947c95e08
updated 2019-08-06 20:43:54 +04:30
Misagh Moayyed 3a88eb7b60
updated 2019-08-06 20:26:26 +04:30
Misagh Moayyed da223a962f
updated 2019-08-06 20:19:43 +04:30
Misagh Moayyed 211152bc61
added travis ci build 2019-08-06 20:07:45 +04:30
Hal Deadman 59b733919c Use maven war overlay plugin via io.freefair.war-overlay plugin (#31) 2019-08-06 19:50:18 +04:30
Misagh Moayyed 13385e89d4
Update gradle.properties 2019-08-06 19:39:07 +04:30
hdeadman d325eb92cd cleanup for building dockerfile on windows 2019-07-27 23:09:15 -04:00
Misagh Moayyed fddaafe9ec
upgrade jib 2019-07-18 20:17:22 +04:30
Hal Deadman b32c12bc25
update dependencies for cas master, update gradle wrapper (#30) 2019-07-13 23:32:38 -04:00
Misagh Moayyed c040eb4ab0
Create FUNDING.yml 2019-07-13 23:09:06 +04:30
Misagh Moayyed bd6878f104
Merge pull request #29 from ehirsch/patch-1
fixing build for the `jib` task
2019-06-27 13:20:09 +04:30
Eike Hirsch c3c681c737
fixing build for the `jib` task
When `jib` was used without a run of `jibDockerBuild` beforehand the war file was not copied into the docker image. The container failed to run in return.
2019-06-27 10:47:43 +02:00
Misagh Moayyed 334366b110
Merge pull request #28 from apereo/resourcereorg
WIP - resource reorg
2019-06-14 08:36:18 +04:30
Misagh Moayyed 696d8b33de
updated 2019-06-09 20:45:41 -07:00
hdeadman 6d7f6aa22e keep task name the same as before 2019-06-08 15:12:58 -04:00
hdeadman 266f753dfe update readme 2019-06-08 01:26:43 -04:00
hdeadman 1bc49127f8 use resource jar in 6.1.x 2019-06-08 01:20:41 -04:00
Misagh Moayyed b0456082e7
Update gradle.properties 2019-06-07 11:08:11 -07:00
Misagh Moayyed 03bd838c51
add docker compose file 2019-05-20 09:24:41 -07:00
Misagh Moayyed 4692d6be14
version updates 2019-05-16 00:34:51 -07:00
Misagh Moayyed b4a96555ae
updated 2019-05-13 00:37:14 -07:00
Misagh Moayyed c5cc2c1c96
work on docker builds 2019-05-08 03:50:46 -07:00
Misagh Moayyed 42a5c5a877
work on docker builds 2019-05-08 03:49:10 -07:00
Misagh Moayyed 1cd95f9145
work on docker builds 2019-05-08 03:45:42 -07:00
Misagh Moayyed a0ec436e86
work on docker builds 2019-05-08 03:30:28 -07:00
Misagh Moayyed d5634ace29
work on docker builds 2019-05-08 03:23:38 -07:00
Misagh Moayyed 334eab93ab
work on docker builds 2019-05-08 03:17:21 -07:00
Misagh Moayyed f90d732090
work on docker builds 2019-05-08 03:11:42 -07:00
Misagh Moayyed 6232ee897c
work on docker builds 2019-05-08 03:09:42 -07:00
Misagh Moayyed 59bcba0803
work on docker builds 2019-05-08 03:03:32 -07:00
Misagh Moayyed 2ed6ad4c7a Merge branch 'master' of github.com:apereo/cas-overlay-template
# Conflicts:
#	gradle.properties
2019-05-07 13:01:34 -07:00
Misagh Moayyed 076c4f23f7
move dockerfile into overlay project 2019-05-07 13:00:31 -07:00
Misagh Moayyed 40004b70ca
Update gradle.properties 2019-04-29 01:54:51 -07:00
Misagh Moayyed c383a79d47
updated 2019-04-16 08:50:05 -07:00
Misagh Moayyed 74ccdabc89
cleanup 2019-04-16 03:57:52 -07:00
Misagh Moayyed 6d0b20e80c
cleanup 2019-04-16 03:34:20 -07:00
Misagh Moayyed ae967be9e4
cleanup 2019-04-16 03:29:52 -07:00
Misagh Moayyed edaef20bcc
update versions 2019-04-16 03:24:23 -07:00
Misagh Moayyed c07c86f661
Update gradle.properties 2019-03-04 05:32:29 -07:00
Misagh Moayyed 7b3154af41
Update gradle.properties 2019-02-19 00:58:00 -07:00
Misagh Moayyed 904adc76bc
bump gradle and jib 2019-02-13 13:04:49 -07:00
Hal Deadman 759b507a36
Merge pull request #26 from hdeadman/master
fix copyCasConfiguration on windows
2019-02-10 20:21:08 -05:00
hdeadman d970f4e952 fix copyCasConfiguration on windows 2019-02-10 20:18:02 -05:00
Misagh Moayyed c19351980f
bump cas version 2019-02-06 04:08:31 -07:00
Misagh Moayyed 424641c37b
bump gradle version 2019-02-06 04:08:07 -07:00
Misagh Moayyed 09c0bd027e
Update gradle.properties 2019-02-05 00:50:48 -07:00
Misagh Moayyed 840e7d4d37
updated 2019-01-14 11:08:01 -07:00
Misagh Moayyed b96b3db05e
updated 2019-01-03 11:14:58 -07:00
Misagh Moayyed f77549d64b
bump versions to 6.1; up gradle 2019-01-03 11:13:27 -07:00
Misagh Moayyed 175d7a3d9b Merge branch 'master' of github.com:apereo/cas-overlay-template 2019-01-03 11:11:54 -07:00
Misagh Moayyed 80cef534af
remove shell scripts in favor of native gradle 2019-01-03 11:11:50 -07:00
Misagh Moayyed f7d5eae228
Update README.md 2018-12-30 13:45:19 -07:00
28 changed files with 739 additions and 605 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
target/**
build/**
bin/**
.idea/**
.history/**
.github/**
.git/**

4
.gitattributes vendored
View File

@ -1,4 +1,6 @@
# Set line endings to LF, even on Windows. Otherwise, execution within Docker fails.
# See https://help.github.com/articles/dealing-with-line-endings/
*.sh text eol=lf
*.cmd text eol=crlf
gradlew text eol=lf
*.cmd text eol=crlf
*.bat text eol=crlf

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
custom: ['https://www.apereo.org/content/apereo-membership']

11
.github/renovate.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"extends": [
"config:base",
":preserveSemverRanges",
":rebaseStalePrs",
":disableRateLimiting",
":semanticCommits",
":semanticCommitTypeAll(renovatebot)"
],
"labels": ["dependencies", "bot"]
}

3
.gitignore vendored
View File

@ -18,4 +18,5 @@ bin/
*.log
tmp/
./apache-tomcat
apache-tomcat.zip
apache-tomcat.zip
config-metadata.properties

32
.mergify.yml Normal file
View File

@ -0,0 +1,32 @@
#
# Licensed to Apereo under one or more contributor license
# agreements. See the NOTICE file distributed with this work
# for additional information regarding copyright ownership.
# Apereo licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a
# copy of the License at the following location:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
pull_request_rules:
- name: automatic merge by dependabot
conditions:
- status-success=continuous-integration/travis-ci/pr
- status-success=WIP
- "#changes-requested-reviews-by=0"
- base=master
- label=dependencies
actions:
merge:
method: merge
strict: true
delete_head_branch:

62
.travis.yml Normal file
View File

@ -0,0 +1,62 @@
language: java
sudo: required
dist: trusty
services:
- docker
branches:
only:
- master
before_cache:
- rm -rf $HOME/.gradle/caches/5.*/
- rm -rf $HOME/.gradle/caches/4.*/
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- find ~/.gradle/caches/ -name "*.lock" -type f -delete
cache:
bundler: false
cargo: false
directories:
- $HOME/.m2
- $HOME/.npm/
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
env:
global:
- JAVA_OPTS="-Xms512m -Xmx4048m -Xss128m -XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -Xverify:none -server"
- GRADLE_OPTS="-Xms512m -Xmx1024m -Xss128m -XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -Xverify:none -server"
jdk:
- openjdk11
before_install:
- echo -e "Configuring Gradle wrapper...\n"
- mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- chmod -R 777 ./gradlew
- chmod -R 777 *.sh
install: true
stages:
- build
- validate
- docker
jobs:
include:
- stage: build
script: ./gradlew clean build --stacktrace --no-daemon --refresh-dependencies -Dorg.gradle.internal.http.socketTimeout=600000 -Dorg.gradle.internal.http.connectionTimeout=600000
name: "Build CAS"
############################################
- stage: validate
script: ./gradlew downloadShell
name: "Download CAS Shell"
- stage: validate
script: ./gradlew listTemplateViews
name: "List CAS Template Views"
- stage: validate
script: ./gradlew explodeWar
name: "Unzip CAS Web Application"
############################################
- stage: docker
script: ./gradlew build jibDockerBuild --stacktrace --no-daemon --refresh-dependencies
name: "Build Docker Image via Jib"
- stage: docker
script: docker-compose build
name: "Build Docker Image via Docker Compose"
- stage: docker
script: ./docker-build.sh
name: "Build Docker Image"

40
Dockerfile Normal file
View File

@ -0,0 +1,40 @@
FROM adoptopenjdk/openjdk11:alpine-slim AS overlay
RUN mkdir -p cas-overlay
COPY ./src cas-overlay/src/
COPY ./gradle/ cas-overlay/gradle/
COPY ./gradlew ./settings.gradle ./build.gradle ./gradle.properties /cas-overlay/
RUN mkdir -p ~/.gradle \
&& echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties \
&& echo "org.gradle.configureondemand=true" >> ~/.gradle/gradle.properties \
&& cd cas-overlay \
&& chmod 750 ./gradlew \
&& ./gradlew --version;
RUN cd cas-overlay \
&& ./gradlew clean build --parallel --no-daemon;
FROM adoptopenjdk/openjdk11:alpine-jre AS cas
LABEL "Organization"="Apereo"
LABEL "Description"="Apereo CAS"
RUN cd / \
&& mkdir -p /etc/cas/config \
&& mkdir -p /etc/cas/services \
&& mkdir -p /etc/cas/saml \
&& mkdir -p cas-overlay;
COPY etc/cas/ /etc/cas/
COPY etc/cas/config/ /etc/cas/config/
COPY etc/cas/services/ /etc/cas/services/
COPY etc/cas/saml/ /etc/cas/saml/
COPY --from=overlay cas-overlay/build/libs/cas.war cas-overlay/
EXPOSE 8080 8443
ENV PATH $PATH:$JAVA_HOME/bin:.
WORKDIR cas-overlay
ENTRYPOINT ["java", "-server", "-noverify", "-Xmx2048M", "-jar", "cas.war"]

View File

@ -1,30 +1,60 @@
CAS Overlay Template
CAS Overlay Template [![Build Status](https://travis-ci.org/apereo/cas-overlay-template.svg?branch=master)](https://travis-ci.org/apereo/cas-overlay-template)
=======================
Generic CAS WAR overlay to exercise the latest versions of CAS. This overlay could be freely used as a starting template for local CAS war overlays.
# Versions
- CAS `6.0.x`
- CAS `6.2.x`
- JDK `11`
# Overview
You may invoke build commands using the `build.sh` script to work with your chosen overlay using:
To build the project, use:
```bash
./build.sh [command]
# Use --refresh-dependencies to force-update SNAPSHOT versions
./gradlew[.bat] clean build
```
To see what commands are available to the build script, run:
```bash
./build.sh help
./gradlew[.bat] tasks
```
To launch into the CAS command-line shell:
```bash
./gradlew[.bat] downloadShell runShell
```
To fetch and overlay a CAS resource or view, use:
```bash
./gradlew[.bat] getResource -PresourceName=[resource-name]
```
To list all available CAS views and templates:
```bash
./gradlew[.bat] listTemplateViews
```
To unzip and explode the CAS web application file and the internal resources jar:
```bash
./gradlew[.bat] explodeWar
```
# Configuration
- The `etc` directory contains the configuration files and directories that need to be copied to `/etc/cas/config`.
```bash
./gradlew[.bat] copyCasConfiguration
```
- The specifics of the build are controlled using the `gradle.properties` file.
## Adding Modules
@ -38,17 +68,18 @@ dependencies {
}
```
Study material:
To collect the list of all project modules and dependencies:
- https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html
- https://docs.gradle.org/current/userguide/dependency_management.html
```bash
./gradlew[.bat] allDependencies
```
## Clear Gradle Cache
### Clear Gradle Cache
If you need to, on Linux/Unix systems, you can delete all the existing artifacts (artifacts and metadata) Gradle has downloaded using:
```bash
# Only do this when absolutely necessary!
# Only do this when absolutely necessary
rm -rf $HOME/.gradle/caches/
```
@ -56,7 +87,12 @@ Same strategy applies to Windows too, provided you switch `$HOME` to its equival
# Deployment
- Create a keystore file `thekeystore` under `/etc/cas`. Use the password `changeit` for both the keystore and the key/certificate entries.
- Create a keystore file `thekeystore` under `/etc/cas`. Use the password `changeit` for both the keystore and the key/certificate entries. This can either be done using the JDK's `keytool` utility or via the following command:
```bash
./gradlew[.bat] createKeystore
```
- Ensure the keystore is loaded up with keys and certificates of the server.
On a successful deployment via the following methods, CAS will be available at:
@ -65,12 +101,46 @@ On a successful deployment via the following methods, CAS will be available at:
## Executable WAR
Run the CAS web application as an executable WAR.
Run the CAS web application as an executable WAR:
```bash
./build.sh run
./gradlew[.bat] run
```
Debug the CAS web application as an executable WAR:
```bash
./gradlew[.bat] debug
```
Run the CAS web application as a *standalone* executable WAR:
```bash
./gradlew[.bat] clean executable
```
## External
Deploy the binary web application file `cas.war` after a successful build to a servlet container of choice.
Deploy the binary web application file `cas.war` after a successful build to a servlet container of choice.
## Docker
The following strategies outline how to build and deploy CAS Docker images.
### Jib
The overlay embraces the [Jib Gradle Plugin](https://github.com/GoogleContainerTools/jib) to provide easy-to-use out-of-the-box tooling for building CAS docker images. Jib is an open-source Java containerizer from Google that lets Java developers build containers using the tools they know. It is a container image builder that handles all the steps of packaging your application into a container image. It does not require you to write a Dockerfile or have Docker installed, and it is directly integrated into the overlay.
```bash
./gradlew build jibDockerBuild
```
### Dockerfile
You can also use the native Docker tooling and the provided `Dockerfile` to build and run CAS.
```bash
chmod +x *.sh
./docker-build.sh
./docker-run.sh
```

129
build.cmd
View File

@ -1,129 +0,0 @@
@echo off
@set JAVA_ARGS=-Xms500m -Xmx1g
@set CAS_DIR=\etc\cas
@set CONFIG_DIR=\etc\cas\config
@set SHELL_DIR=build\libs
@set BUILD_DIR=build\libs
@set DOCKER_ORG=org.apereo.cas
@if "%PROFILES%" == "" @set PROFILES=standalone
@rem Call this script with DNAME and CERT_SUBJ_ALT_NAMES already set to override
@if "%DNAME%" == "" set DNAME=CN=cas.example.org,OU=Example,OU=Org,C=US
@rem List other host names or ip addresses you want in your certificate, may help with host name verification,
@rem if client apps make https connection for ticket validation and compare name in cert (include sub. alt. names)
@rem to name used to access CAS
@if "%CERT_SUBJ_ALT_NAMES%" == "" set CERT_SUBJ_ALT_NAMES=dns:example.org,dns:localhost,dns:%COMPUTERNAME%,ip:127.0.0.1
@rem Check for gradle in path, use it if found, otherwise use gradle wrapper
@set GRADLE_CMD=gradle
@where /q gradle
@if %ERRORLEVEL% neq 0 set GRADLE_CMD=.\gradlew.bat
@if "%1" == "" call:help
@if "%1" == "clean" (
call:clean
shift
)
@if "%1" == "copy" call:copy
@if "%1" == "package" call:package %2 %3 %4
@if "%1" == "debug" call:debug %2 %3 %4
@if "%1" == "run" call:run %2 %3 %4 & goto :EOF
@if "%1" == "refresh" call:refresh %2 %3 %4
@if "%1" == "help" call:help
@if "%1" == "gencert" call:gencert
@if "%1" == "cli" call:cli
@if "%1" == "debugcli" call:debugcli
@if "%1" == "dependencies" call:dependencies
@if "%1" == "dockerimage" call:dockerimage
@if "%1" == "dockerrun" call:dockerrun
@if "%1" == "dockerrunsh" call:dockerrunsh
@if "%1" == "dockerexecsh" call:dockerexecsh
@rem function section starts here
@goto :EOF
:copy
@echo "Creating configuration directory under %CONFIG_DIR%"
if not exist %CONFIG_DIR% mkdir %CONFIG_DIR%
@echo "Copying configuration files from etc/cas to /etc/cas"
xcopy /S /Y etc\cas\* \etc\cas
@goto :EOF
:help
@echo "Usage: build.cmd [copy|clean|package|refresh|run|debug|gencert|dockerimage|dockerrunsh|dockerexecsh] [optional extra args for gradle]"
@echo "To get started on a clean system, run 'build.cmd gencert && build.cmd copy && build.cmd run'"
@echo "Note that using the copy or gencert arguments will create and/or overwrite the %CAS_DIR% which is outside this project"
@goto :EOF
:clean
call %GRADLE_CMD% clean %1 %2 %3
exit /B %ERRORLEVEL%
@goto :EOF
:package
call %GRADLE_CMD% build %1 %2 %3
exit /B %ERRORLEVEL%
@goto :EOF
:debug
call:package %1 %2 %3 & java %JAVA_ARGS% -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n -jar %BUILD_DIR%\cas.war --spring.profiles.active=%PROFILES%
@goto :EOF
:run
call:package %1 %2 %3 & java %JAVA_ARGS% -jar %BUILD_DIR%\cas.war --spring.profiles.active=%PROFILES%
@goto :EOF
:refresh
call:package --refresh-dependencies %1 %2
@goto :EOF
:dockerimage
call %GRADLE_CMD% clean build jibDockerBuild
@goto :EOF
:dockerrun
docker stop cas
docker rm cas
docker run --name cas %DOCKER_ORG%/cas:latest
@goto :EOF
:dockerrunsh
@rem run image to look around, delete container on exit
docker run --rm -it --entrypoint /bin/sh %DOCKER_ORG%/cas:latest
@goto :EOF
:dockerexecsh
@rem exec into runing container to look around, run jstack, check config, etc
docker exec -it cas /bin/sh
@goto :EOF
:gencert
where /q keytool
if ERRORLEVEL 1 (
@echo Java keytool.exe not found in path.
exit /b 1
) else (
if not exist %CAS_DIR% mkdir %CAS_DIR%
@echo on
@echo Generating self-signed SSL cert for %DNAME% in %CAS_DIR%\thekeystore
keytool -genkeypair -alias cas -keyalg RSA -keypass changeit -storepass changeit -keystore %CAS_DIR%\thekeystore -dname %DNAME% -ext SAN=%CERT_SUBJ_ALT_NAMES%
@echo Exporting cert for use in trust store (used by cas clients)
keytool -exportcert -alias cas -storepass changeit -keystore %CAS_DIR%\thekeystore -file %CAS_DIR%\cas.cer
)
@goto :EOF
:cli
call %GRADLE_CMD% runShell
@goto :EOF
:debugcli
call %GRADLE_CMD% debugShell
@goto :EOF
:dependencies
call %GRADLE_CMD% allDependencies
@goto :EOF

View File

@ -1,16 +1,28 @@
buildscript {
repositories {
mavenLocal()
gradlePluginPortal()
mavenCentral()
jcenter()
maven { url "https://repo.spring.io/libs-milestone" }
maven { url "https://plugins.gradle.org/m2/" }
maven {
url "https://repo.spring.io/libs-milestone"
mavenContent { releasesOnly() }
}
maven {
url "https://repo.spring.io/libs-snapshot"
mavenContent { snapshotsOnly() }
}
maven {
url "https://plugins.gradle.org/m2/"
mavenContent { releasesOnly() }
}
}
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 "com.boazj.gradle:gradle-log-plugin:${project.gradleLogVersion}"
classpath "io.freefair.gradle:maven-plugin:${project.gradleMavenPluginVersion}"
classpath "io.freefair.gradle:lombok-plugin:${project.gradleLombokPluginVersion}"
}
}
@ -18,10 +30,26 @@ repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://build.shibboleth.net/nexus/content/repositories/releases/" }
maven { url "https://repo.spring.io/milestone/" }
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
mavenContent { snapshotsOnly() }
}
maven {
mavenContent { releasesOnly() }
url "https://build.shibboleth.net/nexus/content/repositories/releases/"
}
maven {
mavenContent { releasesOnly() }
url "https://repo.spring.io/milestone/"
}
maven {
url "https://repo.spring.io/snapshot/"
mavenContent { snapshotsOnly() }
}
maven {
mavenContent { snapshotsOnly() }
url "https://oss.jfrog.org/artifactory/oss-snapshot-local"
}
}
def casServerVersion = project.'cas.version'
@ -30,24 +58,30 @@ def casWebApplicationBinaryName = "cas.war"
project.ext."casServerVersion" = casServerVersion
project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName
apply from: rootProject.file("gradle/waroverlay.gradle")
apply plugin: "io.freefair.war-overlay"
apply plugin: "io.freefair.lombok"
apply from: rootProject.file("gradle/tasks.gradle")
apply plugin: "war"
apply plugin: "org.springframework.boot"
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "com.google.cloud.tools.jib"
apply from: rootProject.file("gradle/springboot.gradle")
apply from: rootProject.file("gradle/dockerjib.gradle")
dependencies {
compile "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}"
// Other CAS dependencies/modules may be listed here...
// implementation "org.apereo.cas:cas-server-support-json-service-registry:${casServerVersion}"
}
tasks.findByName("jibDockerBuild")
.dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
.finalizedBy(deleteWebAppFromJib)
tasks.findByName("jib")
.dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
.finalizedBy(deleteWebAppFromJib)
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
@ -74,72 +108,4 @@ idea {
downloadJavadoc = true
downloadSources = true
}
}
war {
includeWarJars = true
entryCompression = ZipEntryCompression.STORED
}
springBoot {
mainClassName = "org.apereo.cas.web.CasWebApplication"
}
bootWar {
doFirst {
def executable = project.hasProperty("executable") && Boolean.valueOf(project.getProperty("executable"))
if (executable) {
logger.info "Including launch script for executable WAR artifact"
launchScript()
} else {
logger.info "WAR artifact is not marked as an executable"
}
archiveName "${casWebApplicationBinaryName}"
baseName "cas"
excludeDevtools = true
}
}
bootRun {
sourceResources sourceSets.main
classpath = sourceSets.main.runtimeClasspath
}
wrapper {
distributionType = Wrapper.DistributionType.BIN
gradleVersion = "${project.gradleVersion}"
}
jib {
from {
image = project.baseDockerImage
}
to {
image = "${project.group}/${project.name}"
/**
ecr-login: Amazon Elastic Container Registry (ECR)
gcr: Google Container Registry (GCR)
osxkeychain: Docker Hub
*/
credHelper = "osxkeychain"
/**
auth {
username = "*******"
password = "*******"
}
tags = [casServerVersion]
*/
}
container {
useCurrentTimestamp = true
entrypoint = ['docker/entrypoint.sh']
ports = ['80', '443', '8080', '8443']
labels = [version:casServerVersion, name:project.name, group:project.group]
}
extraDirectory {
path = file('src/main/jib')
permissions = [
'/docker/entrypoint.sh': '755'
]
}
}

160
build.sh
View File

@ -1,160 +0,0 @@
#!/bin/bash
function copy() {
./gradlew copyCasConfiguration "$@"
}
function help() {
casVersion=$(./gradlew casVersion --quiet)
clear
echo "******************************************************************"
tput setaf 2
echo "Apereo CAS $casVersion"
echo "Enterprise Single SignOn for all earthlings and beyond"
tput sgr 0
echo "- https://github.com/apereo/cas"
echo "- https://apereo.github.io/cas"
echo "******************************************************************"
echo -e "Usage: build.sh [command]\n"
echo -e "\tThe following commands are available:\n"
echo -e "\tclean: \t\tClean Maven build directory"
echo -e "\tcli: \t\tRun the CAS command line shell and pass commands"
echo -e "\tcopy: \t\tCopy config from the project's local etc/cas/config directory to the root /etc/cas/config"
echo -e "\tdebug: \t\tRun cas.war and listen for Java debugger on port 5000"
echo -e "\tdependencies: \tGet a report of all dependencies configured in the build"
echo -e "\tdocker: \tBuild a Docker image based on the current build and configuration"
echo -e "\tgencert: \tCreate keystore with SSL certificate in location where CAS looks by default"
echo -e "\tgetview: \tAsk for a view name to be included in the overlay for customizations"
echo -e "\tgetresource: \tAsk for a resource name (properties/json/etc file) to be included in the overlay for customizations"
echo -e "\tlistviews: \tList all CAS views that ship with the web application and can be customized in the overlay"
echo -e "\tpackage: \tClean and build CAS war"
echo -e "\texplode: \tExplode and unzip and packaged CAS war"
echo -e "\trun: \t\tBuild and run cas.war via Java as an executable war"
echo -e "\trunalone: \tBuild and run cas.war on its own as a standalone executable"
echo -e "\ttomcat: \tDeploy the CAS web application to an external Apache Tomcat server"
echo -e "\tupdate: \tPackage the CAS overlay by force-updating dependencies and SNAPSHOT versions"
}
function clean() {
./gradlew clean "$@"
}
function package() {
./gradlew clean build "$@"
}
function update() {
./gradlew clean build --refresh-dependencies "$@"
}
function dependencies() {
./gradlew allDependencies
}
function tomcat() {
./gradlew tomcatDeploy "$@"
}
function debug() {
./gradlew debug "$@"
}
function run() {
./gradlew run "$@"
}
function runalone() {
./gradlew clean executable
}
function jibdocker() {
./gradlew clean build jibDockerBuild "$@"
}
function listviews() {
./gradlew listTemplateViews "$@"
}
function explodeApp() {
./gradlew explodeWar
}
function getresource() {
./gradlew getResource -PresourceName="$@"
}
function getview() {
./gradlew getResource -PresourceName="$@"
}
function gencert() {
./gradlew createKeystore "$@"
}
function cli() {
./gradlew downloadShell runShell "$@"
}
command=$1
if [ -z "$command" ]; then
echo "No commands provided. Defaulting to [run]"
command="run"
fi
shift 1
case "$command" in
"copy")
copy
;;
"help")
help
;;
"clean")
clean "$@"
;;
"package"|"build")
package "$@"
;;
"debug")
debug "$@"
;;
"run")
run "$@"
;;
"explode")
explodeApp "$@"
;;
"docker")
jibdocker "$@"
;;
"gencert")
gencert "$@"
;;
"cli")
cli "$@"
;;
"update")
update "$@"
;;
"dependencies")
update "$@"
;;
"runalone")
runalone "$@"
;;
"listviews")
listviews "$@"
;;
"getview")
getview "$@"
;;
"getresource")
getresource "$@"
;;
"tomcat")
tomcat
;;
esac

10
docker-build.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`)
echo "Building CAS docker image tagged as [v$image_tag]"
# read -p "Press [Enter] to continue..." any_key;
docker build --tag="org.apereo.cas/cas:v$image_tag" . \
&& echo "Built CAS image successfully tagged as org.apereo.cas/cas:v$image_tag" \
&& docker images "org.apereo.cas/cas:v$image_tag"

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
version: '3'
services:
cas:
build: .
ports:
- "8443:8443"
- "8080:8080"

12
docker-push.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
read -p "Docker username: " docker_user
read -s -p "Docker password: " docker_psw
echo "$docker_psw" | docker login --username "$docker_user" --password-stdin
image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`)
echo "Pushing CAS docker image tagged as v$image_tag to org.apereo.cas/cas..."
docker push org.apereo.cas/cas:"v$image_tag" \
&& echo "Pushed org.apereo.cas/cas:v$image_tag successfully.";

7
docker-run.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
docker stop cas > /dev/null 2>&1
docker rm cas > /dev/null 2>&1
image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`)
docker run -d -p 8080:8080 -p 8443:8443 --name="cas" org.apereo.cas/cas:"v${image_tag}"
docker logs -f cas

1
etc/cas/saml/.gitkeep Normal file
View File

@ -0,0 +1 @@
This directory is references in the Dockerfile so it needs to be here.

View File

@ -1,27 +1,28 @@
# Versions
cas.version=6.0.0
springBootVersion=2.1.1.RELEASE
cas.version=6.2.0-SNAPSHOT
springBootVersion=2.2.5.RELEASE
# Use -jetty, -undertow to other containers
# Or blank if you want to deploy to an external container
appServer=-tomcat
executable=false
gradleVersion=5.0
tomcatVersion=9.0.13
tomcatVersion=9.0.33
group=org.apereo.cas
sourceCompatibility=11
targetCompatibility=11
jibVersion=0.10.0
jibVersion=2.1.0
# Location of the downloaded CAS shell JAR
shellDir=build/libs
ivyVersion=2.4.0
gradleDownloadTaskVersion=3.4.3
gradleLogVersion=0.1.0
gradleMavenPluginVersion=4.1.5
gradleLombokPluginVersion=4.1.5
# use without "-slim" in tag name if you want tools like jstack, adds about 100MB to image size
# (https://hub.docker.com/r/adoptopenjdk/openjdk11/tags/)
baseDockerImage=adoptopenjdk/openjdk11:jdk11-alpine-nightly-slim
baseDockerImage=adoptopenjdk/openjdk11:alpine-jre
allowInsecureRegistries=false

52
gradle/dockerjib.gradle Normal file
View File

@ -0,0 +1,52 @@
apply plugin: "com.google.cloud.tools.jib"
jib {
from {
image = project.baseDockerImage
}
to {
image = "${project.group}/${project.name}"
/**
ecr-login: Amazon Elastic Container Registry (ECR)
gcr: Google Container Registry (GCR)
osxkeychain: Docker Hub
*/
credHelper = "osxkeychain"
/**
auth {
username = "*******"
password = "*******"
}
*/
tags = ["v" + casServerVersion]
}
container {
creationTime = "USE_CURRENT_TIMESTAMP"
entrypoint = ['docker/entrypoint.sh']
ports = ['80', '443', '8080', '8443']
labels = [version:casServerVersion, name:project.name, group:project.group]
}
extraDirectories {
paths = 'src/main/jib'
permissions = [
'/docker/entrypoint.sh': '755'
]
}
allowInsecureRegistries = project.allowInsecureRegistries
}
task copyWebAppIntoJib(type: Copy, group: "Docker", description: "Copy the web application into Docker image") {
dependsOn build
from "build/libs/${casWebApplicationBinaryName}"
into "src/main/jib/docker/cas/war"
}
task copyConfigIntoJib(type: Copy, group: "Docker", description: "Copy the CAS configuration into Docker image") {
dependsOn build
from "etc/cas"
into "src/main/jib/docker/cas"
}
task deleteWebAppFromJib(type: Delete, group: "Docker", description: "Explodes the CAS web application archive") {
delete "src/main/jib/docker/cas"
}

101
gradle/springboot.gradle Normal file
View File

@ -0,0 +1,101 @@
apply plugin: "org.springframework.boot"
configurations {
bootRunConfig.extendsFrom compileClasspath
}
dependencies {
bootRunConfig "org.apereo.cas:cas-server-webapp-init:${casServerVersion}"
bootRunConfig "org.apereo.cas:cas-server-webapp-tomcat:${casServerVersion}"
bootRunConfig "org.springframework.boot:spring-boot-devtools:${project.springBootVersion}"
}
sourceSets {
bootRunSources {
resources {
srcDirs new File("//etc/cas/templates/"),
new File("${project.getProjectDir()}/src/main/resources/")
}
}
}
bootRun {
classpath = configurations.bootRunConfig + sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath
doFirst {
sourceResources sourceSets.bootRunSources
systemProperties = System.properties
}
def list = []
list.add("-XX:TieredStopAtLevel=1")
list.add("-Xverify:none")
list.add("--add-modules")
list.add("java.se")
list.add("--add-exports")
list.add("java.base/jdk.internal.ref=ALL-UNNAMED")
list.add("--add-opens")
list.add("java.base/java.lang=ALL-UNNAMED")
list.add("--add-opens")
list.add("java.base/java.nio=ALL-UNNAMED")
list.add("--add-opens")
list.add("java.base/sun.nio.ch=ALL-UNNAMED")
list.add("--add-opens")
list.add("java.management/sun.management=ALL-UNNAMED")
list.add("--add-opens")
list.add("jdk.management/com.sun.management.internal=ALL-UNNAMED")
list.add("-XX:+UnlockExperimentalVMOptions")
list.add("-XX:+EnableJVMCI")
list.add("-XX:+UseJVMCICompiler")
list.add("-Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n")
jvmArgs = list
def appArgList = []
args = appArgList
}
springBoot {
buildInfo()
mainClassName = "org.apereo.cas.web.CasWebApplication"
}
bootWar {
def executable = project.hasProperty("executable") && Boolean.valueOf(project.getProperty("executable"))
if (executable) {
logger.info "Including launch script for executable WAR artifact"
launchScript()
} else {
logger.info "WAR artifact is not marked as an executable"
}
archiveName "${casWebApplicationBinaryName}"
baseName "cas"
excludeDevtools = false
entryCompression = ZipEntryCompression.STORED
/*
attachClasses = true
classesClassifier = 'classes'
archiveClasses = true
*/
overlays {
/*
https://docs.freefair.io/gradle-plugins/current/reference/#_io_freefair_war_overlay
Note: The "excludes" property is only for files in the war dependency.
If a jar is excluded from the war, it could be brought back into the final war as a dependency
of non-war dependencies. Those should be excluded via normal gradle dependency exclusions.
*/
cas {
from "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}@war"
provided = false
/*
excludes = ["WEB-INF/lib/somejar-1.0*"]
enableCompilation = true
includes = ["*.xyz"]
targetPath = "sub-path/bar"
skip = false
*/
}
}
}

View File

@ -1,66 +1,69 @@
import org.apache.ivy.util.url.*
import org.apache.ivy.util.url.ApacheURLLister
import org.apache.tools.ant.taskdefs.condition.Os
import java.nio.file.*
import org.gradle.internal.logging.text.StyledTextOutputFactory;
import static org.gradle.internal.logging.text.StyledTextOutput.Style;
import org.gradle.internal.logging.text.StyledTextOutputFactory
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
import static org.gradle.internal.logging.text.StyledTextOutput.Style
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
mavenContent { snapshotsOnly() }
}
}
dependencies {
classpath "org.apache.ivy:ivy:${project.ivyVersion}"
classpath "org.apereo.cas:cas-server-core-api-configuration-model:${project.'cas.version'}"
classpath "org.apereo.cas:cas-server-core-configuration-metadata-repository:${project.'cas.version'}"
}
}
apply plugin: "de.undercouch.download"
apply plugin: "com.boazj.log"
def tomcatDirectory = "${buildDir}/apache-tomcat-${tomcatVersion}"
project.ext."tomcatDirectory" = tomcatDirectory
def explodedDir="${buildDir}/cas"
def explodedDir = "${buildDir}/cas"
def explodedResourcesDir = "${buildDir}/cas-resources"
def resourceJarName = "cas-server-webapp-resources"
task copyCasConfiguration(type: Copy, group: "build", description: "Copy the CAS configuration from this project to /etc/cas/config") {
from "etc/cas/config"
into "/etc/cas/config"
into new File('/etc/cas/config').absolutePath
doFirst {
mkdir "/etc/cas/config"
new File('/etc/cas/config').mkdirs()
}
}
task copyWebAppIntoJib(type: Copy, group: "Docker", description: "Copy the web application into Docker image") {
dependsOn build
from "build/libs/${casWebApplicationBinaryName}"
into "src/main/jib/docker/cas/war"
}
task copyConfigIntoJib(type: Copy, group: "Docker", description: "Copy the CAS configuration into Docker image") {
dependsOn build
from "etc/cas"
into "src/main/jib/docker/cas"
}
task deleteWebAppFromJib(type: Delete, group: "Docker", description: "Explodes the CAS web application archive") {
delete "src/main/jib/docker/cas"
}
task explodeWar(type: Copy, group: "build", description: "Explodes the CAS web application archive") {
dependsOn build
task explodeWarOnly(type: Copy, group: "build", description: "Explodes the CAS web application archive") {
dependsOn 'build'
from zipTree("build/libs/${casWebApplicationBinaryName}")
into explodedDir
}
task explodeWar(type: Copy, group: "build", description: "Explodes the CAS archive and resources jar from the CAS web application archive") {
dependsOn explodeWarOnly
from zipTree("${explodedDir}/WEB-INF/lib/${resourceJarName}-${casServerVersion}.jar")
into explodedResourcesDir
}
task run(group: "build", description: "Run the CAS web application in embedded container mode") {
dependsOn build
dependsOn 'build'
doLast {
def casRunArgs = Arrays.asList("-Xmx2048M -XX:+TieredCompilation -XX:TieredStopAtLevel=1".split(" "))
def casRunArgs = Arrays.asList("-server -noverify -Xmx2048M -XX:+TieredCompilation -XX:TieredStopAtLevel=1".split(" "))
javaexec {
main = "-jar"
jvmArgs = casRunArgs
args = ["build/libs/${casWebApplicationBinaryName}"]
systemProperties = System.properties
logger.info "Started ${commandLine}"
}
}
@ -73,8 +76,8 @@ task setExecutable(group: "build", description: "Configure the project to run in
}
}
task executable(type:Exec, group: "build", description: "Run the CAS web application in standalone executable mode") {
dependsOn setExecutable, build
task executable(type: Exec, group: "build", description: "Run the CAS web application in standalone executable mode") {
dependsOn setExecutable, 'build'
doFirst {
workingDir "."
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
@ -86,7 +89,7 @@ task executable(type:Exec, group: "build", description: "Run the CAS web applica
}
task debug(group: "build", description: "Debug the CAS web application in embedded mode on port 5005") {
dependsOn build
dependsOn 'build'
doLast {
logger.info "Debugging process is started in a suspended state, listening on port 5005."
def casArgs = Arrays.asList("-Xmx2048M".split(" "))
@ -95,12 +98,13 @@ task debug(group: "build", description: "Debug the CAS web application in embedd
jvmArgs = casArgs
debug = true
args = ["build/libs/${casWebApplicationBinaryName}"]
systemProperties = System.properties
logger.info "Started ${commandLine}"
}
}
}
task downloadShell (group: "shell", description: "Download CAS shell jar from snapshot or release maven repo") {
task downloadShell(group: "shell", description: "Download CAS shell jar from snapshot or release maven repo") {
doFirst {
mkdir "${project.shellDir}"
}
@ -109,7 +113,7 @@ task downloadShell (group: "shell", description: "Download CAS shell jar from sn
if (isRunningCasServerSnapshot(casServerVersion)) {
def snapshotDir = "https://oss.sonatype.org/content/repositories/snapshots/org/apereo/cas/cas-server-support-shell/${casServerVersion}/"
def files = new ApacheURLLister().listFiles(new URL(snapshotDir))
files = files.sort{it.path}
files = files.sort { it.path }
files.each {
if (it.path.endsWith(".jar")) {
downloadFile = it
@ -127,14 +131,14 @@ task downloadShell (group: "shell", description: "Download CAS shell jar from sn
}
}
task runShell (group: "shell", description: "Run the CAS shell") {
task runShell(group: "shell", description: "Run the CAS shell") {
dependsOn downloadShell
doLast {
println "Run the following command to launch the shell:\n\tjava -jar ${project.shellDir}/cas-server-support-shell-${casServerVersion}.jar"
}
}
task debugShell (group: "shell", description: "Run the CAS shell with debug options, wait for debugger on port 5005") {
task debugShell(group: "shell", description: "Run the CAS shell with debug options, wait for debugger on port 5005") {
dependsOn downloadShell
doLast {
println """
@ -155,7 +159,7 @@ task allDependenciesInsight(group: "build", type: DependencyInsightReportTask, d
task allDependencies(group: "build", type: DependencyReportTask, description: "Display a graph of all project dependencies") {}
task casVersion (group: "build", description: "Display the current CAS version") {
task casVersion(group: "build", description: "Display the current CAS version") {
doFirst {
def verbose = project.hasProperty("verbose") && Boolean.valueOf(project.getProperty("verbose"))
if (verbose) {
@ -176,7 +180,7 @@ task casVersion (group: "build", description: "Display the current CAS version")
}
}
task createKeystore (group: "build", description: "Create CAS keystore") {
task createKeystore(group: "build", description: "Create CAS keystore") {
doFirst {
mkdir "/etc/cas"
@ -211,18 +215,73 @@ task createKeystore (group: "build", description: "Create CAS keystore") {
}
}
task listTemplateViews (group: "build", description: "List all CAS views") {
task listTemplateViews(group: "build", description: "List all CAS views") {
dependsOn explodeWar
doFirst {
fileTree(explodedDir).matching {
fileTree(explodedResourcesDir).matching {
include "**/*.html"
}
.collect { it.name }
.toSorted()
.each { println it }
.collect { it.name }
.toSorted()
.each { println it }
}
}
task exportConfigMetadata(group: "build", description: "Export collection of CAS properties") {
doLast {
def file = new File(project.rootDir, 'config-metadata.properties')
file.withWriter('utf-8') { writer ->
def metadataRepository = new org.apereo.cas.metadata.CasConfigurationMetadataRepository()
def repository = metadataRepository.repository;
repository.allGroups
.values()
.sort { o1, o2 -> o1.id <=> o2.id }
.each({ group ->
def groupProperties = group.properties
if (!groupProperties.isEmpty()) {
def groupId = group.id.equalsIgnoreCase("_ROOT_GROUP_") ? "" : group.id + "."
writer.writeLine("# Group ${group.id}");
writer.writeLine("# ====================")
groupProperties
.values()
.sort { o1, o2 -> o1.id <=> o2.id }
.each({ property ->
def description = property.shortDescription
if (!property.shortDescription?.equalsIgnoreCase(property.description) && property.description != null) {
description = property.description.replace('\n', '#')
}
writer.writeLine("# ${description}");
writer.writeLine("# Type: ${property.type}");
if (property.deprecated) {
def deprecation = property.deprecation
writer.writeLine("# This setting is deprecated with a severity level of ${deprecation.level}.")
if (deprecation.shortReason != null) {
writer.writeLine("# because ${deprecation.shortReason}")
}
if (deprecation.replacement != null) {
writer.writeLine("# Replace with: ${deprecation.replacement}")
}
}
property.hints.valueHints.each {
if (it.value instanceof Object[]) {
if (it.value[0].toString().contains("RequiresModule")) {
writer.writeLine("# Required module: org.apereo.cas:${it.description}")
writer.writeLine("# Automatically included/available: ${it.value[1]}")
}
}
if (it.value.toString().contains("RequiredProperty")) {
writer.writeLine("# Note: This setting is required!")
}
}
writer.writeLine("${groupId}${property.name}=${property.defaultValue}")
writer.writeLine("")
});
}
});
}
println "Configuration metadata is available at ${file.absolutePath}"
}
}
@ -232,8 +291,9 @@ task getResource(group: "build", description: "Fetch a CAS resource and move it
doFirst {
def resourceName = project.getProperty("resourceName")
def results = fileTree(explodedDir).matching {
def results = fileTree(explodedResourcesDir).matching {
include "**/${resourceName}.*"
include "**/${resourceName}"
}
if (results.isEmpty()) {
println "No resources could be found matching ${resourceName}"
@ -244,7 +304,7 @@ task getResource(group: "build", description: "Fetch a CAS resource and move it
return
}
def fromFile = explodedDir + "/WEB-INF/classes"
def fromFile = explodedResourcesDir
def resourcesDir = "src/main/resources"
mkdir resourcesDir
@ -263,55 +323,9 @@ def isRunningCasServerSnapshot(casServerVersion) {
return "${casServerVersion}".contains("-SNAPSHOT")
}
task downloadTomcat(type: Download) {
def tomcatMajorVersion = "${tomcatVersion}".substring(0, "${tomcatVersion}".indexOf("."))
def downloadFile = "https://www.apache.org/dist/tomcat/tomcat-${tomcatMajorVersion}/v${tomcatVersion}/bin/apache-tomcat-${tomcatVersion}.zip"
logger.info "Downloading file $downloadFile"
src downloadFile
dest new File("apache-tomcat.zip")
overwrite false
}
task unzipTomcat(type: Copy) {
from zipTree(downloadTomcat.dest)
into buildDir
includeEmptyDirs = false
}
task shutdownTomcat(type:Exec) {
doFirst {
new File("${tomcatDirectory}/bin/catalina.sh").setExecutable(true)
new File("${tomcatDirectory}/bin/shutdown.sh").setExecutable(true)
environment["CATALINA_HOME"] = "${tomcatDirectory}"
commandLine "${tomcatDirectory}/bin/shutdown.sh", "2>/dev/null"
ignoreExitValue = true
task verifyRequiredJavaVersion {
logger.info "Checking current Java version ${JavaVersion.current()} for required Java version ${project.targetCompatibility}"
if (!JavaVersion.current().name.equalsIgnoreCase("${project.targetCompatibility}")) {
throw new GradleException("Current Java version ${JavaVersion.current()} does not match required Java version ${project.targetCompatibility}")
}
}
task tomcatDeploy(type:Exec) {
dependsOn build, downloadTomcat, unzipTomcat, shutdownTomcat
doFirst {
Files.copy(Paths.get(bootWar.archivePath.canonicalPath),
Paths.get("${tomcatDirectory}/webapps/${casWebApplicationBinaryName}"),
StandardCopyOption.REPLACE_EXISTING)
new File("${tomcatDirectory}/bin/catalina.sh").setExecutable(true)
new File("${tomcatDirectory}/bin/startup.sh").setExecutable(true)
mkdir "${tomcatDirectory}/logs"
environment["CATALINA_HOME"] = "${tomcatDirectory}"
commandLine "${tomcatDirectory}/bin/startup.sh"
}
}
tail {
log = files("${tomcatDirectory}/logs/catalina.out")
showColors = true
doFirst {
println "Type 'quit' to exit"
}
}
build.mustRunAfter(setExecutable)
unzipTomcat.mustRunAfter(downloadTomcat)
shutdownTomcat.mustRunAfter(unzipTomcat)
tomcatDeploy.mustRunAfter(shutdownTomcat).finalizedBy(tail)

View File

@ -1,13 +0,0 @@
buildscript {
repositories {
maven { url "https://dl.bintray.com/scalding/maven" }
mavenCentral()
}
dependencies {
classpath "org.scaldingspoon.gradle:gradle-waroverlay-plugin:0.9.3"
}
}
if (!project.plugins.findPlugin(scaldingspoon.gradle.WarOverlayPlugin)) {
project.apply(plugin: scaldingspoon.gradle.WarOverlayPlugin)
}

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

51
gradlew vendored
View File

@ -1,5 +1,21 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
@ -138,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@ -159,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

187
gradlew.bat vendored
View File

@ -1,84 +1,103 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

2
lombok.config Normal file
View File

@ -0,0 +1,2 @@
# This file is generated by the 'io.freefair.lombok' Gradle plugin
config.stopBubbling = true

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1"
metadata-complete="true"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>