mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-23 07:55:07 +00:00
Merge branch 'main' into audit2
This commit is contained in:
commit
eb82ca46e3
@ -41,7 +41,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ jobs:
|
|||||||
STIRLING_PDF_DESKTOP_UI: false
|
STIRLING_PDF_DESKTOP_UI: false
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3.11.0
|
||||||
|
|
||||||
- name: Get version number
|
- name: Get version number
|
||||||
id: versionNumber
|
id: versionNumber
|
||||||
|
2
.github/workflows/PR-Demo-cleanup.yml
vendored
2
.github/workflows/PR-Demo-cleanup.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
2
.github/workflows/auto-labeler.yml
vendored
2
.github/workflows/auto-labeler.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ jobs:
|
|||||||
distribution: "adopt"
|
distribution: "adopt"
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3.11.0
|
||||||
|
|
||||||
- name: Install Docker Compose
|
- name: Install Docker Compose
|
||||||
run: |
|
run: |
|
||||||
|
2
.github/workflows/check_properties.yml
vendored
2
.github/workflows/check_properties.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
pull-requests: write # Allow writing to pull requests
|
pull-requests: write # Allow writing to pull requests
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
2
.github/workflows/dependency-review.yml
vendored
2
.github/workflows/dependency-review.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
4
.github/workflows/licenses-update.yml
vendored
4
.github/workflows/licenses-update.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
|||||||
repository-projects: write # Required for enabling automerge
|
repository-projects: write # Required for enabling automerge
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ jobs:
|
|||||||
distribution: "adopt"
|
distribution: "adopt"
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
- name: Check licenses for compatibility
|
- name: Check licenses for compatibility
|
||||||
run: ./gradlew clean checkLicense
|
run: ./gradlew clean checkLicense
|
||||||
|
2
.github/workflows/manage-label.yml
vendored
2
.github/workflows/manage-label.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
18
.github/workflows/multiOSReleases.yml
vendored
18
.github/workflows/multiOSReleases.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
versionMac: ${{ steps.versionNumberMac.outputs.versionNumberMac }}
|
versionMac: ${{ steps.versionNumberMac.outputs.versionNumberMac }}
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
file_suffix: ""
|
file_suffix: ""
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ jobs:
|
|||||||
java-version: "21"
|
java-version: "21"
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
|
|
||||||
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
- uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
with:
|
with:
|
||||||
gradle-version: 8.14
|
gradle-version: 8.14
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ jobs:
|
|||||||
file_suffix: ""
|
file_suffix: ""
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ jobs:
|
|||||||
java-version: "21"
|
java-version: "21"
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
|
|
||||||
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
- uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
with:
|
with:
|
||||||
gradle-version: 8.14
|
gradle-version: 8.14
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ jobs:
|
|||||||
- name: Display structure of downloaded files
|
- name: Display structure of downloaded files
|
||||||
run: ls -R
|
run: ls -R
|
||||||
- name: Upload binaries, attestations and signatures to Release and create GitHub Release
|
- name: Upload binaries, attestations and signatures to Release and create GitHub Release
|
||||||
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
|
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
|
||||||
with:
|
with:
|
||||||
tag_name: v${{ needs.read_versions.outputs.version }}
|
tag_name: v${{ needs.read_versions.outputs.version }}
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
2
.github/workflows/pre_commit.yml
vendored
2
.github/workflows/pre_commit.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
6
.github/workflows/push-docker.yml
vendored
6
.github/workflows/push-docker.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ jobs:
|
|||||||
java-version: "17"
|
java-version: "17"
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
|
|
||||||
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
- uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
with:
|
with:
|
||||||
gradle-version: 8.14
|
gradle-version: 8.14
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3.11.0
|
||||||
|
|
||||||
- name: Get version number
|
- name: Get version number
|
||||||
id: versionNumber
|
id: versionNumber
|
||||||
|
10
.github/workflows/releaseArtifacts.yml
vendored
10
.github/workflows/releaseArtifacts.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
version: ${{ steps.versionNumber.outputs.versionNumber }}
|
version: ${{ steps.versionNumber.outputs.versionNumber }}
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ jobs:
|
|||||||
java-version: "17"
|
java-version: "17"
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
|
|
||||||
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
- uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
with:
|
with:
|
||||||
gradle-version: 8.14
|
gradle-version: 8.14
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ jobs:
|
|||||||
file_suffix: ""
|
file_suffix: ""
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ jobs:
|
|||||||
file_suffix: ""
|
file_suffix: ""
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ jobs:
|
|||||||
name: signed${{ matrix.file_suffix }}
|
name: signed${{ matrix.file_suffix }}
|
||||||
|
|
||||||
- name: Upload binaries, attestations and signatures to Release and create GitHub Release
|
- name: Upload binaries, attestations and signatures to Release and create GitHub Release
|
||||||
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
|
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
|
||||||
with:
|
with:
|
||||||
tag_name: v${{ needs.build.outputs.version }}
|
tag_name: v${{ needs.build.outputs.version }}
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
4
.github/workflows/scorecards.yml
vendored
4
.github/workflows/scorecards.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -74,6 +74,6 @@ jobs:
|
|||||||
|
|
||||||
# Upload the results to GitHub's code scanning dashboard.
|
# Upload the results to GitHub's code scanning dashboard.
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
4
.github/workflows/sonarqube.yml
vendored
4
.github/workflows/sonarqube.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
- name: Build and analyze with Gradle
|
- name: Build and analyze with Gradle
|
||||||
env:
|
env:
|
||||||
|
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
4
.github/workflows/swagger.yml
vendored
4
.github/workflows/swagger.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ jobs:
|
|||||||
java-version: "17"
|
java-version: "17"
|
||||||
distribution: "temurin"
|
distribution: "temurin"
|
||||||
|
|
||||||
- uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
|
- uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
|
||||||
|
|
||||||
- name: Generate Swagger documentation
|
- name: Generate Swagger documentation
|
||||||
run: ./gradlew generateOpenApiDocs
|
run: ./gradlew generateOpenApiDocs
|
||||||
|
2
.github/workflows/sync_files.yml
vendored
2
.github/workflows/sync_files.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
8
.github/workflows/testdriver.yml
vendored
8
.github/workflows/testdriver.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ jobs:
|
|||||||
DISABLE_ADDITIONAL_FEATURES: true
|
DISABLE_ADDITIONAL_FEATURES: true
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
uses: docker/setup-buildx-action@18ce135bb5112fa8ce4ed6c17ab05699d7f3a5e0 # v3.11.0
|
||||||
|
|
||||||
- name: Get version number
|
- name: Get version number
|
||||||
id: versionNumber
|
id: versionNumber
|
||||||
@ -105,7 +105,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden Runner
|
- name: Harden Runner
|
||||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
10
README.md
10
README.md
@ -131,10 +131,10 @@ Stirling-PDF currently supports 40 languages!
|
|||||||
| German (Deutsch) (de_DE) |  |
|
| German (Deutsch) (de_DE) |  |
|
||||||
| Greek (Ελληνικά) (el_GR) |  |
|
| Greek (Ελληνικά) (el_GR) |  |
|
||||||
| Hindi (हिंदी) (hi_IN) |  |
|
| Hindi (हिंदी) (hi_IN) |  |
|
||||||
| Hungarian (Magyar) (hu_HU) |  |
|
| Hungarian (Magyar) (hu_HU) |  |
|
||||||
| Indonesian (Bahasa Indonesia) (id_ID) |  |
|
| Indonesian (Bahasa Indonesia) (id_ID) |  |
|
||||||
| Irish (Gaeilge) (ga_IE) |  |
|
| Irish (Gaeilge) (ga_IE) |  |
|
||||||
| Italian (Italiano) (it_IT) |  |
|
| Italian (Italiano) (it_IT) |  |
|
||||||
| Japanese (日本語) (ja_JP) |  |
|
| Japanese (日本語) (ja_JP) |  |
|
||||||
| Korean (한국어) (ko_KR) |  |
|
| Korean (한국어) (ko_KR) |  |
|
||||||
| Norwegian (Norsk) (no_NB) |  |
|
| Norwegian (Norsk) (no_NB) |  |
|
||||||
@ -147,11 +147,11 @@ Stirling-PDF currently supports 40 languages!
|
|||||||
| Serbian Latin alphabet (Srpski) (sr_LATN_RS) |  |
|
| Serbian Latin alphabet (Srpski) (sr_LATN_RS) |  |
|
||||||
| Simplified Chinese (简体中文) (zh_CN) |  |
|
| Simplified Chinese (简体中文) (zh_CN) |  |
|
||||||
| Slovakian (Slovensky) (sk_SK) |  |
|
| Slovakian (Slovensky) (sk_SK) |  |
|
||||||
| Slovenian (Slovenščina) (sl_SI) |  |
|
| Slovenian (Slovenščina) (sl_SI) |  |
|
||||||
| Spanish (Español) (es_ES) |  |
|
| Spanish (Español) (es_ES) |  |
|
||||||
| Swedish (Svenska) (sv_SE) |  |
|
| Swedish (Svenska) (sv_SE) |  |
|
||||||
| Thai (ไทย) (th_TH) |  |
|
| Thai (ไทย) (th_TH) |  |
|
||||||
| Tibetan (བོད་ཡིག་) (bo_CN) |  |
|
| Tibetan (བོད་ཡིག་) (bo_CN) |  |
|
||||||
| Traditional Chinese (繁體中文) (zh_TW) |  |
|
| Traditional Chinese (繁體中文) (zh_TW) |  |
|
||||||
| Turkish (Türkçe) (tr_TR) |  |
|
| Turkish (Türkçe) (tr_TR) |  |
|
||||||
| Ukrainian (Українська) (uk_UA) |  |
|
| Ukrainian (Українська) (uk_UA) |  |
|
||||||
|
@ -124,10 +124,18 @@
|
|||||||
"moduleName": ".*",
|
"moduleName": ".*",
|
||||||
"moduleLicense": "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0"
|
"moduleLicense": "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": ".*",
|
||||||
|
"moduleLicense": "Eclipse Public License 1.0"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": ".*",
|
"moduleName": ".*",
|
||||||
"moduleLicense": "Eclipse Public License - v 1.0"
|
"moduleLicense": "Eclipse Public License - v 1.0"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"moduleName": ".*",
|
||||||
|
"moduleLicense": "Eclipse Public License v2.0"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"moduleName": ".*",
|
"moduleName": ".*",
|
||||||
"moduleLicense": "Eclipse Public License v. 2.0"
|
"moduleLicense": "Eclipse Public License v. 2.0"
|
||||||
|
@ -23,10 +23,11 @@ ext {
|
|||||||
pdfboxVersion = "3.0.5"
|
pdfboxVersion = "3.0.5"
|
||||||
imageioVersion = "3.12.0"
|
imageioVersion = "3.12.0"
|
||||||
lombokVersion = "1.18.38"
|
lombokVersion = "1.18.38"
|
||||||
bouncycastleVersion = "1.80"
|
bouncycastleVersion = "1.81"
|
||||||
springSecuritySamlVersion = "6.5.0"
|
springSecuritySamlVersion = "6.5.1"
|
||||||
openSamlVersion = "4.3.2"
|
openSamlVersion = "4.3.2"
|
||||||
commonmarkVersion = "0.24.0"
|
commonmarkVersion = "0.24.0"
|
||||||
|
googleJavaFormatVersion = "1.27.0"
|
||||||
tempJrePath = null
|
tempJrePath = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +120,7 @@ subprojects {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||||
implementation 'io.github.pixee:java-security-toolkit:1.2.1'
|
implementation 'io.github.pixee:java-security-toolkit:1.2.2'
|
||||||
|
|
||||||
//tmp for security bumps
|
//tmp for security bumps
|
||||||
implementation 'ch.qos.logback:logback-core:1.5.18'
|
implementation 'ch.qos.logback:logback-core:1.5.18'
|
||||||
@ -475,7 +476,7 @@ spotless {
|
|||||||
target project(':proprietary').sourceSets.main.allJava
|
target project(':proprietary').sourceSets.main.allJava
|
||||||
target project(':stirling-pdf').sourceSets.main.allJava
|
target project(':stirling-pdf').sourceSets.main.allJava
|
||||||
|
|
||||||
googleJavaFormat("1.27.0").aosp().reorderImports(false)
|
googleJavaFormat(googleJavaFormatVersion).aosp().reorderImports(false)
|
||||||
|
|
||||||
importOrder("java", "javax", "org", "com", "net", "io", "jakarta", "lombok", "me", "stirling")
|
importOrder("java", "javax", "org", "com", "net", "io", "jakarta", "lombok", "me", "stirling")
|
||||||
toggleOffOn()
|
toggleOffOn()
|
||||||
|
@ -2,7 +2,12 @@
|
|||||||
bootRun {
|
bootRun {
|
||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
|
spotless {
|
||||||
|
java {
|
||||||
|
target sourceSets.main.allJava
|
||||||
|
googleJavaFormat(googleJavaFormatVersion).aosp()
|
||||||
|
}
|
||||||
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
api 'org.springframework.boot:spring-boot-starter-web'
|
api 'org.springframework.boot:spring-boot-starter-web'
|
||||||
api 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
api 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
@ -15,6 +20,6 @@ dependencies {
|
|||||||
api "org.apache.pdfbox:pdfbox:$pdfboxVersion"
|
api "org.apache.pdfbox:pdfbox:$pdfboxVersion"
|
||||||
api 'jakarta.servlet:jakarta.servlet-api:6.1.0'
|
api 'jakarta.servlet:jakarta.servlet-api:6.1.0'
|
||||||
api 'org.snakeyaml:snakeyaml-engine:2.9'
|
api 'org.snakeyaml:snakeyaml-engine:2.9'
|
||||||
api "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8"
|
api "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.9"
|
||||||
api 'jakarta.mail:jakarta.mail-api:2.1.3'
|
api 'jakarta.mail:jakarta.mail-api:2.1.3'
|
||||||
}
|
}
|
@ -4,10 +4,8 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import org.apache.pdfbox.io.RandomAccessReadBufferedFile;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.pdfbox.io.RandomAccessReadBufferedFile;
|
||||||
|
|
||||||
/** A custom RandomAccessRead implementation that deletes the file when closed */
|
/** A custom RandomAccessRead implementation that deletes the file when closed */
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -248,17 +248,16 @@ public class AppConfig {
|
|||||||
return applicationProperties.getSystem().getDatasource();
|
return applicationProperties.getSystem().getDatasource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean(name = "runningProOrHigher")
|
@Bean(name = "runningProOrHigher")
|
||||||
@Profile("default")
|
@Profile("default")
|
||||||
public boolean runningProOrHigher() {
|
public boolean runningProOrHigher() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "runningEE")
|
@Bean(name = "runningEE")
|
||||||
@Profile("default")
|
@Profile("default")
|
||||||
public boolean runningEnterprise() {
|
public boolean runningEnterprise() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "GoogleDriveEnabled")
|
@Bean(name = "GoogleDriveEnabled")
|
||||||
@ -273,10 +272,9 @@ public class AppConfig {
|
|||||||
return "NORMAL";
|
return "NORMAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean(name = "disablePixel")
|
@Bean(name = "disablePixel")
|
||||||
public boolean disablePixel() {
|
public boolean disablePixel() {
|
||||||
return Boolean.parseBoolean(env.getProperty("DISABLE_PIXEL", "false"));
|
return Boolean.parseBoolean(env.getProperty("DISABLE_PIXEL", "false"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "machineType")
|
@Bean(name = "machineType")
|
||||||
|
@ -10,9 +10,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import stirling.software.common.util.YamlHelper;
|
import stirling.software.common.util.YamlHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,16 +3,13 @@ package stirling.software.common.configuration;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.thymeleaf.IEngineConfiguration;
|
import org.thymeleaf.IEngineConfiguration;
|
||||||
import org.thymeleaf.templateresolver.AbstractConfigurableTemplateResolver;
|
import org.thymeleaf.templateresolver.AbstractConfigurableTemplateResolver;
|
||||||
import org.thymeleaf.templateresource.FileTemplateResource;
|
import org.thymeleaf.templateresource.FileTemplateResource;
|
||||||
import org.thymeleaf.templateresource.ITemplateResource;
|
import org.thymeleaf.templateresource.ITemplateResource;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.InputStreamTemplateResource;
|
import stirling.software.common.model.InputStreamTemplateResource;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -2,7 +2,6 @@ package stirling.software.common.configuration;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package stirling.software.common.configuration;
|
package stirling.software.common.configuration;
|
||||||
|
|
||||||
|
import com.posthog.java.PostHog;
|
||||||
|
import jakarta.annotation.PreDestroy;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import com.posthog.java.PostHog;
|
|
||||||
|
|
||||||
import jakarta.annotation.PreDestroy;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class PostHogConfig {
|
public class PostHogConfig {
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package stirling.software.common.configuration;
|
package stirling.software.common.configuration;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import com.posthog.java.PostHogLogger;
|
import com.posthog.java.PostHogLogger;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
|
@ -2,13 +2,10 @@ package stirling.software.common.configuration;
|
|||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.ApplicationProperties.CustomPaths.Operations;
|
import stirling.software.common.model.ApplicationProperties.CustomPaths.Operations;
|
||||||
import stirling.software.common.model.ApplicationProperties.CustomPaths.Pipeline;
|
import stirling.software.common.model.ApplicationProperties.CustomPaths.Pipeline;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package stirling.software.common.configuration;
|
package stirling.software.common.configuration;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||||
import org.springframework.core.env.PropertiesPropertySource;
|
import org.springframework.core.env.PropertiesPropertySource;
|
||||||
import org.springframework.core.env.PropertySource;
|
import org.springframework.core.env.PropertySource;
|
||||||
|
@ -12,7 +12,11 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
@ -24,13 +28,6 @@ import org.springframework.core.io.FileSystemResource;
|
|||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.EncodedResource;
|
import org.springframework.core.io.support.EncodedResource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.configuration.InstallationPathConfig;
|
import stirling.software.common.configuration.InstallationPathConfig;
|
||||||
import stirling.software.common.configuration.YamlPropertySourceFactory;
|
import stirling.software.common.configuration.YamlPropertySourceFactory;
|
||||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||||
|
@ -5,7 +5,6 @@ import java.nio.file.Paths;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
import org.thymeleaf.templateresource.ITemplateResource;
|
import org.thymeleaf.templateresource.ITemplateResource;
|
||||||
|
|
||||||
public class InputStreamTemplateResource implements ITemplateResource {
|
public class InputStreamTemplateResource implements ITemplateResource {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package stirling.software.common.model;
|
package stirling.software.common.model;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package stirling.software.common.model.api;
|
package stirling.software.common.model.api;
|
||||||
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package stirling.software.common.model.api;
|
package stirling.software.common.model.api;
|
||||||
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package stirling.software.common.model.api.converters;
|
package stirling.software.common.model.api.converters;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import stirling.software.common.model.api.PDFFile;
|
import stirling.software.common.model.api.PDFFile;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package stirling.software.common.model.api.security;
|
package stirling.software.common.model.api.security;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package stirling.software.common.model.enumeration;
|
|||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@ package stirling.software.common.model.oauth2;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -2,9 +2,7 @@ package stirling.software.common.model.oauth2;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -2,9 +2,7 @@ package stirling.software.common.model.oauth2;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -5,10 +5,8 @@ import static stirling.software.common.model.enumeration.UsernameAttribute.EMAIL
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||||
import stirling.software.common.model.exception.UnsupportedClaimException;
|
import stirling.software.common.model.exception.UnsupportedClaimException;
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.pdfbox.Loader;
|
import org.apache.pdfbox.Loader;
|
||||||
import org.apache.pdfbox.examples.util.DeletingRandomAccessFile;
|
import org.apache.pdfbox.examples.util.DeletingRandomAccessFile;
|
||||||
import org.apache.pdfbox.io.IOUtils;
|
import org.apache.pdfbox.io.IOUtils;
|
||||||
@ -18,10 +19,6 @@ import org.apache.pdfbox.io.ScratchFile;
|
|||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.api.PDFFile;
|
import stirling.software.common.model.api.PDFFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package stirling.software.common.service;
|
package stirling.software.common.service;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.PdfMetadata;
|
import stirling.software.common.model.PdfMetadata;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.common.service;
|
package stirling.software.common.service;
|
||||||
|
|
||||||
|
import com.posthog.java.PostHog;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.management.GarbageCollectorMXBean;
|
import java.lang.management.GarbageCollectorMXBean;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
@ -16,15 +17,11 @@ import java.util.HashMap;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.posthog.java.PostHog;
|
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -3,7 +3,6 @@ package stirling.software.common.util;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
||||||
|
|
||||||
public class CheckProgramInstall {
|
public class CheckProgramInstall {
|
||||||
|
@ -19,7 +19,10 @@ import java.util.Map;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.experimental.UtilityClass;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.pdfbox.cos.COSDictionary;
|
import org.apache.pdfbox.cos.COSDictionary;
|
||||||
import org.apache.pdfbox.cos.COSName;
|
import org.apache.pdfbox.cos.COSName;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
@ -35,11 +38,6 @@ import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
|
|||||||
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
|
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import stirling.software.common.model.api.converters.EmlToPdfRequest;
|
import stirling.software.common.model.api.converters.EmlToPdfRequest;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -49,7 +47,8 @@ public class EmlToPdf {
|
|||||||
private static final class StyleConstants {
|
private static final class StyleConstants {
|
||||||
// Font and layout constants
|
// Font and layout constants
|
||||||
static final int DEFAULT_FONT_SIZE = 12;
|
static final int DEFAULT_FONT_SIZE = 12;
|
||||||
static final String DEFAULT_FONT_FAMILY = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif";
|
static final String DEFAULT_FONT_FAMILY =
|
||||||
|
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif";
|
||||||
static final float DEFAULT_LINE_HEIGHT = 1.4f;
|
static final float DEFAULT_LINE_HEIGHT = 1.4f;
|
||||||
static final String DEFAULT_ZOOM = "1.0";
|
static final String DEFAULT_ZOOM = "1.0";
|
||||||
|
|
||||||
@ -76,7 +75,8 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class MimeConstants {
|
private static final class MimeConstants {
|
||||||
static final Pattern MIME_ENCODED_PATTERN = Pattern.compile("=\\?([^?]+)\\?([BbQq])\\?([^?]*)\\?=");
|
static final Pattern MIME_ENCODED_PATTERN =
|
||||||
|
Pattern.compile("=\\?([^?]+)\\?([BbQq])\\?([^?]*)\\?=");
|
||||||
static final String PAPERCLIP_EMOJI = "\uD83D\uDCCE"; // 📎
|
static final String PAPERCLIP_EMOJI = "\uD83D\uDCCE"; // 📎
|
||||||
static final String ATTACHMENT_ICON_PLACEHOLDER = "icon";
|
static final String ATTACHMENT_ICON_PLACEHOLDER = "icon";
|
||||||
|
|
||||||
@ -113,7 +113,8 @@ public class EmlToPdf {
|
|||||||
return jakartaMailAvailable;
|
return jakartaMailAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String convertEmlToHtml(byte[] emlBytes, EmlToPdfRequest request) throws IOException {
|
public static String convertEmlToHtml(byte[] emlBytes, EmlToPdfRequest request)
|
||||||
|
throws IOException {
|
||||||
validateEmlInput(emlBytes);
|
validateEmlInput(emlBytes);
|
||||||
|
|
||||||
if (isJakartaMailAvailable()) {
|
if (isJakartaMailAvailable()) {
|
||||||
@ -147,11 +148,14 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert HTML to PDF
|
// Convert HTML to PDF
|
||||||
byte[] pdfBytes = convertHtmlToPdf(weasyprintPath, request, htmlContent, disableSanitize);
|
byte[] pdfBytes =
|
||||||
|
convertHtmlToPdf(weasyprintPath, request, htmlContent, disableSanitize);
|
||||||
|
|
||||||
// Attach files if available and requested
|
// Attach files if available and requested
|
||||||
if (shouldAttachFiles(emailContent, request)) {
|
if (shouldAttachFiles(emailContent, request)) {
|
||||||
pdfBytes = attachFilesToPdf(pdfBytes, emailContent.getAttachments(), pdfDocumentFactory);
|
pdfBytes =
|
||||||
|
attachFilesToPdf(
|
||||||
|
pdfBytes, emailContent.getAttachments(), pdfDocumentFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pdfBytes;
|
return pdfBytes;
|
||||||
@ -177,16 +181,20 @@ public class EmlToPdf {
|
|||||||
|
|
||||||
private static boolean shouldAttachFiles(EmailContent emailContent, EmlToPdfRequest request) {
|
private static boolean shouldAttachFiles(EmailContent emailContent, EmlToPdfRequest request) {
|
||||||
return emailContent != null
|
return emailContent != null
|
||||||
&& request != null
|
&& request != null
|
||||||
&& request.isIncludeAttachments()
|
&& request.isIncludeAttachments()
|
||||||
&& !emailContent.getAttachments().isEmpty();
|
&& !emailContent.getAttachments().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] convertHtmlToPdf(String weasyprintPath, EmlToPdfRequest request,
|
private static byte[] convertHtmlToPdf(
|
||||||
String htmlContent, boolean disableSanitize)
|
String weasyprintPath,
|
||||||
|
EmlToPdfRequest request,
|
||||||
|
String htmlContent,
|
||||||
|
boolean disableSanitize)
|
||||||
throws IOException, InterruptedException {
|
throws IOException, InterruptedException {
|
||||||
|
|
||||||
stirling.software.common.model.api.converters.HTMLToPdfRequest htmlRequest = createHtmlRequest(request);
|
stirling.software.common.model.api.converters.HTMLToPdfRequest htmlRequest =
|
||||||
|
createHtmlRequest(request);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return FileToPdf.convertHtmlToPdf(
|
return FileToPdf.convertHtmlToPdf(
|
||||||
@ -218,8 +226,7 @@ public class EmlToPdf {
|
|||||||
return "attachment_" + filename.hashCode() + "_" + System.nanoTime();
|
return "attachment_" + filename.hashCode() + "_" + System.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertEmlToHtmlBasic(
|
private static String convertEmlToHtmlBasic(byte[] emlBytes, EmlToPdfRequest request) {
|
||||||
byte[] emlBytes, EmlToPdfRequest request) {
|
|
||||||
if (emlBytes == null || emlBytes.length == 0) {
|
if (emlBytes == null || emlBytes.length == 0) {
|
||||||
throw new IllegalArgumentException("EML file is empty or null");
|
throw new IllegalArgumentException("EML file is empty or null");
|
||||||
}
|
}
|
||||||
@ -335,7 +342,6 @@ public class EmlToPdf {
|
|||||||
Object message =
|
Object message =
|
||||||
mimeMessageConstructor.newInstance(session, new ByteArrayInputStream(emlBytes));
|
mimeMessageConstructor.newInstance(session, new ByteArrayInputStream(emlBytes));
|
||||||
|
|
||||||
|
|
||||||
return extractEmailContentAdvanced(message, request);
|
return extractEmailContentAdvanced(message, request);
|
||||||
|
|
||||||
} catch (ReflectiveOperationException e) {
|
} catch (ReflectiveOperationException e) {
|
||||||
@ -346,8 +352,7 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertEmlToHtmlAdvanced(
|
private static String convertEmlToHtmlAdvanced(byte[] emlBytes, EmlToPdfRequest request) {
|
||||||
byte[] emlBytes, EmlToPdfRequest request) {
|
|
||||||
EmailContent content = extractEmailContentAdvanced(emlBytes, request);
|
EmailContent content = extractEmailContentAdvanced(emlBytes, request);
|
||||||
return generateEnhancedEmailHtml(content, request);
|
return generateEnhancedEmailHtml(content, request);
|
||||||
}
|
}
|
||||||
@ -479,8 +484,12 @@ public class EmlToPdf {
|
|||||||
// Create attachment info with paperclip emoji before filename
|
// Create attachment info with paperclip emoji before filename
|
||||||
attachmentInfo
|
attachmentInfo
|
||||||
.append("<div class=\"attachment-item\">")
|
.append("<div class=\"attachment-item\">")
|
||||||
.append("<span class=\"attachment-icon\">").append(MimeConstants.ATTACHMENT_ICON_PLACEHOLDER).append("</span> ")
|
.append("<span class=\"attachment-icon\">")
|
||||||
.append("<span class=\"attachment-name\">").append(escapeHtml(filename)).append("</span>");
|
.append(MimeConstants.ATTACHMENT_ICON_PLACEHOLDER)
|
||||||
|
.append("</span> ")
|
||||||
|
.append("<span class=\"attachment-name\">")
|
||||||
|
.append(escapeHtml(filename))
|
||||||
|
.append("</span>");
|
||||||
|
|
||||||
// Add content type and encoding info
|
// Add content type and encoding info
|
||||||
if (!contentType.isEmpty() || !encoding.isEmpty()) {
|
if (!contentType.isEmpty() || !encoding.isEmpty()) {
|
||||||
@ -503,17 +512,20 @@ public class EmlToPdf {
|
|||||||
String content = new String(emlBytes, 0, checkLength, StandardCharsets.UTF_8);
|
String content = new String(emlBytes, 0, checkLength, StandardCharsets.UTF_8);
|
||||||
String lowerContent = content.toLowerCase();
|
String lowerContent = content.toLowerCase();
|
||||||
|
|
||||||
boolean hasFrom = lowerContent.contains("from:") || lowerContent.contains("return-path:");
|
boolean hasFrom =
|
||||||
|
lowerContent.contains("from:") || lowerContent.contains("return-path:");
|
||||||
boolean hasSubject = lowerContent.contains("subject:");
|
boolean hasSubject = lowerContent.contains("subject:");
|
||||||
boolean hasMessageId = lowerContent.contains("message-id:");
|
boolean hasMessageId = lowerContent.contains("message-id:");
|
||||||
boolean hasDate = lowerContent.contains("date:");
|
boolean hasDate = lowerContent.contains("date:");
|
||||||
boolean hasTo = lowerContent.contains("to:")
|
boolean hasTo =
|
||||||
|| lowerContent.contains("cc:")
|
lowerContent.contains("to:")
|
||||||
|| lowerContent.contains("bcc:");
|
|| lowerContent.contains("cc:")
|
||||||
boolean hasMimeStructure = lowerContent.contains("multipart/")
|
|| lowerContent.contains("bcc:");
|
||||||
|| lowerContent.contains("text/plain")
|
boolean hasMimeStructure =
|
||||||
|| lowerContent.contains("text/html")
|
lowerContent.contains("multipart/")
|
||||||
|| lowerContent.contains("boundary=");
|
|| lowerContent.contains("text/plain")
|
||||||
|
|| lowerContent.contains("text/html")
|
||||||
|
|| lowerContent.contains("boundary=");
|
||||||
|
|
||||||
int headerCount = 0;
|
int headerCount = 0;
|
||||||
if (hasFrom) headerCount++;
|
if (hasFrom) headerCount++;
|
||||||
@ -684,17 +696,19 @@ public class EmlToPdf {
|
|||||||
html.append(" font-size: ").append(fontSize - 1).append("px;\n");
|
html.append(" font-size: ").append(fontSize - 1).append("px;\n");
|
||||||
html.append("}\n\n");
|
html.append("}\n\n");
|
||||||
|
|
||||||
|
|
||||||
html.append(".email-body {\n");
|
html.append(".email-body {\n");
|
||||||
html.append(" word-wrap: break-word;\n");
|
html.append(" word-wrap: break-word;\n");
|
||||||
html.append("}\n\n");
|
html.append("}\n\n");
|
||||||
|
|
||||||
|
|
||||||
html.append(".attachment-section {\n");
|
html.append(".attachment-section {\n");
|
||||||
html.append(" margin-top: 15px;\n");
|
html.append(" margin-top: 15px;\n");
|
||||||
html.append(" padding: 10px;\n");
|
html.append(" padding: 10px;\n");
|
||||||
html.append(" background-color: ").append(StyleConstants.ATTACHMENT_BACKGROUND_COLOR).append(";\n");
|
html.append(" background-color: ")
|
||||||
html.append(" border: 1px solid ").append(StyleConstants.ATTACHMENT_BORDER_COLOR).append(";\n");
|
.append(StyleConstants.ATTACHMENT_BACKGROUND_COLOR)
|
||||||
|
.append(";\n");
|
||||||
|
html.append(" border: 1px solid ")
|
||||||
|
.append(StyleConstants.ATTACHMENT_BORDER_COLOR)
|
||||||
|
.append(";\n");
|
||||||
html.append(" border-radius: 3px;\n");
|
html.append(" border-radius: 3px;\n");
|
||||||
html.append("}\n\n");
|
html.append("}\n\n");
|
||||||
html.append(".attachment-section h3 {\n");
|
html.append(".attachment-section h3 {\n");
|
||||||
@ -746,7 +760,6 @@ public class EmlToPdf {
|
|||||||
html.append(" margin-left: 8px;\n");
|
html.append(" margin-left: 8px;\n");
|
||||||
html.append("}\n\n");
|
html.append("}\n\n");
|
||||||
|
|
||||||
|
|
||||||
// Basic image styling: ensure images are responsive but not overly constrained.
|
// Basic image styling: ensure images are responsive but not overly constrained.
|
||||||
html.append("img {\n");
|
html.append("img {\n");
|
||||||
html.append(" max-width: 100%;\n"); // Make images responsive to container width
|
html.append(" max-width: 100%;\n"); // Make images responsive to container width
|
||||||
@ -801,7 +814,9 @@ public class EmlToPdf {
|
|||||||
java.lang.reflect.Method getAllRecipients = messageClass.getMethod("getAllRecipients");
|
java.lang.reflect.Method getAllRecipients = messageClass.getMethod("getAllRecipients");
|
||||||
Object[] recipients = (Object[]) getAllRecipients.invoke(message);
|
Object[] recipients = (Object[]) getAllRecipients.invoke(message);
|
||||||
content.setTo(
|
content.setTo(
|
||||||
recipients != null && recipients.length > 0 ? safeMimeDecode(recipients[0].toString()) : "");
|
recipients != null && recipients.length > 0
|
||||||
|
? safeMimeDecode(recipients[0].toString())
|
||||||
|
: "");
|
||||||
|
|
||||||
java.lang.reflect.Method getSentDate = messageClass.getMethod("getSentDate");
|
java.lang.reflect.Method getSentDate = messageClass.getMethod("getSentDate");
|
||||||
content.setDate((Date) getSentDate.invoke(message));
|
content.setDate((Date) getSentDate.invoke(message));
|
||||||
@ -908,13 +923,14 @@ public class EmlToPdf {
|
|||||||
try {
|
try {
|
||||||
attachmentData = inputStream.readAllBytes();
|
attachmentData = inputStream.readAllBytes();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.warn("Failed to read InputStream attachment: {}", e.getMessage());
|
log.warn(
|
||||||
|
"Failed to read InputStream attachment: {}",
|
||||||
|
e.getMessage());
|
||||||
}
|
}
|
||||||
} else if (attachmentContent instanceof byte[] byteArray) {
|
} else if (attachmentContent instanceof byte[] byteArray) {
|
||||||
attachmentData = byteArray;
|
attachmentData = byteArray;
|
||||||
} else if (attachmentContent instanceof String stringContent) {
|
} else if (attachmentContent instanceof String stringContent) {
|
||||||
attachmentData =
|
attachmentData = stringContent.getBytes(StandardCharsets.UTF_8);
|
||||||
stringContent.getBytes(StandardCharsets.UTF_8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachmentData != null) {
|
if (attachmentData != null) {
|
||||||
@ -974,7 +990,9 @@ public class EmlToPdf {
|
|||||||
html.append("<div><strong>From:</strong> ")
|
html.append("<div><strong>From:</strong> ")
|
||||||
.append(escapeHtml(content.getFrom()))
|
.append(escapeHtml(content.getFrom()))
|
||||||
.append("</div>\n");
|
.append("</div>\n");
|
||||||
html.append("<div><strong>To:</strong> ").append(escapeHtml(content.getTo())).append("</div>\n");
|
html.append("<div><strong>To:</strong> ")
|
||||||
|
.append(escapeHtml(content.getTo()))
|
||||||
|
.append("</div>\n");
|
||||||
|
|
||||||
if (content.getDate() != null) {
|
if (content.getDate() != null) {
|
||||||
html.append("<div><strong>Date:</strong> ")
|
html.append("<div><strong>Date:</strong> ")
|
||||||
@ -1014,15 +1032,20 @@ public class EmlToPdf {
|
|||||||
? attachment.getEmbeddedFilename()
|
? attachment.getEmbeddedFilename()
|
||||||
: attachment.getFilename());
|
: attachment.getFilename());
|
||||||
|
|
||||||
html.append("<div class=\"attachment-item\" id=\"").append(uniqueId).append("\">")
|
html.append("<div class=\"attachment-item\" id=\"")
|
||||||
.append("<span class=\"attachment-icon\">").append(MimeConstants.PAPERCLIP_EMOJI).append("</span> ")
|
.append(uniqueId)
|
||||||
|
.append("\">")
|
||||||
|
.append("<span class=\"attachment-icon\">")
|
||||||
|
.append(MimeConstants.PAPERCLIP_EMOJI)
|
||||||
|
.append("</span> ")
|
||||||
.append("<span class=\"attachment-name\">")
|
.append("<span class=\"attachment-name\">")
|
||||||
.append(escapeHtml(safeMimeDecode(attachment.getFilename())))
|
.append(escapeHtml(safeMimeDecode(attachment.getFilename())))
|
||||||
.append("</span>");
|
.append("</span>");
|
||||||
|
|
||||||
String sizeStr = formatFileSize(attachment.getSizeBytes());
|
String sizeStr = formatFileSize(attachment.getSizeBytes());
|
||||||
html.append(" <span class=\"attachment-details\">(").append(sizeStr);
|
html.append(" <span class=\"attachment-details\">(").append(sizeStr);
|
||||||
if (attachment.getContentType() != null && !attachment.getContentType().isEmpty()) {
|
if (attachment.getContentType() != null
|
||||||
|
&& !attachment.getContentType().isEmpty()) {
|
||||||
html.append(", ").append(escapeHtml(attachment.getContentType()));
|
html.append(", ").append(escapeHtml(attachment.getContentType()));
|
||||||
}
|
}
|
||||||
html.append(")</span></div>\n");
|
html.append(")</span></div>\n");
|
||||||
@ -1031,8 +1054,7 @@ public class EmlToPdf {
|
|||||||
|
|
||||||
if (request.isIncludeAttachments()) {
|
if (request.isIncludeAttachments()) {
|
||||||
html.append("<div class=\"attachment-info-note\">\n");
|
html.append("<div class=\"attachment-info-note\">\n");
|
||||||
html.append(
|
html.append("<p><em>Attachments are embedded in the file.</em></p>\n");
|
||||||
"<p><em>Attachments are embedded in the file.</em></p>\n");
|
|
||||||
html.append("</div>\n");
|
html.append("</div>\n");
|
||||||
} else {
|
} else {
|
||||||
html.append("<div class=\"attachment-info-note\">\n");
|
html.append("<div class=\"attachment-info-note\">\n");
|
||||||
@ -1050,7 +1072,10 @@ public class EmlToPdf {
|
|||||||
return html.toString();
|
return html.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] attachFilesToPdf(byte[] pdfBytes, List<EmailAttachment> attachments, stirling.software.common.service.CustomPDFDocumentFactory pdfDocumentFactory)
|
private static byte[] attachFilesToPdf(
|
||||||
|
byte[] pdfBytes,
|
||||||
|
List<EmailAttachment> attachments,
|
||||||
|
stirling.software.common.service.CustomPDFDocumentFactory pdfDocumentFactory)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
try (PDDocument document = pdfDocumentFactory.load(pdfBytes);
|
try (PDDocument document = pdfDocumentFactory.load(pdfBytes);
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
||||||
@ -1104,7 +1129,8 @@ public class EmlToPdf {
|
|||||||
|
|
||||||
// Create embedded file
|
// Create embedded file
|
||||||
PDEmbeddedFile embeddedFile =
|
PDEmbeddedFile embeddedFile =
|
||||||
new PDEmbeddedFile(document, new ByteArrayInputStream(attachment.getData()));
|
new PDEmbeddedFile(
|
||||||
|
document, new ByteArrayInputStream(attachment.getData()));
|
||||||
embeddedFile.setSize(attachment.getData().length);
|
embeddedFile.setSize(attachment.getData().length);
|
||||||
embeddedFile.setCreationDate(new GregorianCalendar());
|
embeddedFile.setCreationDate(new GregorianCalendar());
|
||||||
if (attachment.getContentType() != null) {
|
if (attachment.getContentType() != null) {
|
||||||
@ -1150,11 +1176,13 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getUniqueFilename(String filename, List<String> embeddedFiles, Map<String, PDComplexFileSpecification> efMap) {
|
private static String getUniqueFilename(
|
||||||
|
String filename,
|
||||||
|
List<String> embeddedFiles,
|
||||||
|
Map<String, PDComplexFileSpecification> efMap) {
|
||||||
String uniqueFilename = filename;
|
String uniqueFilename = filename;
|
||||||
int counter = 1;
|
int counter = 1;
|
||||||
while (embeddedFiles.contains(uniqueFilename)
|
while (embeddedFiles.contains(uniqueFilename) || efMap.containsKey(uniqueFilename)) {
|
||||||
|| efMap.containsKey(uniqueFilename)) {
|
|
||||||
String extension = "";
|
String extension = "";
|
||||||
String baseName = filename;
|
String baseName = filename;
|
||||||
int lastDot = filename.lastIndexOf('.');
|
int lastDot = filename.lastIndexOf('.');
|
||||||
@ -1203,8 +1231,8 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addAttachmentAnnotationToPage(
|
private static void addAttachmentAnnotationToPage(
|
||||||
PDDocument document, PDPage page, EmailAttachment attachment, float x, float y)
|
PDDocument document, PDPage page, EmailAttachment attachment, float x, float y)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
PDAnnotationFileAttachment fileAnnotation = new PDAnnotationFileAttachment();
|
PDAnnotationFileAttachment fileAnnotation = new PDAnnotationFileAttachment();
|
||||||
|
|
||||||
@ -1226,11 +1254,12 @@ public class EmlToPdf {
|
|||||||
|
|
||||||
// Set invisibility flags but keep it functional
|
// Set invisibility flags but keep it functional
|
||||||
fileAnnotation.setInvisible(true);
|
fileAnnotation.setInvisible(true);
|
||||||
fileAnnotation.setHidden(false); // Must be false to remain clickable
|
fileAnnotation.setHidden(false); // Must be false to remain clickable
|
||||||
fileAnnotation.setNoView(false); // Must be false to remain clickable
|
fileAnnotation.setNoView(false); // Must be false to remain clickable
|
||||||
fileAnnotation.setPrinted(false);
|
fileAnnotation.setPrinted(false);
|
||||||
|
|
||||||
PDEmbeddedFilesNameTreeNode efTree = document.getDocumentCatalog().getNames().getEmbeddedFiles();
|
PDEmbeddedFilesNameTreeNode efTree =
|
||||||
|
document.getDocumentCatalog().getNames().getEmbeddedFiles();
|
||||||
if (efTree != null) {
|
if (efTree != null) {
|
||||||
Map<String, PDComplexFileSpecification> efMap = efTree.getNames();
|
Map<String, PDComplexFileSpecification> efMap = efTree.getNames();
|
||||||
if (efMap != null) {
|
if (efMap != null) {
|
||||||
@ -1246,24 +1275,27 @@ public class EmlToPdf {
|
|||||||
|
|
||||||
page.getAnnotations().add(fileAnnotation);
|
page.getAnnotations().add(fileAnnotation);
|
||||||
|
|
||||||
log.info("Added attachment annotation for '{}' on page {}",
|
log.info(
|
||||||
attachment.getFilename(), document.getPages().indexOf(page) + 1);
|
"Added attachment annotation for '{}' on page {}",
|
||||||
|
attachment.getFilename(),
|
||||||
|
document.getPages().indexOf(page) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static @NotNull PDRectangle getPdRectangle(PDPage page, float x, float y) {
|
private static @NotNull PDRectangle getPdRectangle(PDPage page, float x, float y) {
|
||||||
PDRectangle mediaBox = page.getMediaBox();
|
PDRectangle mediaBox = page.getMediaBox();
|
||||||
float pdfY = mediaBox.getHeight() - y;
|
float pdfY = mediaBox.getHeight() - y;
|
||||||
|
|
||||||
float iconWidth = StyleConstants.ATTACHMENT_ICON_WIDTH; // Keep original size for clickability
|
float iconWidth =
|
||||||
float iconHeight = StyleConstants.ATTACHMENT_ICON_HEIGHT; // Keep original size for clickability
|
StyleConstants.ATTACHMENT_ICON_WIDTH; // Keep original size for clickability
|
||||||
|
float iconHeight =
|
||||||
|
StyleConstants.ATTACHMENT_ICON_HEIGHT; // Keep original size for clickability
|
||||||
|
|
||||||
// Keep the full-size rectangle so it remains clickable
|
// Keep the full-size rectangle so it remains clickable
|
||||||
return new PDRectangle(
|
return new PDRectangle(
|
||||||
x + StyleConstants.ANNOTATION_X_OFFSET,
|
x + StyleConstants.ANNOTATION_X_OFFSET,
|
||||||
pdfY - iconHeight + StyleConstants.ANNOTATION_Y_OFFSET,
|
pdfY - iconHeight + StyleConstants.ANNOTATION_Y_OFFSET,
|
||||||
iconWidth,
|
iconWidth,
|
||||||
iconHeight
|
iconHeight);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String formatEmailDate(Date date) {
|
private static String formatEmailDate(Date date) {
|
||||||
@ -1293,23 +1325,27 @@ public class EmlToPdf {
|
|||||||
COSDictionary catalogDict = catalog.getCOSObject();
|
COSDictionary catalogDict = catalog.getCOSObject();
|
||||||
|
|
||||||
// Set PageMode to UseAttachments - this is the standard PDF specification approach
|
// Set PageMode to UseAttachments - this is the standard PDF specification approach
|
||||||
// PageMode values: UseNone, UseOutlines, UseThumbs, FullScreen, UseOC, UseAttachments
|
// PageMode values: UseNone, UseOutlines, UseThumbs, FullScreen, UseOC,
|
||||||
|
// UseAttachments
|
||||||
catalogDict.setName(COSName.PAGE_MODE, "UseAttachments");
|
catalogDict.setName(COSName.PAGE_MODE, "UseAttachments");
|
||||||
|
|
||||||
// Also set viewer preferences for better attachment viewing experience
|
// Also set viewer preferences for better attachment viewing experience
|
||||||
COSDictionary viewerPrefs = (COSDictionary) catalogDict.getDictionaryObject(COSName.VIEWER_PREFERENCES);
|
COSDictionary viewerPrefs =
|
||||||
|
(COSDictionary) catalogDict.getDictionaryObject(COSName.VIEWER_PREFERENCES);
|
||||||
if (viewerPrefs == null) {
|
if (viewerPrefs == null) {
|
||||||
viewerPrefs = new COSDictionary();
|
viewerPrefs = new COSDictionary();
|
||||||
catalogDict.setItem(COSName.VIEWER_PREFERENCES, viewerPrefs);
|
catalogDict.setItem(COSName.VIEWER_PREFERENCES, viewerPrefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set NonFullScreenPageMode to UseAttachments as fallback for viewers that support it
|
// Set NonFullScreenPageMode to UseAttachments as fallback for viewers that support
|
||||||
|
// it
|
||||||
viewerPrefs.setName(COSName.getPDFName("NonFullScreenPageMode"), "UseAttachments");
|
viewerPrefs.setName(COSName.getPDFName("NonFullScreenPageMode"), "UseAttachments");
|
||||||
|
|
||||||
// Additional viewer preferences that may help with attachment display
|
// Additional viewer preferences that may help with attachment display
|
||||||
viewerPrefs.setBoolean(COSName.getPDFName("DisplayDocTitle"), true);
|
viewerPrefs.setBoolean(COSName.getPDFName("DisplayDocTitle"), true);
|
||||||
|
|
||||||
log.info("Set PDF PageMode to UseAttachments to automatically show attachments pane");
|
log.info(
|
||||||
|
"Set PDF PageMode to UseAttachments to automatically show attachments pane");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Log warning but don't fail the entire operation for viewer preferences
|
// Log warning but don't fail the entire operation for viewer preferences
|
||||||
@ -1391,7 +1427,7 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case '_' -> // In RFC 2047, underscore represents space
|
case '_' -> // In RFC 2047, underscore represents space
|
||||||
result.append(' ');
|
result.append(' ');
|
||||||
default -> result.append(c);
|
default -> result.append(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1464,8 +1500,7 @@ public class EmlToPdf {
|
|||||||
private float y;
|
private float y;
|
||||||
private String character;
|
private String character;
|
||||||
|
|
||||||
public EmojiPosition() {
|
public EmojiPosition() {}
|
||||||
}
|
|
||||||
|
|
||||||
public EmojiPosition(int pageIndex, float x, float y, String character) {
|
public EmojiPosition(int pageIndex, float x, float y, String character) {
|
||||||
this.pageIndex = pageIndex;
|
this.pageIndex = pageIndex;
|
||||||
@ -1475,9 +1510,8 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EmojiPositionFinder extends org.apache.pdfbox.text.PDFTextStripper {
|
public static class EmojiPositionFinder extends org.apache.pdfbox.text.PDFTextStripper {
|
||||||
@Getter
|
@Getter private final List<EmojiPosition> positions = new ArrayList<>();
|
||||||
private final List<EmojiPosition> positions = new ArrayList<>();
|
|
||||||
private int currentPageIndex;
|
private int currentPageIndex;
|
||||||
private boolean sortByPosition;
|
private boolean sortByPosition;
|
||||||
private boolean isInAttachmentSection;
|
private boolean isInAttachmentSection;
|
||||||
@ -1503,7 +1537,9 @@ public class EmlToPdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeString(String string, List<org.apache.pdfbox.text.TextPosition> textPositions) throws IOException {
|
protected void writeString(
|
||||||
|
String string, List<org.apache.pdfbox.text.TextPosition> textPositions)
|
||||||
|
throws IOException {
|
||||||
// Check if we are entering or exiting the attachment section
|
// Check if we are entering or exiting the attachment section
|
||||||
String lowerString = string.toLowerCase();
|
String lowerString = string.toLowerCase();
|
||||||
|
|
||||||
@ -1513,10 +1549,14 @@ public class EmlToPdf {
|
|||||||
attachmentSectionFound = true;
|
attachmentSectionFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for attachment section end markers (common patterns that indicate end of attachments)
|
// Look for attachment section end markers (common patterns that indicate end of
|
||||||
if (isInAttachmentSection && (lowerString.contains("</body>") ||
|
// attachments)
|
||||||
lowerString.contains("</html>") ||
|
if (isInAttachmentSection
|
||||||
(attachmentSectionFound && lowerString.trim().isEmpty() && string.length() > 50))) {
|
&& (lowerString.contains("</body>")
|
||||||
|
|| lowerString.contains("</html>")
|
||||||
|
|| (attachmentSectionFound
|
||||||
|
&& lowerString.trim().isEmpty()
|
||||||
|
&& string.length() > 50))) {
|
||||||
isInAttachmentSection = false;
|
isInAttachmentSection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1527,17 +1567,17 @@ public class EmlToPdf {
|
|||||||
|
|
||||||
for (int i = 0; i < string.length(); i++) {
|
for (int i = 0; i < string.length(); i++) {
|
||||||
// Check if we have a complete paperclip emoji at this position
|
// Check if we have a complete paperclip emoji at this position
|
||||||
if (i < string.length() - 1 &&
|
if (i < string.length() - 1
|
||||||
string.substring(i, i + 2).equals(paperclipEmoji) &&
|
&& string.substring(i, i + 2).equals(paperclipEmoji)
|
||||||
i < textPositions.size()) {
|
&& i < textPositions.size()) {
|
||||||
|
|
||||||
org.apache.pdfbox.text.TextPosition textPosition = textPositions.get(i);
|
org.apache.pdfbox.text.TextPosition textPosition = textPositions.get(i);
|
||||||
EmojiPosition position = new EmojiPosition(
|
EmojiPosition position =
|
||||||
currentPageIndex,
|
new EmojiPosition(
|
||||||
textPosition.getXDirAdj(),
|
currentPageIndex,
|
||||||
textPosition.getYDirAdj(),
|
textPosition.getXDirAdj(),
|
||||||
paperclipEmoji
|
textPosition.getYDirAdj(),
|
||||||
);
|
paperclipEmoji);
|
||||||
positions.add(position);
|
positions.add(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1554,7 +1594,6 @@ public class EmlToPdf {
|
|||||||
return sortByPosition;
|
return sortByPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
positions.clear();
|
positions.clear();
|
||||||
currentPageIndex = 0;
|
currentPageIndex = 0;
|
||||||
|
@ -2,7 +2,6 @@ package stirling.software.common.util;
|
|||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
@ -11,13 +11,10 @@ import java.util.*;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.configuration.RuntimePathConfig;
|
import stirling.software.common.configuration.RuntimePathConfig;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import io.github.pixee.security.ZipSecurity;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.FileVisitResult;
|
import java.nio.file.FileVisitResult;
|
||||||
@ -13,9 +14,6 @@ import java.util.stream.Stream;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import io.github.pixee.security.ZipSecurity;
|
|
||||||
|
|
||||||
import stirling.software.common.model.api.converters.HTMLToPdfRequest;
|
import stirling.software.common.model.api.converters.HTMLToPdfRequest;
|
||||||
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
||||||
|
import io.github.pixee.security.HostValidator;
|
||||||
|
import io.github.pixee.security.Urls;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -14,19 +17,11 @@ import java.util.Arrays;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.ResourceLoader;
|
import org.springframework.core.io.ResourceLoader;
|
||||||
import org.springframework.core.io.support.ResourcePatternUtils;
|
import org.springframework.core.io.support.ResourcePatternUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.fathzer.soft.javaluator.DoubleEvaluator;
|
|
||||||
|
|
||||||
import io.github.pixee.security.HostValidator;
|
|
||||||
import io.github.pixee.security.Urls;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.configuration.InstallationPathConfig;
|
import stirling.software.common.configuration.InstallationPathConfig;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -1,22 +1,18 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
import java.awt.image.*;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import com.drew.imaging.ImageMetadataReader;
|
import com.drew.imaging.ImageMetadataReader;
|
||||||
import com.drew.imaging.ImageProcessingException;
|
import com.drew.imaging.ImageProcessingException;
|
||||||
import com.drew.metadata.Metadata;
|
import com.drew.metadata.Metadata;
|
||||||
import com.drew.metadata.MetadataException;
|
import com.drew.metadata.MetadataException;
|
||||||
import com.drew.metadata.exif.ExifSubIFDDirectory;
|
import com.drew.metadata.exif.ExifSubIFDDirectory;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.image.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ImageProcessingUtils {
|
public class ImageProcessingUtils {
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter;
|
||||||
|
import com.vladsch.flexmark.util.data.MutableDataSet;
|
||||||
|
import io.github.pixee.security.Filenames;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -12,22 +15,14 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter;
|
|
||||||
import com.vladsch.flexmark.util.data.MutableDataSet;
|
|
||||||
|
|
||||||
import io.github.pixee.security.Filenames;
|
|
||||||
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import io.github.pixee.security.Filenames;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.RenderedImage;
|
import java.awt.image.RenderedImage;
|
||||||
@ -10,10 +11,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
import javax.imageio.*;
|
import javax.imageio.*;
|
||||||
import javax.imageio.stream.ImageOutputStream;
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.pdfbox.cos.COSName;
|
import org.apache.pdfbox.cos.COSName;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
import org.apache.pdfbox.pdmodel.PDPage;
|
||||||
@ -30,11 +30,6 @@ import org.apache.pdfbox.rendering.ImageType;
|
|||||||
import org.apache.pdfbox.rendering.PDFRenderer;
|
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||||
import org.apache.pdfbox.text.PDFTextStripper;
|
import org.apache.pdfbox.text.PDFTextStripper;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import io.github.pixee.security.Filenames;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import io.github.pixee.security.BoundedLineReader;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -12,11 +13,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.github.pixee.security.BoundedLineReader;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
public class UrlUtils {
|
public class UrlUtils {
|
||||||
|
|
||||||
public static String getOrigin(HttpServletRequest request) {
|
public static String getOrigin(HttpServletRequest request) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package stirling.software.common.util;
|
package stirling.software.common.util;
|
||||||
|
|
||||||
|
import io.github.pixee.security.Filenames;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -12,8 +12,6 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import io.github.pixee.security.Filenames;
|
|
||||||
|
|
||||||
public class WebResponseUtils {
|
public class WebResponseUtils {
|
||||||
|
|
||||||
public static ResponseEntity<byte[]> boasToWebResponse(
|
public static ResponseEntity<byte[]> boasToWebResponse(
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.snakeyaml.engine.v2.api.Dump;
|
import org.snakeyaml.engine.v2.api.Dump;
|
||||||
import org.snakeyaml.engine.v2.api.DumpSettings;
|
import org.snakeyaml.engine.v2.api.DumpSettings;
|
||||||
import org.snakeyaml.engine.v2.api.LoadSettings;
|
import org.snakeyaml.engine.v2.api.LoadSettings;
|
||||||
@ -30,8 +30,6 @@ import org.snakeyaml.engine.v2.nodes.Tag;
|
|||||||
import org.snakeyaml.engine.v2.parser.ParserImpl;
|
import org.snakeyaml.engine.v2.parser.ParserImpl;
|
||||||
import org.snakeyaml.engine.v2.scanner.StreamReader;
|
import org.snakeyaml.engine.v2.scanner.StreamReader;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class YamlHelper {
|
public class YamlHelper {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.pdfbox.Loader;
|
import org.apache.pdfbox.Loader;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
import org.apache.pdfbox.pdmodel.PDPage;
|
||||||
@ -21,9 +21,6 @@ import org.apache.pdfbox.pdmodel.font.Standard14Fonts;
|
|||||||
import org.apache.pdfbox.text.TextPosition;
|
import org.apache.pdfbox.text.TextPosition;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
import org.springframework.core.io.InputStreamResource;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.api.misc.HighContrastColorCombination;
|
import stirling.software.common.model.api.misc.HighContrastColorCombination;
|
||||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||||
|
|
||||||
|
@ -7,9 +7,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import org.apache.pdfbox.Loader;
|
import org.apache.pdfbox.Loader;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
import org.apache.pdfbox.pdmodel.PDPage;
|
||||||
@ -18,7 +16,6 @@ import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
|
|||||||
import org.apache.pdfbox.rendering.PDFRenderer;
|
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
import org.springframework.core.io.InputStreamResource;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||||
|
|
||||||
public class InvertFullColorStrategy extends ReplaceAndInvertColorStrategy {
|
public class InvertFullColorStrategy extends ReplaceAndInvertColorStrategy {
|
||||||
|
@ -3,7 +3,6 @@ package stirling.software.common.util.misc;
|
|||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDPage;
|
import org.apache.pdfbox.pdmodel.PDPage;
|
||||||
import org.apache.pdfbox.text.PDFTextStripperByArea;
|
import org.apache.pdfbox.text.PDFTextStripperByArea;
|
||||||
import org.apache.pdfbox.text.TextPosition;
|
import org.apache.pdfbox.text.TextPosition;
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package stirling.software.common.util.misc;
|
package stirling.software.common.util.misc;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.springframework.core.io.InputStreamResource;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.core.io.InputStreamResource;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import stirling.software.common.model.api.PDFFile;
|
import stirling.software.common.model.api.PDFFile;
|
||||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||||
|
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package stirling.software.common.util.propertyeditor;
|
package stirling.software.common.util.propertyeditor;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import stirling.software.common.model.api.security.RedactionArea;
|
import stirling.software.common.model.api.security.RedactionArea;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package stirling.software.common.util.propertyeditor;
|
package stirling.software.common.util.propertyeditor;
|
||||||
|
|
||||||
import java.beans.PropertyEditorSupport;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import java.beans.PropertyEditorSupport;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class StringToMapPropertyEditor extends PropertyEditorSupport {
|
public class StringToMapPropertyEditor extends PropertyEditorSupport {
|
||||||
|
|
||||||
|
@ -4,6 +4,12 @@ repositories {
|
|||||||
bootRun {
|
bootRun {
|
||||||
enabled = false
|
enabled = false
|
||||||
}
|
}
|
||||||
|
spotless {
|
||||||
|
java {
|
||||||
|
target sourceSets.main.allJava
|
||||||
|
googleJavaFormat(googleJavaFormatVersion).aosp()
|
||||||
|
}
|
||||||
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':common')
|
implementation project(':common')
|
||||||
|
|
||||||
@ -17,18 +23,17 @@ dependencies {
|
|||||||
api 'org.springframework.boot:spring-boot-starter-data-jpa'
|
api 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||||
api 'org.springframework.boot:spring-boot-starter-oauth2-client'
|
api 'org.springframework.boot:spring-boot-starter-oauth2-client'
|
||||||
api 'org.springframework.boot:spring-boot-starter-mail'
|
api 'org.springframework.boot:spring-boot-starter-mail'
|
||||||
api 'io.swagger.core.v3:swagger-core-jakarta:2.2.30'
|
api 'io.swagger.core.v3:swagger-core-jakarta:2.2.33'
|
||||||
api 'org.springframework.boot:spring-boot-starter-validation'
|
|
||||||
implementation 'com.bucket4j:bucket4j_jdk17-core:8.14.0'
|
implementation 'com.bucket4j:bucket4j_jdk17-core:8.14.0'
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.bucket4j/bucket4j_jdk17
|
// https://mvnrepository.com/artifact/com.bucket4j/bucket4j_jdk17
|
||||||
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
|
implementation 'org.bouncycastle:bcprov-jdk18on:1.81'
|
||||||
|
|
||||||
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.1.3.RELEASE'
|
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.1.3.RELEASE'
|
||||||
api 'io.micrometer:micrometer-registry-prometheus'
|
api 'io.micrometer:micrometer-registry-prometheus'
|
||||||
implementation 'com.unboundid.product.scim2:scim2-sdk-client:2.3.5'
|
implementation 'com.unboundid.product.scim2:scim2-sdk-client:2.3.5'
|
||||||
runtimeOnly 'com.h2database:h2:2.3.232' // Don't upgrade h2database
|
runtimeOnly 'com.h2database:h2:2.3.232' // Don't upgrade h2database
|
||||||
runtimeOnly 'org.postgresql:postgresql:42.7.5'
|
runtimeOnly 'org.postgresql:postgresql:42.7.7'
|
||||||
constraints {
|
constraints {
|
||||||
implementation "org.opensaml:opensaml-core:$openSamlVersion"
|
implementation "org.opensaml:opensaml-core:$openSamlVersion"
|
||||||
implementation "org.opensaml:opensaml-saml-api:$openSamlVersion"
|
implementation "org.opensaml:opensaml-saml-api:$openSamlVersion"
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package stirling.software.proprietary.model;
|
package stirling.software.proprietary.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import stirling.software.proprietary.security.model.User;
|
import stirling.software.proprietary.security.model.User;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package stirling.software.proprietary.model.dto;
|
package stirling.software.proprietary.model.dto;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package stirling.software.proprietary.security;
|
package stirling.software.proprietary.security;
|
||||||
|
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.authentication.DisabledException;
|
import org.springframework.security.authentication.DisabledException;
|
||||||
import org.springframework.security.authentication.InternalAuthenticationServiceException;
|
import org.springframework.security.authentication.InternalAuthenticationServiceException;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
package stirling.software.proprietary.security;
|
package stirling.software.proprietary.security;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -12,9 +11,11 @@ import jakarta.servlet.ServletException;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||||
|
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||||
import stirling.software.common.util.RequestUriUtils;
|
import stirling.software.common.util.RequestUriUtils;
|
||||||
import stirling.software.proprietary.audit.AuditEventType;
|
import stirling.software.proprietary.audit.AuditEventType;
|
||||||
import stirling.software.proprietary.audit.AuditLevel;
|
import stirling.software.proprietary.audit.AuditLevel;
|
||||||
|
@ -1,27 +1,22 @@
|
|||||||
package stirling.software.proprietary.security;
|
package stirling.software.proprietary.security;
|
||||||
|
|
||||||
|
import com.coveo.saml.SamlClient;
|
||||||
|
import com.coveo.saml.SamlException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.security.interfaces.RSAPrivateKey;
|
import java.security.interfaces.RSAPrivateKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
|
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
|
||||||
import org.springframework.security.saml2.provider.service.authentication.Saml2Authentication;
|
import org.springframework.security.saml2.provider.service.authentication.Saml2Authentication;
|
||||||
import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
|
import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
|
||||||
|
|
||||||
import com.coveo.saml.SamlClient;
|
|
||||||
import com.coveo.saml.SamlException;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.configuration.AppConfig;
|
import stirling.software.common.configuration.AppConfig;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
package stirling.software.proprietary.security;
|
package stirling.software.proprietary.security;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.enumeration.Role;
|
import stirling.software.common.model.enumeration.Role;
|
||||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package stirling.software.proprietary.security;
|
package stirling.software.proprietary.security;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import stirling.software.proprietary.security.filter.IPRateLimitingFilter;
|
import stirling.software.proprietary.security.filter.IPRateLimitingFilter;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -2,6 +2,10 @@ package stirling.software.proprietary.security.config;
|
|||||||
|
|
||||||
import static stirling.software.common.util.ProviderUtils.validateProvider;
|
import static stirling.software.common.util.ProviderUtils.validateProvider;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -10,7 +14,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -19,16 +23,6 @@ import org.springframework.security.oauth2.core.user.OAuth2User;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.ApplicationProperties.Security;
|
import stirling.software.common.model.ApplicationProperties.Security;
|
||||||
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
||||||
@ -239,7 +233,8 @@ public class AccountWebController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Also check if user is part of the Internal team
|
// Also check if user is part of the Internal team
|
||||||
if (user.getTeam() != null && user.getTeam().getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
if (user.getTeam() != null
|
||||||
|
&& user.getTeam().getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||||
shouldRemove = true;
|
shouldRemove = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,6 +331,9 @@ public class AccountWebController {
|
|||||||
case "userNotFound" -> "userNotFoundMessage";
|
case "userNotFound" -> "userNotFoundMessage";
|
||||||
case "downgradeCurrentUser" -> "downgradeCurrentUserMessage";
|
case "downgradeCurrentUser" -> "downgradeCurrentUserMessage";
|
||||||
case "disabledCurrentUser" -> "disabledCurrentUserMessage";
|
case "disabledCurrentUser" -> "disabledCurrentUserMessage";
|
||||||
|
case "cannotMoveInternalUsers" -> "team.cannotMoveInternalUsers";
|
||||||
|
case "internalTeamNotAccessible" -> "team.internalTeamNotAccessible";
|
||||||
|
case "invalidRole" -> "invalidRoleMessage";
|
||||||
default -> messageType;
|
default -> messageType;
|
||||||
};
|
};
|
||||||
model.addAttribute("changeMessage", changeMessage);
|
model.addAttribute("changeMessage", changeMessage);
|
||||||
@ -351,10 +349,16 @@ public class AccountWebController {
|
|||||||
model.addAttribute("disabledUsers", disabledUsers);
|
model.addAttribute("disabledUsers", disabledUsers);
|
||||||
|
|
||||||
// Get all teams but filter out the Internal team
|
// Get all teams but filter out the Internal team
|
||||||
List<Team> allTeams = teamRepository.findAll()
|
List<Team> allTeams =
|
||||||
.stream()
|
teamRepository.findAll().stream()
|
||||||
.filter(team -> !team.getName().equals(stirling.software.proprietary.security.service.TeamService.INTERNAL_TEAM_NAME))
|
.filter(
|
||||||
.toList();
|
team ->
|
||||||
|
!team.getName()
|
||||||
|
.equals(
|
||||||
|
stirling.software.proprietary.security
|
||||||
|
.service.TeamService
|
||||||
|
.INTERNAL_TEAM_NAME))
|
||||||
|
.toList();
|
||||||
model.addAttribute("teams", allTeams);
|
model.addAttribute("teams", allTeams);
|
||||||
|
|
||||||
model.addAttribute("maxPaidUsers", applicationProperties.getPremium().getMaxUsers());
|
model.addAttribute("maxPaidUsers", applicationProperties.getPremium().getMaxUsers());
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package stirling.software.proprietary.security.configuration;
|
package stirling.software.proprietary.security.configuration;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
@ -11,10 +12,6 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.configuration.InstallationPathConfig;
|
import stirling.software.common.configuration.InstallationPathConfig;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
package stirling.software.proprietary.security.configuration;
|
package stirling.software.proprietary.security.configuration;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.mail.javamail.JavaMailSender;
|
import org.springframework.mail.javamail.JavaMailSender;
|
||||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package stirling.software.proprietary.security.configuration;
|
package stirling.software.proprietary.security.configuration;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -27,9 +27,6 @@ import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
|
|||||||
import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler;
|
import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler;
|
||||||
import org.springframework.security.web.savedrequest.NullRequestCache;
|
import org.springframework.security.web.savedrequest.NullRequestCache;
|
||||||
import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher;
|
import org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.configuration.AppConfig;
|
import stirling.software.common.configuration.AppConfig;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.proprietary.security.CustomAuthenticationFailureHandler;
|
import stirling.software.proprietary.security.CustomAuthenticationFailureHandler;
|
||||||
|
@ -8,7 +8,6 @@ import org.springframework.context.annotation.Primary;
|
|||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.ApplicationProperties.EnterpriseEdition;
|
import stirling.software.common.model.ApplicationProperties.EnterpriseEdition;
|
||||||
import stirling.software.common.model.ApplicationProperties.Premium;
|
import stirling.software.common.model.ApplicationProperties.Premium;
|
||||||
@ -81,9 +80,9 @@ public class EEAppConfig {
|
|||||||
|
|
||||||
// Copy the license key if it's set in enterprise but not in premium
|
// Copy the license key if it's set in enterprise but not in premium
|
||||||
if (premium.getKey() == null
|
if (premium.getKey() == null
|
||||||
|| premium.getKey().equals("00000000-0000-0000-0000-000000000000")) {
|
|| "00000000-0000-0000-0000-000000000000".equals(premium.getKey())) {
|
||||||
if (enterpriseEdition.getKey() != null
|
if (enterpriseEdition.getKey() != null
|
||||||
&& !enterpriseEdition.getKey().equals("00000000-0000-0000-0000-000000000000")) {
|
&& !"00000000-0000-0000-0000-000000000000".equals(enterpriseEdition.getKey())) {
|
||||||
premium.setKey(enterpriseEdition.getKey());
|
premium.setKey(enterpriseEdition.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,20 @@
|
|||||||
package stirling.software.proprietary.security.configuration.ee;
|
package stirling.software.proprietary.security.configuration.ee;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.http.HttpClient;
|
|
||||||
import java.net.http.HttpRequest;
|
|
||||||
import java.net.http.HttpResponse;
|
|
||||||
import java.util.Base64;
|
|
||||||
|
|
||||||
import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters;
|
|
||||||
import org.bouncycastle.crypto.signers.Ed25519Signer;
|
|
||||||
import org.bouncycastle.util.encoders.Hex;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.posthog.java.shaded.org.json.JSONException;
|
import com.posthog.java.shaded.org.json.JSONException;
|
||||||
import com.posthog.java.shaded.org.json.JSONObject;
|
import com.posthog.java.shaded.org.json.JSONObject;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.util.Base64;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters;
|
||||||
|
import org.bouncycastle.crypto.signers.Ed25519Signer;
|
||||||
|
import org.bouncycastle.util.encoders.Hex;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.util.GeneralUtils;
|
import stirling.software.common.util.GeneralUtils;
|
||||||
|
|
||||||
|
@ -4,12 +4,9 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.util.GeneralUtils;
|
import stirling.software.common.util.GeneralUtils;
|
||||||
import stirling.software.proprietary.security.configuration.ee.KeygenLicenseVerifier.License;
|
import stirling.software.proprietary.security.configuration.ee.KeygenLicenseVerifier.License;
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package stirling.software.proprietary.security.controller.api;
|
package stirling.software.proprietary.security.controller.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
import org.eclipse.jetty.http.HttpStatus;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
import org.springframework.core.io.InputStreamResource;
|
||||||
@ -18,15 +23,6 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Hidden;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.proprietary.security.database.H2SQLCondition;
|
import stirling.software.proprietary.security.database.H2SQLCondition;
|
||||||
import stirling.software.proprietary.security.service.DatabaseService;
|
import stirling.software.proprietary.security.service.DatabaseService;
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package stirling.software.proprietary.security.controller.api;
|
package stirling.software.proprietary.security.controller.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.mail.MessagingException;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@ -8,16 +14,6 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
|
|
||||||
import jakarta.mail.MessagingException;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.proprietary.security.model.api.Email;
|
import stirling.software.proprietary.security.model.api.Email;
|
||||||
import stirling.software.proprietary.security.service.EmailService;
|
import stirling.software.proprietary.security.service.EmailService;
|
||||||
|
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
package stirling.software.proprietary.security.controller.api;
|
package stirling.software.proprietary.security.controller.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.view.RedirectView;
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.proprietary.model.Team;
|
import stirling.software.proprietary.model.Team;
|
||||||
import stirling.software.proprietary.security.config.PremiumEndpoint;
|
import stirling.software.proprietary.security.config.PremiumEndpoint;
|
||||||
import stirling.software.proprietary.security.database.repository.UserRepository;
|
import stirling.software.proprietary.security.database.repository.UserRepository;
|
||||||
@ -36,12 +31,12 @@ public class TeamController {
|
|||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
public RedirectView createTeam(@RequestParam("name") String name) {
|
public RedirectView createTeam(@RequestParam("name") String name) {
|
||||||
if (teamRepository.existsByNameIgnoreCase(name)) {
|
if (teamRepository.existsByNameIgnoreCase(name)) {
|
||||||
return new RedirectView("/adminSettings?messageType=teamExists");
|
return new RedirectView("/teams?messageType=teamExists");
|
||||||
}
|
}
|
||||||
Team team = new Team();
|
Team team = new Team();
|
||||||
team.setName(name);
|
team.setName(name);
|
||||||
teamRepository.save(team);
|
teamRepository.save(team);
|
||||||
return new RedirectView("/adminSettings?messageType=teamCreated");
|
return new RedirectView("/teams?messageType=teamCreated");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@ -50,21 +45,21 @@ public class TeamController {
|
|||||||
@RequestParam("teamId") Long teamId, @RequestParam("newName") String newName) {
|
@RequestParam("teamId") Long teamId, @RequestParam("newName") String newName) {
|
||||||
Optional<Team> existing = teamRepository.findById(teamId);
|
Optional<Team> existing = teamRepository.findById(teamId);
|
||||||
if (existing.isEmpty()) {
|
if (existing.isEmpty()) {
|
||||||
return new RedirectView("/adminSettings?messageType=teamNotFound");
|
return new RedirectView("/teams?messageType=teamNotFound");
|
||||||
}
|
}
|
||||||
if (teamRepository.existsByNameIgnoreCase(newName)) {
|
if (teamRepository.existsByNameIgnoreCase(newName)) {
|
||||||
return new RedirectView("/adminSettings?messageType=teamNameExists");
|
return new RedirectView("/teams?messageType=teamNameExists");
|
||||||
}
|
}
|
||||||
Team team = existing.get();
|
Team team = existing.get();
|
||||||
|
|
||||||
// Prevent renaming the Internal team
|
// Prevent renaming the Internal team
|
||||||
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||||
return new RedirectView("/adminSettings?messageType=internalTeamNotAccessible");
|
return new RedirectView("/teams?messageType=internalTeamNotAccessible");
|
||||||
}
|
}
|
||||||
|
|
||||||
team.setName(newName);
|
team.setName(newName);
|
||||||
teamRepository.save(team);
|
teamRepository.save(team);
|
||||||
return new RedirectView("/adminSettings?messageType=teamRenamed");
|
return new RedirectView("/teams?messageType=teamRenamed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@ -73,35 +68,36 @@ public class TeamController {
|
|||||||
public RedirectView deleteTeam(@RequestParam("teamId") Long teamId) {
|
public RedirectView deleteTeam(@RequestParam("teamId") Long teamId) {
|
||||||
Optional<Team> teamOpt = teamRepository.findById(teamId);
|
Optional<Team> teamOpt = teamRepository.findById(teamId);
|
||||||
if (teamOpt.isEmpty()) {
|
if (teamOpt.isEmpty()) {
|
||||||
return new RedirectView("/adminSettings?messageType=teamNotFound");
|
return new RedirectView("/teams?messageType=teamNotFound");
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = teamOpt.get();
|
Team team = teamOpt.get();
|
||||||
|
|
||||||
// Prevent deleting the Internal team
|
// Prevent deleting the Internal team
|
||||||
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||||
return new RedirectView("/adminSettings?messageType=internalTeamNotAccessible");
|
return new RedirectView("/teams?messageType=internalTeamNotAccessible");
|
||||||
}
|
}
|
||||||
|
|
||||||
long memberCount = userRepository.countByTeam(team);
|
long memberCount = userRepository.countByTeam(team);
|
||||||
if (memberCount > 0) {
|
if (memberCount > 0) {
|
||||||
return new RedirectView("/adminSettings?messageType=teamHasUsers");
|
return new RedirectView("/teams?messageType=teamHasUsers");
|
||||||
}
|
}
|
||||||
|
|
||||||
teamRepository.delete(team);
|
teamRepository.delete(team);
|
||||||
return new RedirectView("/adminSettings?messageType=teamDeleted");
|
return new RedirectView("/teams?messageType=teamDeleted");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
@PostMapping("/addUser")
|
@PostMapping("/addUser")
|
||||||
@Transactional
|
@Transactional
|
||||||
public RedirectView addUserToTeam(
|
public RedirectView addUserToTeam(
|
||||||
@RequestParam("teamId") Long teamId,
|
@RequestParam("teamId") Long teamId, @RequestParam("userId") Long userId) {
|
||||||
@RequestParam("userId") Long userId) {
|
|
||||||
|
|
||||||
// Find the team
|
// Find the team
|
||||||
Team team = teamRepository.findById(teamId)
|
Team team =
|
||||||
.orElseThrow(() -> new RuntimeException("Team not found"));
|
teamRepository
|
||||||
|
.findById(teamId)
|
||||||
|
.orElseThrow(() -> new RuntimeException("Team not found"));
|
||||||
|
|
||||||
// Prevent adding users to the Internal team
|
// Prevent adding users to the Internal team
|
||||||
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||||
@ -109,11 +105,14 @@ public class TeamController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the user
|
// Find the user
|
||||||
User user = userRepository.findById(userId)
|
User user =
|
||||||
.orElseThrow(() -> new RuntimeException("User not found"));
|
userRepository
|
||||||
|
.findById(userId)
|
||||||
|
.orElseThrow(() -> new RuntimeException("User not found"));
|
||||||
|
|
||||||
// Check if user is in the Internal team - prevent moving them
|
// Check if user is in the Internal team - prevent moving them
|
||||||
if (user.getTeam() != null && user.getTeam().getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
if (user.getTeam() != null
|
||||||
|
&& user.getTeam().getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||||
return new RedirectView("/teams/" + teamId + "?error=cannotMoveInternalUsers");
|
return new RedirectView("/teams/" + teamId + "?error=cannotMoveInternalUsers");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package stirling.software.proprietary.security.controller.api;
|
package stirling.software.proprietary.security.controller.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.Principal;
|
import java.security.Principal;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -20,16 +25,6 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||||
import org.springframework.web.servlet.view.RedirectView;
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.enumeration.Role;
|
import stirling.software.common.model.enumeration.Role;
|
||||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||||
@ -57,6 +52,7 @@ public class UserController {
|
|||||||
private final ApplicationProperties applicationProperties;
|
private final ApplicationProperties applicationProperties;
|
||||||
private final TeamRepository teamRepository;
|
private final TeamRepository teamRepository;
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
|
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public String register(@ModelAttribute UsernameAndPass requestModel, Model model)
|
public String register(@ModelAttribute UsernameAndPass requestModel, Model model)
|
||||||
@ -250,15 +246,18 @@ public class UserController {
|
|||||||
// Use teamId if provided, otherwise use default team
|
// Use teamId if provided, otherwise use default team
|
||||||
Long effectiveTeamId = teamId;
|
Long effectiveTeamId = teamId;
|
||||||
if (effectiveTeamId == null) {
|
if (effectiveTeamId == null) {
|
||||||
Team defaultTeam = teamRepository.findByName(TeamService.DEFAULT_TEAM_NAME).orElse(null);
|
Team defaultTeam =
|
||||||
|
teamRepository.findByName(TeamService.DEFAULT_TEAM_NAME).orElse(null);
|
||||||
if (defaultTeam != null) {
|
if (defaultTeam != null) {
|
||||||
effectiveTeamId = defaultTeam.getId();
|
effectiveTeamId = defaultTeam.getId();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check if the selected team is Internal - prevent assigning to it
|
// Check if the selected team is Internal - prevent assigning to it
|
||||||
Team selectedTeam = teamRepository.findById(effectiveTeamId).orElse(null);
|
Team selectedTeam = teamRepository.findById(effectiveTeamId).orElse(null);
|
||||||
if (selectedTeam != null && TeamService.INTERNAL_TEAM_NAME.equals(selectedTeam.getName())) {
|
if (selectedTeam != null
|
||||||
return new RedirectView("/adminSettings?messageType=internalTeamNotAccessible", true);
|
&& TeamService.INTERNAL_TEAM_NAME.equals(selectedTeam.getName())) {
|
||||||
|
return new RedirectView(
|
||||||
|
"/adminSettings?messageType=internalTeamNotAccessible", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,12 +315,15 @@ public class UserController {
|
|||||||
if (team != null) {
|
if (team != null) {
|
||||||
// Prevent assigning to Internal team
|
// Prevent assigning to Internal team
|
||||||
if (TeamService.INTERNAL_TEAM_NAME.equals(team.getName())) {
|
if (TeamService.INTERNAL_TEAM_NAME.equals(team.getName())) {
|
||||||
return new RedirectView("/adminSettings?messageType=internalTeamNotAccessible", true);
|
return new RedirectView(
|
||||||
|
"/adminSettings?messageType=internalTeamNotAccessible", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent moving users from Internal team
|
// Prevent moving users from Internal team
|
||||||
if (user.getTeam() != null && TeamService.INTERNAL_TEAM_NAME.equals(user.getTeam().getName())) {
|
if (user.getTeam() != null
|
||||||
return new RedirectView("/adminSettings?messageType=cannotMoveInternalUsers", true);
|
&& TeamService.INTERNAL_TEAM_NAME.equals(user.getTeam().getName())) {
|
||||||
|
return new RedirectView(
|
||||||
|
"/adminSettings?messageType=cannotMoveInternalUsers", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
user.setTeam(team);
|
user.setTeam(team);
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
package stirling.software.proprietary.security.controller.web;
|
package stirling.software.proprietary.security.controller.web;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import stirling.software.common.model.FileInfo;
|
import stirling.software.common.model.FileInfo;
|
||||||
import stirling.software.proprietary.security.service.DatabaseService;
|
import stirling.software.proprietary.security.service.DatabaseService;
|
||||||
|
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
package stirling.software.proprietary.security.controller.web;
|
package stirling.software.proprietary.security.controller.web;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.proprietary.model.Team;
|
import stirling.software.proprietary.model.Team;
|
||||||
import stirling.software.proprietary.model.dto.TeamWithUserCountDTO;
|
import stirling.software.proprietary.model.dto.TeamWithUserCountDTO;
|
||||||
import stirling.software.proprietary.security.database.repository.SessionRepository;
|
import stirling.software.proprietary.security.database.repository.SessionRepository;
|
||||||
@ -35,14 +33,15 @@ public class TeamWebController {
|
|||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
public String listTeams(Model model) {
|
public String listTeams(HttpServletRequest request, Model model) {
|
||||||
// Get teams with user counts using a DTO projection
|
// Get teams with user counts using a DTO projection
|
||||||
List<TeamWithUserCountDTO> allTeamsWithCounts = teamRepository.findAllTeamsWithUserCount();
|
List<TeamWithUserCountDTO> allTeamsWithCounts = teamRepository.findAllTeamsWithUserCount();
|
||||||
|
|
||||||
// Filter out the Internal team
|
// Filter out the Internal team
|
||||||
List<TeamWithUserCountDTO> teamsWithCounts = allTeamsWithCounts.stream()
|
List<TeamWithUserCountDTO> teamsWithCounts =
|
||||||
.filter(team -> !team.getName().equals(TeamService.INTERNAL_TEAM_NAME))
|
allTeamsWithCounts.stream()
|
||||||
.toList();
|
.filter(team -> !team.getName().equals(TeamService.INTERNAL_TEAM_NAME))
|
||||||
|
.toList();
|
||||||
|
|
||||||
// Get the latest activity for each team
|
// Get the latest activity for each team
|
||||||
List<Object[]> teamActivities = sessionRepository.findLatestActivityByTeam();
|
List<Object[]> teamActivities = sessionRepository.findLatestActivityByTeam();
|
||||||
@ -55,6 +54,27 @@ public class TeamWebController {
|
|||||||
teamLastRequest.put(teamId, lastActivity);
|
teamLastRequest.put(teamId, lastActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String messageType = request.getParameter("messageType");
|
||||||
|
if (messageType != null) {
|
||||||
|
if ("teamCreated".equals(messageType)) {
|
||||||
|
model.addAttribute("addMessage", "teamCreated");
|
||||||
|
} else if ("teamExists".equals(messageType)) {
|
||||||
|
model.addAttribute("errorMessage", "teamExists");
|
||||||
|
} else if ("teamNotFound".equals(messageType)) {
|
||||||
|
model.addAttribute("errorMessage", "teamNotFound");
|
||||||
|
} else if ("teamNameExists".equals(messageType)) {
|
||||||
|
model.addAttribute("errorMessage", "teamNameExists");
|
||||||
|
} else if ("internalTeamNotAccessible".equals(messageType)) {
|
||||||
|
model.addAttribute("errorMessage", "team.internalTeamNotAccessible");
|
||||||
|
} else if ("teamRenamed".equals(messageType)) {
|
||||||
|
model.addAttribute("changeMessage", "teamRenamed");
|
||||||
|
} else if ("teamHasUsers".equals(messageType)) {
|
||||||
|
model.addAttribute("errorMessage", "teamHasUsers");
|
||||||
|
} else if ("teamDeleted".equals(messageType)) {
|
||||||
|
model.addAttribute("deleteMessage", "teamDeleted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add data to the model
|
// Add data to the model
|
||||||
model.addAttribute("teamsWithCounts", teamsWithCounts);
|
model.addAttribute("teamsWithCounts", teamsWithCounts);
|
||||||
model.addAttribute("teamLastRequest", teamLastRequest);
|
model.addAttribute("teamLastRequest", teamLastRequest);
|
||||||
@ -64,10 +84,13 @@ public class TeamWebController {
|
|||||||
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||||
public String viewTeamDetails(@PathVariable("id") Long id, Model model) {
|
public String viewTeamDetails(
|
||||||
|
HttpServletRequest request, @PathVariable("id") Long id, Model model) {
|
||||||
// Get the team
|
// Get the team
|
||||||
Team team = teamRepository.findById(id)
|
Team team =
|
||||||
.orElseThrow(() -> new RuntimeException("Team not found"));
|
teamRepository
|
||||||
|
.findById(id)
|
||||||
|
.orElseThrow(() -> new RuntimeException("Team not found"));
|
||||||
|
|
||||||
// Prevent access to Internal team
|
// Prevent access to Internal team
|
||||||
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
if (team.getName().equals(TeamService.INTERNAL_TEAM_NAME)) {
|
||||||
@ -80,10 +103,19 @@ public class TeamWebController {
|
|||||||
// Get all users not in this team for the Add User to Team dropdown
|
// Get all users not in this team for the Add User to Team dropdown
|
||||||
// Exclude users that are in the Internal team
|
// Exclude users that are in the Internal team
|
||||||
List<User> allUsers = userRepository.findAllWithTeam();
|
List<User> allUsers = userRepository.findAllWithTeam();
|
||||||
List<User> availableUsers = allUsers.stream()
|
List<User> availableUsers =
|
||||||
.filter(user -> (user.getTeam() == null || !user.getTeam().getId().equals(id)) &&
|
allUsers.stream()
|
||||||
(user.getTeam() == null || !user.getTeam().getName().equals(TeamService.INTERNAL_TEAM_NAME)))
|
.filter(
|
||||||
.toList();
|
user ->
|
||||||
|
(user.getTeam() == null
|
||||||
|
|| !user.getTeam().getId().equals(id))
|
||||||
|
&& (user.getTeam() == null
|
||||||
|
|| !user.getTeam()
|
||||||
|
.getName()
|
||||||
|
.equals(
|
||||||
|
TeamService
|
||||||
|
.INTERNAL_TEAM_NAME)))
|
||||||
|
.toList();
|
||||||
|
|
||||||
// Get the latest session for each user in the team
|
// Get the latest session for each user in the team
|
||||||
List<Object[]> userSessions = sessionRepository.findLatestSessionByTeamId(id);
|
List<Object[]> userSessions = sessionRepository.findLatestSessionByTeamId(id);
|
||||||
@ -96,6 +128,13 @@ public class TeamWebController {
|
|||||||
userLastRequest.put(username, lastRequest);
|
userLastRequest.put(username, lastRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String errorMessage = request.getParameter("error");
|
||||||
|
if (errorMessage != null) {
|
||||||
|
if ("cannotMoveInternalUsers".equals(errorMessage)) {
|
||||||
|
model.addAttribute("errorMessage", "team.cannotMoveInternalUsers");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
model.addAttribute("team", team);
|
model.addAttribute("team", team);
|
||||||
model.addAttribute("teamUsers", teamUsers);
|
model.addAttribute("teamUsers", teamUsers);
|
||||||
model.addAttribute("availableUsers", availableUsers);
|
model.addAttribute("availableUsers", availableUsers);
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package stirling.software.proprietary.security.database;
|
package stirling.software.proprietary.security.database;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.context.annotation.Conditional;
|
import org.springframework.context.annotation.Conditional;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||||
import stirling.software.proprietary.security.service.DatabaseServiceInterface;
|
import stirling.software.proprietary.security.service.DatabaseServiceInterface;
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package stirling.software.proprietary.security.database.repository;
|
package stirling.software.proprietary.security.database.repository;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import stirling.software.proprietary.security.model.Authority;
|
import stirling.software.proprietary.security.model.Authority;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package stirling.software.proprietary.security.database.repository;
|
package stirling.software.proprietary.security.database.repository;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
|
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;
|
||||||
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
|
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import stirling.software.proprietary.security.model.PersistentLogin;
|
import stirling.software.proprietary.security.model.PersistentLogin;
|
||||||
|
|
||||||
public class JPATokenRepositoryImpl implements PersistentTokenRepository {
|
public class JPATokenRepositoryImpl implements PersistentTokenRepository {
|
||||||
|
@ -2,7 +2,6 @@ package stirling.software.proprietary.security.database.repository;
|
|||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import stirling.software.proprietary.security.model.PersistentLogin;
|
import stirling.software.proprietary.security.model.PersistentLogin;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
package stirling.software.proprietary.security.database.repository;
|
package stirling.software.proprietary.security.database.repository;
|
||||||
|
|
||||||
|
import jakarta.transaction.Transactional;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import jakarta.transaction.Transactional;
|
|
||||||
|
|
||||||
import stirling.software.proprietary.security.model.SessionEntity;
|
import stirling.software.proprietary.security.model.SessionEntity;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -2,12 +2,10 @@ package stirling.software.proprietary.security.database.repository;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import stirling.software.proprietary.model.Team;
|
import stirling.software.proprietary.model.Team;
|
||||||
import stirling.software.proprietary.security.model.User;
|
import stirling.software.proprietary.security.model.User;
|
||||||
|
|
||||||
@ -30,7 +28,8 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
|||||||
@Query(value = "SELECT u FROM User u LEFT JOIN FETCH u.team")
|
@Query(value = "SELECT u FROM User u LEFT JOIN FETCH u.team")
|
||||||
List<User> findAllWithTeam();
|
List<User> findAllWithTeam();
|
||||||
|
|
||||||
@Query("SELECT u FROM User u JOIN FETCH u.authorities JOIN FETCH u.team WHERE u.team.id = :teamId")
|
@Query(
|
||||||
|
"SELECT u FROM User u JOIN FETCH u.authorities JOIN FETCH u.team WHERE u.team.id = :teamId")
|
||||||
List<User> findAllByTeamId(@Param("teamId") Long teamId);
|
List<User> findAllByTeamId(@Param("teamId") Long teamId);
|
||||||
|
|
||||||
long countByTeam(Team team);
|
long countByTeam(Team team);
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
package stirling.software.proprietary.security.filter;
|
package stirling.software.proprietary.security.filter;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
|
||||||
|
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class EnterpriseEndpointFilter extends OncePerRequestFilter {
|
public class EnterpriseEndpointFilter extends OncePerRequestFilter {
|
||||||
|
@ -1,24 +1,20 @@
|
|||||||
package stirling.software.proprietary.security.filter;
|
package stirling.software.proprietary.security.filter;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
|
||||||
|
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Optional;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
import stirling.software.common.util.RequestUriUtils;
|
import stirling.software.common.util.RequestUriUtils;
|
||||||
import stirling.software.proprietary.security.model.User;
|
import stirling.software.proprietary.security.model.User;
|
||||||
import stirling.software.proprietary.security.service.UserService;
|
import stirling.software.proprietary.security.service.UserService;
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
package stirling.software.proprietary.security.filter;
|
package stirling.software.proprietary.security.filter;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
import jakarta.servlet.Filter;
|
import jakarta.servlet.Filter;
|
||||||
import jakarta.servlet.FilterChain;
|
import jakarta.servlet.FilterChain;
|
||||||
import jakarta.servlet.ServletException;
|
import jakarta.servlet.ServletException;
|
||||||
import jakarta.servlet.ServletRequest;
|
import jakarta.servlet.ServletRequest;
|
||||||
import jakarta.servlet.ServletResponse;
|
import jakarta.servlet.ServletResponse;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import stirling.software.common.util.RequestUriUtils;
|
import stirling.software.common.util.RequestUriUtils;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package stirling.software.proprietary.security.filter;
|
package stirling.software.proprietary.security.filter;
|
||||||
|
|
||||||
|
import jakarta.servlet.FilterChain;
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -16,14 +20,6 @@ import org.springframework.security.core.userdetails.UserDetails;
|
|||||||
import org.springframework.security.oauth2.core.user.OAuth2User;
|
import org.springframework.security.oauth2.core.user.OAuth2User;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
import jakarta.servlet.FilterChain;
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import stirling.software.common.model.ApplicationProperties;
|
import stirling.software.common.model.ApplicationProperties;
|
||||||
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
||||||
import stirling.software.common.model.ApplicationProperties.Security.SAML2;
|
import stirling.software.common.model.ApplicationProperties.Security.SAML2;
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
package stirling.software.proprietary.security.filter;
|
package stirling.software.proprietary.security.filter;
|
||||||
|
|
||||||
|
import io.github.bucket4j.Bandwidth;
|
||||||
|
import io.github.bucket4j.Bucket;
|
||||||
|
import io.github.bucket4j.ConsumptionProbe;
|
||||||
|
import io.github.pixee.security.Newlines;
|
||||||
|
import jakarta.servlet.FilterChain;
|
||||||
|
import jakarta.servlet.ServletException;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -13,17 +20,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
|||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
import io.github.bucket4j.Bandwidth;
|
|
||||||
import io.github.bucket4j.Bucket;
|
|
||||||
import io.github.bucket4j.ConsumptionProbe;
|
|
||||||
import io.github.pixee.security.Newlines;
|
|
||||||
|
|
||||||
import jakarta.servlet.FilterChain;
|
|
||||||
import jakarta.servlet.ServletException;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import stirling.software.common.model.enumeration.Role;
|
import stirling.software.common.model.enumeration.Role;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package stirling.software.proprietary.security.model;
|
package stirling.software.proprietary.security.model;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package stirling.software.proprietary.security.model;
|
package stirling.software.proprietary.security.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
@ -10,7 +8,7 @@ import jakarta.persistence.Id;
|
|||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user