Skip to content

Commit e5dcbdd

Browse files
committed
update cas-server version
1 parent 146c1bb commit e5dcbdd

File tree

17 files changed

+647
-172
lines changed

17 files changed

+647
-172
lines changed

cas/cas-secured-app/pom.xml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<parent>
1313
<groupId>org.springframework.boot</groupId>
1414
<artifactId>spring-boot-starter-parent</artifactId>
15-
<version>2.0.0.M7</version>
15+
<version>1.5.13.RELEASE</version>
1616
<relativePath/> <!-- lookup parent from repository -->
1717
</parent>
1818

@@ -60,28 +60,6 @@
6060
</plugins>
6161
</build>
6262

63-
<repositories>
64-
<repository>
65-
<id>spring-milestones</id>
66-
<name>Spring Milestones</name>
67-
<url>https://repo.spring.io/milestone</url>
68-
<snapshots>
69-
<enabled>false</enabled>
70-
</snapshots>
71-
</repository>
72-
</repositories>
73-
74-
<pluginRepositories>
75-
<pluginRepository>
76-
<id>spring-milestones</id>
77-
<name>Spring Milestones</name>
78-
<url>https://repo.spring.io/milestone</url>
79-
<snapshots>
80-
<enabled>false</enabled>
81-
</snapshots>
82-
</pluginRepository>
83-
</pluginRepositories>
84-
8563
<properties>
8664
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8765
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/AuthController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.baeldung.cassecuredapp.controllers;
22

3-
import org.apache.logging.log4j.Logger;
4-
import org.apache.logging.log4j.LogManager;
3+
import org.apache.log4j.LogManager;
4+
import org.apache.log4j.Logger;
55
import org.springframework.security.core.Authentication;
66
import org.springframework.security.core.context.SecurityContextHolder;
77
import org.springframework.security.web.authentication.logout.CookieClearingLogoutHandler;

cas/cas-server/.factorypath

Lines changed: 228 additions & 0 deletions
Large diffs are not rendered by default.

cas/cas-server/README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ Generic CAS WAR overlay to exercise the latest versions of CAS. This overlay cou
66
# Versions
77

88
```xml
9-
<cas.version>5.1.x</cas.version>
9+
<cas.version>5.3.x</cas.version>
1010
```
1111

1212
# Requirements
13+
1314
* JDK 1.8+
1415

1516
# Configuration
@@ -64,20 +65,23 @@ Run the CAS web application as an executable WAR via Spring Boot. This is most u
6465

6566
### Warning!
6667

67-
Be careful with this method of deployment. `bootRun` is not designed to work with already executable WAR artifacts such that CAS server web application. YMMV. Today, uses of this mode ONLY work when there is **NO OTHER** dependency added to the build script and the `cas-server-webapp` is the only present module. See [this issue](https://github.com/apereo/cas/issues/2334) and [this issue](https://github.com/spring-projects/spring-boot/issues/8320) for more info.
68+
Be careful with this method of deployment. `bootRun` is not designed to work with already executable WAR artifacts such that CAS server web application. YMMV. Today, uses of this mode ONLY work when there is **NO OTHER** dependency added to the build script and the `cas-server-webapp` is the only present module. See [this issue](https://github.com/spring-projects/spring-boot/issues/8320) for more info.
6869

6970

7071
## Spring Boot App Server Selection
71-
There is an app.server property in the pom.xml that can be used to select a spring boot application server.
72-
It defaults to "-tomcat" but "-jetty" and "-undertow" are supported.
73-
It can also be set to an empty value (nothing) if you want to deploy CAS to an external application server of your choice and you don't want the spring boot libraries included.
72+
73+
There is an app.server property in the `pom.xml` that can be used to select a spring boot application server.
74+
It defaults to `-tomcat` but `-jetty` and `-undertow` are supported.
75+
76+
It can also be set to an empty value (nothing) if you want to deploy CAS to an external application server of your choice.
7477

7578
```xml
7679
<app.server>-tomcat<app.server>
7780
```
7881

7982
## Windows Build
80-
If you are building on windows, try build.cmd instead of build.sh. Arguments are similar but for usage, run:
83+
84+
If you are building on windows, try `build.cmd` instead of `build.sh`. Arguments are similar but for usage, run:
8185

8286
```
8387
build.cmd help
@@ -86,3 +90,12 @@ build.cmd help
8690
## External
8791

8892
Deploy resultant `target/cas.war` to a servlet container of choice.
93+
94+
95+
## Command Line Shell
96+
97+
Invokes the CAS Command Line Shell. For a list of commands either use no arguments or use `-h`. To enter the interactive shell use `-sh`.
98+
99+
```bash
100+
./build.sh cli
101+
```

cas/cas-server/build.cmd

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
@if "%1" == "bootrun" call:bootrun %2 %3 %4
2424
@if "%1" == "debug" call:debug %2 %3 %4
2525
@if "%1" == "run" call:run %2 %3 %4
26+
@if "%1" == "runalone" call:runalone %2 %3 %4
2627
@if "%1" == "help" call:help
2728
@if "%1" == "gencert" call:gencert
29+
@if "%1" == "cli" call:runcli %2 %3 %4
2830

2931
@rem function section starts here
3032
@goto:eof
@@ -38,7 +40,7 @@
3840
@goto:eof
3941

4042
:help
41-
@echo "Usage: build.bat [copy|clean|package|run|debug|bootrun|gencert] [optional extra args for maven]"
43+
@echo "Usage: build.bat [copy|clean|package|run|debug|bootrun|gencert|cli] [optional extra args for maven or cli]"
4244
@echo "To get started on a clean system, run "build.bat copy" and "build.bat gencert", then "build.bat run"
4345
@echo "Note that using the copy or gencert arguments will create and/or overwrite the %CAS_DIR% which is outside this project"
4446
@goto:eof
@@ -66,6 +68,10 @@
6668
call:package %1 %2 %3 & java %JAVA_ARGS% -jar target/cas.war
6769
@goto:eof
6870

71+
:runalone
72+
call:package %1 %2 %3 & target/cas.war
73+
@goto:eof
74+
6975
:gencert
7076
where /q keytool
7177
if ERRORLEVEL 1 (
@@ -80,3 +86,17 @@
8086
keytool -exportcert -alias cas -storepass changeit -keystore %CAS_DIR%\thekeystore -file %CAS_DIR%\cas.cer
8187
)
8288
@goto:eof
89+
90+
:runcli
91+
for /f %%i in ('call %MAVEN_CMD% -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${cas.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"') do set CAS_VERSION=%%i
92+
@set CAS_VERSION=%CAS_VERSION: =%
93+
@set DOWNLOAD_DIR=target
94+
@set COMMAND_FILE=cas-server-support-shell-%CAS_VERSION%.jar
95+
@if not exist %DOWNLOAD_DIR% mkdir %DOWNLOAD_DIR%
96+
@if not exist %DOWNLOAD_DIR%\%COMMAND_FILE% (
97+
@call mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -DgroupId=org.apereo.cas -DartifactId=cas-server-support-shell -Dversion=%CAS_VERSION% -Dpackaging=jar -DartifactItem.outputDirectory=%DOWNLOAD_DIR% -DartifactItem.destFileName=%COMMAND_FILE% -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,snapshots::::https://oss.sonatype.org/content/repositories/snapshots -Dtransitive=false
98+
@call mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dmdep.useBaseVersion=true -Dartifact=org.apereo.cas:cas-server-support-shell:%CAS_VERSION%:jar -DoutputDirectory=%DOWNLOAD_DIR%
99+
)
100+
@call java %JAVA_ARGS% -jar %DOWNLOAD_DIR%\%COMMAND_FILE% %1 %2 %3
101+
102+
@goto:eof

cas/cas-server/build.sh

Lines changed: 104 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,31 @@ function help() {
1313
echo "Usage: build.sh [copy|clean|package|run|debug|bootrun|gencert]"
1414
echo " copy: Copy config from ./etc/cas/config to /etc/cas/config"
1515
echo " clean: Clean Maven build directory"
16-
echo " package: Clean and build CAS war, also call copy"
17-
echo " run: Build and run CAS.war via spring boot (java -jar target/cas.war)"
16+
echo " package: Clean and build CAS war"
17+
echo " run: Build and run cas.war via Java (i.e. java -jar target/cas.war)"
18+
echo " runalone: Build and run cas.war on its own as a standalone executable (target/cas.war)"
1819
echo " debug: Run CAS.war and listen for Java debugger on port 5000"
19-
echo " bootrun: Run with maven spring boot plugin, doesn't work with multiple dependencies"
20+
echo " bootrun: Run with maven spring boot plugin"
21+
echo " listviews: List all CAS views that ship with the web application and can be customized in the overlay"
22+
echo " getview: Ask for a view name to be included in the overlay for customizations"
2023
echo " gencert: Create keystore with SSL certificate in location where CAS looks by default"
24+
echo " cli: Run the CAS command line shell and pass commands"
2125
}
2226

2327
function clean() {
28+
shift
2429
./mvnw clean "$@"
2530
}
2631

2732
function package() {
33+
shift
2834
./mvnw clean package -T 5 "$@"
29-
copy
35+
# copy
3036
}
3137

3238
function bootrun() {
33-
./mvnw clean package spring-boot:run -T 5 "$@"
39+
shift
40+
./mvnw clean package spring-boot:run -P bootiful -T 5 "$@"
3441
}
3542

3643
function debug() {
@@ -41,14 +48,59 @@ function run() {
4148
package && java -jar target/cas.war
4249
}
4350

51+
function runalone() {
52+
shift
53+
./mvnw clean package -P default,exec "$@"
54+
chmod +x target/cas.war
55+
target/cas.war
56+
}
57+
58+
function listviews() {
59+
shift
60+
explodeapp
61+
find $PWD/target/cas -type f -name "*.html" | xargs -n 1 basename | sort | more
62+
}
63+
64+
function explodeapp() {
65+
if [ ! -d $PWD/target/cas ];then
66+
echo "Building the CAS web application and exploding the final war file..."
67+
./mvnw clean package war:exploded "$@"
68+
fi
69+
echo "Exploded the CAS web application file."
70+
}
71+
72+
function getview() {
73+
shift
74+
explodeapp
75+
echo "Searching for view name $@..."
76+
results=`find $PWD/target/cas -type f -name "*.html" | grep -i "$@"`
77+
echo -e "Found view(s): \n$results"
78+
count=`wc -w <<< "$results"`
79+
if [ "$count" -eq 1 ];then
80+
# echo "Found view $results to include in the overlay"
81+
firststring="target/cas/WEB-INF/classes"
82+
secondstring="src/main/resources"
83+
overlayfile=`echo "${results/$firststring/$secondstring}"`
84+
overlaypath=`dirname "${overlayfile}"`
85+
# echo "Overlay file is $overlayfile to be created at $overlaypath"
86+
mkdir -p $overlaypath
87+
cp $results $overlaypath
88+
echo "Created view at $overlayfile"
89+
ls $overlayfile
90+
else
91+
echo "More than one view file is found. Narrow down the search query..."
92+
fi
93+
}
94+
95+
4496
function gencert() {
45-
if [[ ! -d /etc/cas ]] ; then
97+
if [[ ! -d /etc/cas ]] ; then
4698
copy
4799
fi
48100
which keytool
49101
if [[ $? -ne 0 ]] ; then
50-
echo Error: Java JDK \'keytool\' is not installed or is not in the path
51-
exit 1
102+
echo Error: Java JDK \'keytool\' is not installed or is not in the path
103+
exit 1
52104
fi
53105
# override DNAME and CERT_SUBJ_ALT_NAMES before calling or use dummy values
54106
DNAME="${DNAME:-CN=cas.example.org,OU=Example,OU=Org,C=US}"
@@ -58,21 +110,49 @@ function gencert() {
58110
keytool -exportcert -alias cas -storepass changeit -keystore /etc/cas/thekeystore -file /etc/cas/cas.cer
59111
}
60112

113+
function cli() {
114+
115+
CAS_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${cas.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec 2>/dev/null)
116+
# echo "CAS version: $CAS_VERSION"
117+
JAR_FILE_NAME="cas-server-support-shell-${CAS_VERSION}.jar"
118+
# echo "JAR name: $JAR_FILE_NAME"
119+
JAR_PATH="org/apereo/cas/cas-server-support-shell/${CAS_VERSION}/${JAR_FILE_NAME}"
120+
# echo "JAR path: $JAR_PATH"
121+
122+
JAR_FILE_LOCAL="$HOME/.m2/repository/$JAR_PATH";
123+
# echo "Local JAR file path: $JAR_FILE_LOCAL";
124+
if [ -f "$JAR_FILE_LOCAL" ]; then
125+
# echo "Using JAR file locally at $JAR_FILE_LOCAL"
126+
java -jar $JAR_FILE_LOCAL "$@"
127+
exit 0;
128+
fi
129+
130+
DOWNLOAD_DIR=./target
131+
COMMAND_FILE="${DOWNLOAD_DIR}/${JAR_FILE_NAME}"
132+
if [ ! -f "$COMMAND_FILE" ]; then
133+
mkdir -p $DOWNLOAD_DIR
134+
./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -DgroupId=org.apereo.cas -DartifactId=cas-server-support-shell -Dversion=$CAS_VERSION -Dpackaging=jar -DartifactItem.outputDirectory=$DOWNLOAD_DIR -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,snapshots::::https://oss.sonatype.org/content/repositories/snapshots -Dtransitive=false
135+
./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dmdep.useBaseVersion=true -Dartifact=org.apereo.cas:cas-server-support-shell:$CAS_VERSION:jar -DoutputDirectory=$DOWNLOAD_DIR
136+
fi
137+
java -jar $COMMAND_FILE "$@"
138+
exit 0;
139+
140+
}
141+
61142
if [ $# -eq 0 ]; then
62143
echo -e "No commands provided. Defaulting to [run]\n"
63144
run
64145
exit 0
65146
fi
66147

67-
68148
case "$1" in
69149
"copy")
70-
copy
150+
copy
71151
;;
72152
"clean")
73153
shift
74154
clean "$@"
75-
;;
155+
;;
76156
"package")
77157
shift
78158
package "$@"
@@ -87,11 +167,23 @@ case "$1" in
87167
"run")
88168
run "$@"
89169
;;
170+
"runalone")
171+
runalone "$@"
172+
;;
173+
"listviews")
174+
listviews "$@"
175+
;;
90176
"gencert")
91177
gencert "$@"
92178
;;
179+
"getview")
180+
getview "$@"
181+
;;
182+
"cli")
183+
shift
184+
cli "$@"
185+
;;
93186
*)
94187
help
95188
;;
96189
esac
97-

cas/cas-server/etc/cas/config/log4j2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<AsyncLogger name="org.openid4java" level="warn" />
9393
<AsyncLogger name="org.ldaptive" level="warn" />
9494
<AsyncLogger name="com.hazelcast" level="warn" />
95-
<AsyncLogger name="org.jasig.spring" level="warn" />
95+
<AsyncLogger name="org.apereo.spring" level="warn" />
9696

9797
<!-- Log perf stats only to perfStats.log -->
9898
<AsyncLogger name="perfStatsLogger" level="info" additivity="false" includeLocation="true">
70.2 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
distributionUrl=https\://repository.apache.org/content/repositories/releases/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
1+
#Maven download properties
2+
#Fri Dec 01 21:35:11 MST 2017
3+
distributionUrl=https\://repository.apache.org/content/repositories/releases/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip

0 commit comments

Comments
 (0)