JAVA-18523 Upgrade cas module and related articles (#14504)

* JAVA-18523 Upgrade cas module and related articles

* JAVA-18523 Remove deprecated  WebSecurityConfigurerAdapter
This commit is contained in:
anuragkumawat
2023-08-02 11:00:48 +05:30
committed by GitHub
parent 50147f3c8e
commit d4fec3ad45
39 changed files with 1252 additions and 709 deletions
@@ -48,14 +48,14 @@ public class CasSecuredApplication {
public ServiceProperties serviceProperties() {
logger.info("service properties");
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.setService("http://cas-client:8900/login/cas");
serviceProperties.setService("http://localhost:8900/login/cas");
serviceProperties.setSendRenew(false);
return serviceProperties;
}
@Bean
public TicketValidator ticketValidator() {
return new Cas30ServiceTicketValidator("https://localhost:8443");
return new Cas30ServiceTicketValidator("https://localhost:8443/cas");
}
@Bean
@@ -66,7 +66,7 @@ public class CasSecuredApplication {
provider.setServiceProperties(serviceProperties);
provider.setTicketValidator(ticketValidator);
provider.setUserDetailsService(
s -> new User("[email protected]", "Mellon", true, true, true, true,
s -> new User("casuser", "Mellon", true, true, true, true,
AuthorityUtils.createAuthorityList("ROLE_ADMIN")));
provider.setKey("CAS_PROVIDER_LOCALHOST_8900");
return provider;
@@ -80,7 +80,7 @@ public class CasSecuredApplication {
@Bean
public LogoutFilter logoutFilter() {
LogoutFilter logoutFilter = new LogoutFilter("https://localhost:8443/logout", securityContextLogoutHandler());
LogoutFilter logoutFilter = new LogoutFilter("https://localhost:8443/cas/logout", securityContextLogoutHandler());
logoutFilter.setFilterProcessesUrl("/logout/cas");
return logoutFilter;
}
@@ -1,15 +1,11 @@
package com.baeldung.cassecuredapp.config;
import org.jasig.cas.client.session.SingleSignOutFilter;
import org.jasig.cas.client.validation.Cas30ServiceTicketValidator;
import org.jasig.cas.client.validation.TicketValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.ProviderManager;
import org.springframework.security.cas.ServiceProperties;
import org.springframework.security.cas.authentication.CasAuthenticationProvider;
import org.springframework.security.cas.web.CasAuthenticationEntryPoint;
@@ -17,16 +13,12 @@ import org.springframework.security.cas.web.CasAuthenticationFilter;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.logout.LogoutFilter;
import java.util.Collections;
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public class WebSecurityConfig {
private Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class);
private SingleSignOutFilter singleSignOutFilter;
@@ -45,31 +37,28 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
}
@Override
protected void configure(HttpSecurity http) throws Exception {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers( "/secured", "/login").authenticated()
.and()
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint())
.and()
.addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class)
.addFilterBefore(logoutFilter, LogoutFilter.class)
.csrf().ignoringAntMatchers("/exit/cas");
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(casAuthenticationProvider);
.and()
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint())
.and()
.addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class)
.addFilterBefore(logoutFilter, LogoutFilter.class)
.csrf().ignoringAntMatchers("/exit/cas");
return http.build();
}
@Bean
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return new ProviderManager(Collections.singletonList(casAuthenticationProvider));
public AuthenticationManager authManager(HttpSecurity http) throws Exception {
return http.getSharedObject(AuthenticationManagerBuilder.class)
.authenticationProvider(casAuthenticationProvider)
.build();
}
public AuthenticationEntryPoint authenticationEntryPoint() {
CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint();
entryPoint.setLoginUrl("https://localhost:8443/login");
entryPoint.setLoginUrl("https://localhost:8443/cas/login");
entryPoint.setServiceProperties(serviceProperties);
return entryPoint;
}
@@ -0,0 +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
gradlew text eol=lf
*.cmd text eol=crlf
*.bat text eol=crlf
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
+11
View File
@@ -0,0 +1,11 @@
{
"extends": [
"config:base",
":preserveSemverRanges",
":rebaseStalePrs",
":disableRateLimiting",
":semanticCommits",
":semanticCommitTypeAll(renovatebot)"
],
"labels": ["dependencies", "bot"]
}
@@ -0,0 +1,39 @@
name: Build
env:
JAVA_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server -XX:+UseG1GC"
GRADLE_OPTS: "-Xms512m -Xmx6048m -Xss128m -XX:ReservedCodeCacheSize=512m -server -XX:+UseG1GC"
TERM: xterm-256color
JDK_CURRENT: 17
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
cancel-previous-runs:
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
build:
needs: cancel-previous-runs
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: 'temurin'
- name: Build
run: ./gradlew clean build
+29 -1
View File
@@ -1,3 +1,28 @@
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
.classpath
!/.project
.project
@@ -18,4 +43,7 @@ bin/
*.log
tmp/
./apache-tomcat
apache-tomcat.zip
apache-tomcat.zip
config-metadata.properties
node-modules
package-lock.json
@@ -1,32 +0,0 @@
#
# 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:
@@ -1,62 +0,0 @@
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"
+9 -5
View File
@@ -1,9 +1,13 @@
FROM adoptopenjdk/openjdk11:alpine-slim AS overlay
ARG BASE_IMAGE="eclipse-temurin:17-jdk"
ARG EXT_BUILD_COMMANDS=""
ARG EXT_BUILD_OPTIONS=""
FROM $BASE_IMAGE 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/
COPY ./gradlew ./settings.gradle ./build.gradle ./gradle.properties ./lombok.config /cas-overlay/
RUN mkdir -p ~/.gradle \
&& echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties \
@@ -13,9 +17,9 @@ RUN mkdir -p ~/.gradle \
&& ./gradlew --version;
RUN cd cas-overlay \
&& ./gradlew clean build --parallel;
&& ./gradlew clean build $EXT_BUILD_COMMANDS --parallel --no-daemon $EXT_BUILD_OPTIONS;
FROM adoptopenjdk/openjdk11:alpine-jre AS cas
FROM $BASE_IMAGE AS cas
LABEL "Organization"="Apereo"
LABEL "Description"="Apereo CAS"
@@ -26,11 +30,11 @@ RUN cd / \
&& mkdir -p /etc/cas/saml \
&& mkdir -p cas-overlay;
COPY --from=overlay cas-overlay/build/libs/cas.war 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
+1
View File
@@ -0,0 +1 @@
web: java $JAVA_OPTS -jar build/libs/cas.war --server.port=$PORT --server.ssl.enabled=false
+1 -1
View File
@@ -1,2 +1,2 @@
# Relevant Articles
- [CAS SSO With Spring Security](https://www.baeldung.com/spring-security-cas-sso)
- [CAS SSO With Spring Security](https://www.baeldung.com/spring-security-cas-sso)
File diff suppressed because it is too large Load Diff
@@ -1,10 +0,0 @@
#!/bin/bash
image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`)
echo "Building CAS docker image tagged as [$image_tag]"
# read -p "Press [Enter] to continue..." any_key;
docker build --tag="org.apereo.cas/cas:$image_tag" . \
&& echo "Built CAS image successfully tagged as org.apereo.cas/cas:$image_tag" \
&& docker images "org.apereo.cas/cas:$image_tag"
@@ -1,12 +0,0 @@
#!/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 $image_tag to org.apereo.cas/cas..."
docker push org.apereo.cas/cas:"$image_tag" \
&& echo "Pushed org.apereo.cas/cas:$image_tag successfully.";
@@ -1,7 +0,0 @@
#!/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:"${image_tag}"
docker logs -f cas
@@ -1,6 +0,0 @@
cas.server.name=https://cas.example.org:8443
cas.server.prefix=${cas.server.name}/cas
logging.config: file:/etc/cas/config/log4j2.xml
# cas.authn.accept.users=
@@ -1,42 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
All loggers are asynchronous because of log42.component.properties in cas-server-core-logging-api.
Set -Dlog4j2.contextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector or override log42.component.properties to turn off async
-->
<!-- Specify the refresh internal in seconds. -->
<Configuration monitorInterval="5" packages="org.apereo.cas.logging">
<Properties>
<Property name="baseDir">/var/log</Property>
<Property name="cas.log.level">info</Property>
<Property name="spring.webflow.log.level">warn</Property>
<Property name="spring.security.log.level">info</Property>
<Property name="spring.cloud.log.level">warn</Property>
<Property name="spring.boot.admin.log.level">debug</Property>
<Property name="spring.web.log.level">warn</Property>
<Property name="spring.boot.log.level">warn</Property>
<Property name="ldap.log.level">warn</Property>
<Property name="pac4j.log.level">warn</Property>
<Property name="opensaml.log.level">warn</Property>
<Property name="hazelcast.log.level">warn</Property>
<Property name="log.console.stacktraces">true</Property>
<Property name="log.file.stacktraces">false</Property>
<!-- -Dlog.stacktraceappender=null to disable stacktrace log -->
<Property name="log.stacktraceappender">casStackTraceFile</Property>
<Property name="log.include.location">false</Property>
</Properties>
<Appenders>
<Null name="null" />
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%highlight{%d %p [%c] - &lt;%m&gt;}%n"/>
<PatternLayout pattern="%highlight{%d %p [%c] - &lt;%m&gt;}%n" alwaysWriteExceptions="${sys:log.console.stacktraces}"/>
</Console>
<RollingFile name="file" fileName="${baseDir}/cas.log" append="true"
filePattern="${baseDir}/cas-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%d %p [%c] - &lt;%m&gt;%n"/>
filePattern="${baseDir}/cas-%d{yyyy-MM-dd-HH}-%i.log.gz"
immediateFlush="false">
<PatternLayout pattern="%highlight{%d %p [%c] - &lt;%m&gt;%n}"
alwaysWriteExceptions="${sys:log.file.stacktraces}" />
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="5" compressionLevel="9">
<Delete basePath="${baseDir}" maxDepth="2">
<IfFileName glob="*/*.log.gz" />
<IfLastModified age="7d" />
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="auditlogfile" fileName="${baseDir}/cas_audit.log" append="true"
filePattern="${baseDir}/cas_audit-%d{yyyy-MM-dd-HH}-%i.log">
<PatternLayout pattern="%d %p [%c] - %m%n"/>
<RollingFile name="stacktracefile" fileName="${baseDir}/cas_stacktrace.log" append="true"
filePattern="${baseDir}/cas_stacktrace-%d{yyyy-MM-dd-HH}-%i.log.gz"
immediateFlush="false">
<PatternLayout pattern="%highlight{%d %p [%c] - &lt;%m&gt;%n}" />
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="5" compressionLevel="9">
<Delete basePath="${baseDir}" maxDepth="2">
<IfFileName glob="*/*.log.gz" />
<IfLastModified age="7d" />
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<RollingFile name="auditlogfile" fileName="${baseDir}/cas_audit.log" append="true"
filePattern="${baseDir}/cas_audit-%d{yyyy-MM-dd-HH}-%i.log.gz"
immediateFlush="false">
<PatternLayout pattern="%highlight{%d %p [%c] - %m%n}" />
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy size="10 MB"/>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="5" compressionLevel="9">
<Delete basePath="${baseDir}" maxDepth="2">
<IfFileName glob="*/*.log.gz" />
<IfLastModified age="7d" />
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
<CasAppender name="casAudit">
@@ -45,75 +88,76 @@
<CasAppender name="casFile">
<AppenderRef ref="file" />
</CasAppender>
<CasAppender name="casStackTraceFile">
<AppenderRef ref="stacktracefile" />
<ExceptionOnlyFilter/>
</CasAppender>
<CasAppender name="casConsole">
<AppenderRef ref="console" />
</CasAppender>
</Appenders>
<Loggers>
<!-- If adding a Logger with level set higher than warn, make category as selective as possible -->
<!-- Loggers inherit appenders from Root Logger unless additivity is false -->
<AsyncLogger name="org.apereo" level="${sys:cas.log.level}" includeLocation="true"/>
<AsyncLogger name="org.apereo.services.persondir" level="${sys:cas.log.level}" includeLocation="true"/>
<AsyncLogger name="org.apereo.cas.web.flow" level="${sys:cas.log.level}" includeLocation="true"/>
<AsyncLogger name="org.apereo.spring" level="${sys:cas.log.level}" includeLocation="true"/>
<Logger name="org.apereo.cas" level="${sys:cas.log.level}" />
<Logger name="org.apereo.cas.services" level="${sys:cas.log.level}" />
<Logger name="org.apereo.spring" level="${sys:cas.log.level}" />
<Logger name="org.apereo.services.persondir" level="${sys:cas.log.level}" />
<Logger name="org.apereo.cas.web.flow" level="${sys:cas.log.level}" />
<Logger name="org.apereo.cas.web.CasWebApplication" level="${sys:cas.log.level}"/>
<AsyncLogger name="org.apache" level="warn" />
<AsyncLogger name="org.apache.http" level="error" />
<AsyncLogger name="org.springframework.boot" level="${sys:spring.boot.log.level" includeLocation="true"/>
<AsyncLogger name="org.springframework.boot.context.embedded" level="info" includeLocation="true" />
<AsyncLogger name="org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration"
level="${sys:spring.security.log.level}" includeLocation="true" />
<AsyncLogger name="org.springframework.boot.autoconfigure.security" level="${sys:spring.security.log.level}" includeLocation="true"/>
<AsyncLogger name="org.springframework.boot.devtools" level="off" includeLocation="true"/>
<AsyncLogger name="org.springframework" level="warn" includeLocation="true" />
<AsyncLogger name="org.springframework.webflow" level="${sys:spring.webflow.log.level}" includeLocation="true"/>
<AsyncLogger name="org.springframework.aop" level="warn" includeLocation="true" />
<AsyncLogger name="org.springframework.web" level="warn" includeLocation="true"/>
<AsyncLogger name="org.springframework.session" level="warn" includeLocation="true"/>
<AsyncLogger name="org.springframework.scheduling" level="info" includeLocation="true"/>
<AsyncLogger name="org.springframework.cloud.vault" level="warn" includeLocation="true" />
<AsyncLogger name="org.springframework.web.client" level="warn" includeLocation="true" />
<AsyncLogger name="org.springframework.security" level="${sys:spring.security.log.level}" includeLocation="true"/>
<AsyncLogger name="org.springframework.cloud" level="${sys:spring.cloud.log.level}" includeLocation="true"/>
<AsyncLogger name="org.springframework.amqp" level="error" />
<AsyncLogger name="org.springframework.integration" level="warn" includeLocation="true"/>
<AsyncLogger name="org.springframework.messaging" level="warn" includeLocation="true"/>
<AsyncLogger name="org.springframework.web" level="${sys:spring.web.log.level}" includeLocation="true"/>
<AsyncLogger name="org.springframework.orm.jpa" level="warn" includeLocation="true"/>
<AsyncLogger name="org.springframework.scheduling" level="warn" includeLocation="true"/>
<AsyncLogger name="org.springframework.context.annotation" level="off" includeLocation="true"/>
<AsyncLogger name="org.springframework.web.socket" level="warn" includeLocation="true"/>
<AsyncLogger name="org.thymeleaf" level="warn" includeLocation="true"/>
<AsyncLogger name="org.pac4j" level="${sys:pac4j.log.level}" includeLocation="true"/>
<AsyncLogger name="org.opensaml" level="${sys:opensaml.log.level}" includeLocation="true"/>
<AsyncLogger name="PROTOCOL_MESSAGE" level="${sys:opensaml.log.level}" includeLocation="true" />
<AsyncLogger name="net.sf.ehcache" level="warn" includeLocation="true"/>
<AsyncLogger name="com.couchbase" level="warn" includeLocation="true"/>
<AsyncLogger name="de.codecentric" level="${sys:spring.boot.admin.log.level}" includeLocation="true"/>
<AsyncLogger name="net.jradius" level="warn" includeLocation="true" />
<AsyncLogger name="org.openid4java" level="warn" includeLocation="true" />
<AsyncLogger name="org.ldaptive" level="${sys:ldap.log.level}" includeLocation="true"/>
<AsyncLogger name="com.hazelcast" level="${sys:hazelcast.log.level}" includeLocation="true"/>
<!-- Log audit to all root appenders, and also to audit log (additivity is not false) -->
<AsyncLogger name="org.apereo.inspektr.audit.support" level="info" includeLocation="true" >
<AppenderRef ref="casAudit"/>
</AsyncLogger>
<!-- All Loggers inherit appenders specified here, unless additivity="false" on the Logger -->
<AsyncRoot level="warn">
<AppenderRef ref="casFile"/>
<!--
For deployment to an application server running as service,
delete the casConsole appender below
-->
<Logger name="org.apereo.inspektr.audit.support" additivity="false" level="info">
<AppenderRef ref="casConsole"/>
</AsyncRoot>
<AppenderRef ref="casFile"/>
<AppenderRef ref="casAudit"/>
</Logger>
<Logger name="org.springframework.boot" level="${sys:spring.boot.log.level}" />
<Logger name="org.springframework.boot.context.embedded" level="info" />
<Logger name="org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration" level="${sys:spring.security.log.level}" />
<Logger name="org.springframework.boot.autoconfigure.security" level="${sys:spring.security.log.level}" />
<Logger name="org.springframework.boot.devtools" level="debug" />
<Logger name="org.springframework" level="warn" />
<Logger name="org.springframework.webflow" level="${sys:spring.webflow.log.level}"/>
<Logger name="org.springframework.aop" level="warn" />
<Logger name="org.springframework.session" level="warn"/>
<Logger name="org.springframework.scheduling" level="info"/>
<Logger name="org.springframework.cloud.vault" level="warn" />
<Logger name="org.springframework.web.client" level="warn" />
<Logger name="org.springframework.security" level="${sys:spring.security.log.level}"/>
<Logger name="org.springframework.security.config.annotation.web.builders" level="error" />
<Logger name="org.springframework.cloud" level="${sys:spring.cloud.log.level}"/>
<Logger name="org.springframework.amqp" level="error" />
<Logger name="org.springframework.integration" level="warn"/>
<Logger name="org.springframework.messaging" level="warn"/>
<Logger name="org.springframework.web" level="${sys:spring.web.log.level}"/>
<Logger name="org.springframework.orm.jpa" level="warn"/>
<Logger name="org.springframework.scheduling" level="warn"/>
<Logger name="org.springframework.context.annotation" level="off"/>
<Logger name="org.springframework.web.socket" level="warn"/>
<Logger name="org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter" level="trace"/>
<Logger name="com.couchbase" level="warn" />
<Logger name="org.apache" level="error"/>
<Logger name="com.netflix" level="warn"/>
<Logger name="org.quartz" level="warn"/>
<Logger name="org.thymeleaf" level="warn"/>
<Logger name="org.pac4j" level="${sys:pac4j.log.level}"/>
<Logger name="org.opensaml" level="${sys:opensaml.log.level}"/>
<Logger name="PROTOCOL_MESSAGE" level="${sys:opensaml.log.level}" />
<Logger name="net.sf.ehcache" level="warn"/>
<Logger name="net.jradius" level="warn"/>
<Logger name="org.ldaptive" level="${sys:ldap.log.level}"/>
<Logger name="com.hazelcast" level="${sys:hazelcast.log.level}" />
<Logger name="org.jasig.spring" level="warn" />
<Logger name="org.apache.cxf" level="warn" />
<Logger name="org.apache.http" level="warn" />
<Root level="warn" includeLocation="${sys:log.include.location}">
<AppenderRef ref="casFile"/>
<AppenderRef ref="casConsole"/>
<AppenderRef ref="${sys:log.stacktraceappender}"/>
</Root>
</Loggers>
</Configuration>
@@ -1 +0,0 @@
This directory is references in the Dockerfile so it needs to be here.
Binary file not shown.
@@ -1,28 +1,70 @@
# Versions
cas.version=6.1.5
springBootVersion=2.2.0.RELEASE
# Use -jetty, -undertow to other containers
# Or blank if you want to deploy to an external container
appServer=-tomcat
executable=false
version=6.6.9
# CAS server version
cas.version=6.6.9
gradleVersion=5.6.3
tomcatVersion=9.0.30
springBootVersion=2.7.11
# The version of this overlay project
group=org.apereo.cas
artifactId=cas-overlay
sourceCompatibility=11
targetCompatibility=11
jibVersion=1.7.0
gradleFreeFairPluginVersion=8.1.0
gradleDependencyManagementPluginVersion=1.1.2
# Location of the downloaded CAS shell JAR
shellDir=build/libs
ivyVersion=2.4.0
gradleDownloadTaskVersion=3.4.3
gradleMavenPluginVersion=3.8.4
# Used to build docker images
jibVersion=3.3.2
gradleDockerPluginVersion=9.3.1
# 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:alpine-jre
# Specify the coordinates of the container image to build via jib
containerImageOrg=apereo
containerImageName=cas
baseDockerImage=eclipse-temurin:17-jdk
allowInsecureRegistries=false
dockerImagePlatform=amd64:linux
# Include launch script for executable WAR artifact
# Setting this to true allows the final web application
# to be fully executable on its own
executable=true
# Use -tomcat, -jetty, -undertow for deployment to other embedded containers
# if the overlay application supports or provides the chosen type.
# You should set this to blank if you want to deploy to an external container.
# and want to set up, download and manage the container (i.e. Apache Tomcat) yourself.
appServer=-tomcat
# Settings to generate keystore
# used by the build to assist with creating
# self-signed certificates for https endpoints
certDir=/etc/cas
serverKeystore=thekeystore
exportedServerCert=cas.crt
storeType=PKCS12
# Location of the downloaded CAS Shell JAR
shellDir=build/libs
ivyVersion=2.5.0
gradleDownloadTaskVersion=4.1.1
tomcatVersion=10.1.11
# Include private repository
# override these in user properties or pass in values from env on command line
privateRepoUrl=
privateRepoUsername=
# Gradle build settings
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xms1024m -Xmx4048m -XX:TieredStopAtLevel=1
org.gradle.unsafe.configuration-cache=false
org.gradle.unsafe.configuration-cache-problems=warn
@@ -1,52 +0,0 @@
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 = [casServerVersion]
*/
}
container {
useCurrentTimestamp = true
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"
}
@@ -1,15 +1,93 @@
apply plugin: "org.springframework.boot"
apply plugin: "java"
bootRun.enabled = false
bootRun.onlyIf { return false }
tasks.remove(tasks['bootRun'])
springBoot {
mainClassName = "org.apereo.cas.web.CasWebApplication"
sourceSets {
bootRunSources {
resources {
srcDirs new File("//etc/cas/templates/"), new File("${project.getProjectDir()}/src/main/resources/")
}
}
}
bootWar {
configurations {
bootRunConfig {
extendsFrom compileClasspath
exclude(group: "org.springframework.boot", module: "spring-boot-starter-logging")
exclude(group: "ch.qos.logback", module: "logback-core")
exclude(group: "ch.qos.logback", module: "logback-classic")
}
}
dependencies {
bootRunConfig "org.apereo.cas:cas-server-core"
bootRunConfig "org.apereo.cas:cas-server-core-logging"
bootRunConfig "org.apereo.cas:cas-server-core-web"
bootRunConfig "org.apereo.cas:cas-server-core-webflow"
bootRunConfig "org.apereo.cas:cas-server-core-cookie"
bootRunConfig "org.apereo.cas:cas-server-core-logout"
bootRunConfig "org.apereo.cas:cas-server-core-authentication"
bootRunConfig "org.apereo.cas:cas-server-core-validation"
bootRunConfig "org.apereo.cas:cas-server-core-audit"
bootRunConfig "org.apereo.cas:cas-server-core-tickets"
bootRunConfig "org.apereo.cas:cas-server-core-services"
bootRunConfig "org.apereo.cas:cas-server-core-util"
bootRunConfig "org.apereo.cas:cas-server-support-webconfig"
bootRunConfig "org.apereo.cas:cas-server-support-thymeleaf"
bootRunConfig "org.apereo.cas:cas-server-support-validation"
bootRunConfig "org.apereo.cas:cas-server-support-person-directory"
bootRunConfig "org.apereo.cas:cas-server-webapp-resources"
bootRunConfig "org.apereo.cas:cas-server-webapp-init"
bootRunConfig "org.apereo.cas:cas-server-webapp-tomcat"
bootRunConfig "org.apereo.cas:cas-server-webapp-init-tomcat"
bootRunConfig "org.springframework.cloud:spring-cloud-starter-bootstrap"
bootRunConfig "org.springframework.boot:spring-boot-devtools"
}
bootRun {
classpath = configurations.bootRunConfig + sourceSets.main.compileClasspath + sourceSets.main.runtimeClasspath
sourceResources sourceSets.bootRunSources
doFirst {
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("-Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n")
jvmArgs = list
def appArgList = []
args = appArgList
}
springBoot {
buildInfo()
mainClass = "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"
@@ -17,8 +95,44 @@ bootWar {
} else {
logger.info "WAR artifact is not marked as an executable"
}
archiveName "${casWebApplicationBinaryName}"
baseName "cas"
excludeDevtools = true
archiveFileName = "cas.war"
archiveBaseName = "cas"
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}:${project.'cas.version'}@war"
provided = false
excludes = ["WEB-INF/lib/servlet-api-2*.jar"]
/*
excludes = ["WEB-INF/lib/somejar-1.0*"]
enableCompilation = true
includes = ["*.xyz"]
targetPath = "sub-path/bar"
skip = false
*/
}
}
}
}
bootBuildInfo.mustRunAfter(compileJava)
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+171 -115
View File
File diff suppressed because it is too large Load Diff
+15 -23
View File
@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,10 +25,14 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
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"
@@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,38 +65,26 @@ 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%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 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
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
@@ -0,0 +1,9 @@
lombok.log.fieldName = LOGGER
lombok.log.fieldIsStatic=true
lombok.toString.doNotUseGetters=true
lombok.equalsAndHashCode.doNotUseGetters=true
lombok.addLombokGeneratedAnnotation = true
config.stopBubbling=true
@@ -1 +1 @@
rootProject.name='cas'
rootProject.name = 'cas'

Some files were not shown because too many files have changed in this diff Show More