Skip to content

Commit

Permalink
Merge branch 'master' of github.com:apereo/cas
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Apr 27, 2024
2 parents d35bda8 + 6d5dd18 commit c2cf0df
Show file tree
Hide file tree
Showing 592 changed files with 12,114 additions and 2,753 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
JDK_CURRENT: 21
JDK_LATEST: 21
JDK_DISTRIBUTION: "corretto"
JDK_DISTRIBUTION: "oracle"

##########################################################################

Expand Down Expand Up @@ -52,7 +52,6 @@ jobs:
##########################################################################

build:
if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'Bot')) }}
needs: [initialize]
continue-on-error: false
strategy:
Expand Down Expand Up @@ -82,7 +81,6 @@ jobs:
##########################################################################

build-latest-jdk:
if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'Bot')) }}
runs-on: ubuntu-latest
needs: [initialize]
continue-on-error: false
Expand All @@ -103,7 +101,6 @@ jobs:
##########################################################################

build-graalvm:
if: ${{ (github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'Bot')) }}
runs-on: ubuntu-latest
needs: [initialize]
continue-on-error: false
Expand All @@ -112,7 +109,7 @@ jobs:
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: ${{ env.JDK_CURRENT }}
java-version: ${{ env.JDK_LATEST }}
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'gradle'
set-java-home: 'true'
Expand All @@ -127,5 +124,5 @@ jobs:
- name: Initialize
run: find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; && ./ci/init-build.sh
- name: Build with Gradle
timeout-minutes: 90
timeout-minutes: 20
run: chmod +x ./ci/tests/native/build.sh && ./ci/tests/native/build.sh
22 changes: 16 additions & 6 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ env:
TERM: xterm-256color
JDK_CURRENT: 21
JDK_DISTRIBUTION: "corretto"
NODE_CURRENT: '21.6.2'
MAX_ATTEMPTS: 2
NODE_CURRENT: '21.7.3'
MAX_ATTEMPTS: 3
RETRY_MINUTES: 8
SCENARIO_REGEX: ".*"

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *'
push:
branches:
- master
Expand All @@ -57,7 +59,7 @@ concurrency:

jobs:
trigger-ci:
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'CI')) && !contains(github.event.pull_request.labels.*.name, 'Renovate') && !contains(github.event.head_commit.message, 'trigger dependency update') && !contains(github.event.head_commit.message, 'documentation update') }}
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'CI')) && !contains(github.event.pull_request.labels.*.name, 'Renovate') && !contains(github.event.head_commit.message, 'trigger dependency update') && !contains(github.event.head_commit.message, 'documentation update') }}
runs-on: ubuntu-latest
steps:
- name: Trigger CI
Expand All @@ -82,7 +84,7 @@ jobs:
puppeteer-scenarios:
needs: [initialize]
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 10
outputs:
scenarios255: ${{ steps.get-scenarios255.outputs.scenarios255 }}
scenarios511: ${{ steps.get-scenarios511.outputs.scenarios511 }}
Expand All @@ -96,11 +98,19 @@ jobs:
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- id: print-scenarios
run: ./gradlew --build-cache --configure-on-demand --no-daemon -q puppeteerScenarios | jq
- name: Print Scenarios
uses: nick-fields/retry@v3
with:
max_attempts: ${{ env.MAX_ATTEMPTS }}
retry_on: error
timeout_minutes: ${{ env.RETRY_MINUTES }}
shell: bash
command: ./gradlew --build-cache --configure-on-demand --no-daemon -q puppeteerScenarios | jq
- id: get-scenarios255
name: Get Scenarios 0-255
run: echo "scenarios255=$(./gradlew --build-cache --configure-on-demand --no-daemon -q puppeteerScenarios -PpuppeteerScenariosFrom=0 -PpuppeteerScenariosTo=255)" >> $GITHUB_OUTPUT
- id: get-scenarios511
name: Get Scenarios 255-511
run: echo "scenarios511=$(./gradlew --build-cache --configure-on-demand --no-daemon -q puppeteerScenarios -PpuppeteerScenariosFrom=255 -PpuppeteerScenariosTo=511)" >> $GITHUB_OUTPUT

##########################################################################
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/native-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ env:
AZURE_AD_DOMAIN: ${{ secrets.AZURE_AD_DOMAIN }}
AZURE_MAPS_SUBSCRIPTION_ID: ${{ secrets.AZURE_MAPS_SUBSCRIPTION_ID }}
AZURE_MAPS_CLIENT_ID: ${{ secrets.AZURE_MAPS_CLIENT_ID }}
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
TERM: xterm-256color
JDK_CURRENT: 21
JDK_DISTRIBUTION: "corretto"
Expand Down
80 changes: 47 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ on:
concurrency:
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'apereo/cas' }}

##########################################################################

jobs:
Expand All @@ -56,10 +56,11 @@ jobs:
run: echo "CI Triggered"
##########################################################################
initialize:
needs: [trigger-ci]
needs: [ trigger-ci ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
Expand All @@ -70,10 +71,10 @@ jobs:
- name: Initialize
run: ls ./ci && find ./ci -type f -name "*.sh" -exec chmod +x "{}" \; && ./ci/init-build.sh

##########################################################################
##########################################################################

testcategories:
needs: [initialize]
needs: [ initialize ]
runs-on: ubuntu-latest
outputs:
categories: ${{ steps.get-categories.outputs.categories }}
Expand All @@ -90,15 +91,15 @@ jobs:
run: ./gradlew --build-cache --configure-on-demand --no-daemon -q testCategories
- id: get-categories
run: echo "categories=$(./gradlew --build-cache --configure-on-demand --no-daemon -q testCategories)" >> $GITHUB_OUTPUT
##########################################################################
##########################################################################

tests:
needs: [testcategories]
needs: [ testcategories ]
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ ubuntu-latest ]
category: ${{fromJSON(needs.testcategories.outputs.categories)}}
runs-on: ${{ matrix.os }}
name: ${{ matrix.category }}
Expand All @@ -117,8 +118,8 @@ jobs:
- name: Configure Environment
if: github.event_name == 'schedule'
run: |
echo "Running on schedule..."
export PTS_ENABLED=false
echo "Running on schedule with PTS disabled..."
echo "PTS_ENABLED=false" >> $GITHUB_ENV
- name: Run Tests
uses: nick-fields/retry@v3
with:
Expand All @@ -130,6 +131,20 @@ jobs:
command: |
./testcas.sh --no-watch --category ${{ matrix.category }}
[[ $? -eq 0 ]] && ./testcas.sh --no-watch --with-coverage
- name: Check Coverage Report
run: |
ls build/reports/jacoco/jacocoRootReport
xml_files=$(find build/reports -type f -name "*.xml")
if [ -z "$xml_files" ]; then
echo "No coverage XML files found"
exit 1
fi
echo ${xml_files}
- name: Upload to SonarCloud
run: |
./gradlew sonar --build-cache --configure-on-demand --no-daemon -DskipAot=true --parallel \
-x javadoc -DskipNestedConfigMetadataGen=true -Dverbose=true \
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
- name: "Upload to Codecov"
uses: "codecov/codecov-action@v4"
continue-on-error: true
Expand All @@ -139,55 +154,54 @@ jobs:
files: ./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml
flags: ${{ matrix.category }}
name: ${{ matrix.category }}
verbose: false
verbose: true
fail_ci_if_error: false
- name: "Upload Coverage Report"
- name: Upload Coverage Report
uses: "actions/upload-artifact@v4"
with:
name: "cas-tests-${{ matrix.category }}.coverage"
path: "./build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"

##########################################################################
##########################################################################

upload_coverage:
coverage:
runs-on: ubuntu-latest
needs: [tests]
needs: [ tests ]
steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JDK_CURRENT }}
distribution: ${{ env.JDK_DISTRIBUTION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: "Download coverage files"
- name: Download coverage files
uses: "actions/download-artifact@v4"
with:
path: "reports"
- name: "Collect Files for SonarCloud"
- name: Collect Coverage Files
run: |
find $PWD -type f -name 'jacocoRootReport.xml'
export files=''
for file in $(find $PWD -type f -name 'jacocoRootReport.xml'); do export files="$file,${files}"; done
export files="${files%?}"
echo $files
echo "SONAR_COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
- name: Upload Coverage to SonarCloud
if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.SONARCLOUD_TOKEN != null }}
run: ./gradlew --build-cache --configure-on-demand --no-daemon --parallel sonarqube -x javadoc -Dsonar.login="${SONARCLOUD_TOKEN}" -DskipNestedConfigMetadataGen=true -Dverbose=true -Dsonar.coverage.jacoco.xmlReportPaths="${SONAR_COVERAGE_REPORTS}"
- name: "Collect Files for Codacy"
run: |
find $PWD -type f -name 'jacocoRootReport.xml'
export files=''
for file in $(find . -type f -name 'jacocoRootReport.xml'); do export files="$file,${files}"; done
export files="${files%?}"
echo $files
echo "CODACY_COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
echo "COVERAGE_REPORTS=${files}" >> $GITHUB_ENV
# - name: Upload to SonarCloud
# run: ./gradlew --build-cache --configure-on-demand --no-daemon -DskipAot=true --parallel sonar -x javadoc -DskipNestedConfigMetadataGen=true -Dverbose=true -Dsonar.coverage.jacoco.xmlReportPaths="${COVERAGE_REPORTS}"
- name: Upload Coverage to Codacy
if: ${{ !contains(github.head_ref, 'renovate') && github.event_name == 'push' && env.CODACY_PROJECT_TOKEN != null }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ env.CODACY_COVERAGE_REPORTS }}

coverage-reports: ${{ env.COVERAGE_REPORTS }}
- name: Upload to Codecov
uses: codecov/codecov-action@v4
if: ${{ env.CODECOV_TOKEN != null }}
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: false
files: ${{ env.COVERAGE_REPORTS }}
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## Introduction

Welcome to the home of the [Central Authentication Service project](https://www.apereo.org/projects/cas), more commonly referred to as CAS. CAS is an
Welcome to the home of the [Central Authentication Service project][apereocas], more commonly referred to as CAS. CAS is an
enterprise multilingual single sign-on solution for the web and attempts to be a comprehensive platform for your authentication and authorization needs.

CAS is an open and well-documented authentication protocol. The primary implementation of the protocol is an open-source Java server
Expand Down Expand Up @@ -75,8 +75,8 @@ The following features are supported by the CAS project:
* Password management and password policy enforcement.
* Deployment options using Apache Tomcat, Jetty, Undertow, packaged and running as Docker containers.

The foundations of CAS are built upon: [Spring Boot](https://projects.spring.io/spring-boot) and
[Spring Cloud](https://projects.spring.io/spring-cloud/).
The foundations of CAS are built upon: [Spring Boot][springboot] and
[Spring Cloud][springcloud].

## Development [![Revved up by Develocity](https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A)][devlocity] [![codecov](https://codecov.io/gh/apereo/cas/branch/master/graph/badge.svg?style=for-the-badge)][cascodecov]

Expand Down Expand Up @@ -110,3 +110,6 @@ If you (or your employer) benefit from this project, please consider becoming a
[casbuildprocess]: https://apereo.github.io/cas/development/developer/Build-Process.html
[githubcontributors]: https://github.com/apereo/cas/graphs/contributors
[casjavadocs]: https://www.javadoc.io/doc/org.apereo.cas/cas-server-core
[apereocas]: https://www.apereo.org/projects/cas
[springboot]: https://projects.spring.io/spring-boot/
[springcloud]: https://projects.spring.io/spring-cloud/
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
@Target(ElementType.METHOD)
public @interface Audit {

/**
* Identifier for this particular application in the audit trail logs. This attribute should only be used
* to override the basic application code when you want to differentiate a section of the code.
* @return the application code or an empty String if none is set.
*/
String applicationCode() default StringUtils.EMPTY;

/**
* The action to write to the log when we audit this method. Value must be defined.
* @return the action to write to the logs.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.apereo.inspektr.common.spi;

import java.time.Clock;
import java.time.LocalDateTime;
import java.util.function.Supplier;

/**
* This is {@link AuditActionDateProvider}.
*
* @author Misagh Moayyed
* @since 7.1.0
*/
public interface AuditActionDateProvider extends Supplier<LocalDateTime> {

/**
* Utc audit action date provider.
*
* @return the audit action date provider
*/
static AuditActionDateProvider utc() {
return () -> LocalDateTime.now(Clock.systemUTC());
}

/**
* System audit action date provider.
*
* @return the audit action date provider
*/
@SuppressWarnings("JavaTimeDefaultTimeZone")
static AuditActionDateProvider system() {
return () -> LocalDateTime.now(Clock.systemDefaultZone());
}
}
Loading

0 comments on commit c2cf0df

Please sign in to comment.