mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-23 16:05:09 +00:00
renamed module: enterprise > proprietary
updating paths (DOCKER_SECURITY_ENABLE > ADDITIONAL_FEATURES)
This commit is contained in:
parent
3aac0b883b
commit
fa90725161
14
.gitattributes
vendored
14
.gitattributes
vendored
@ -1,10 +1,10 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
# Ignore all JavaScript files in a directory
|
||||
src/main/resources/static/pdfjs/* linguist-vendored
|
||||
src/main/resources/static/pdfjs/** linguist-vendored
|
||||
src/main/resources/static/pdfjs-legacy/* linguist-vendored
|
||||
src/main/resources/static/pdfjs-legacy/** linguist-vendored
|
||||
src/main/resources/static/css/bootstrap-icons.css linguist-vendored
|
||||
src/main/resources/static/css/bootstrap.min.css linguist-vendored
|
||||
src/main/resources/static/css/fonts/* linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/pdfjs/* linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/pdfjs/** linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/pdfjs-legacy/* linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/pdfjs-legacy/** linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/css/bootstrap-icons.css linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/css/bootstrap.min.css linguist-vendored
|
||||
stirling-pdf/src/main/resources/static/css/fonts/* linguist-vendored
|
||||
|
57
.github/labeler-config.yml
vendored
57
.github/labeler-config.yml
vendored
@ -1,60 +1,45 @@
|
||||
Translation:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/main/resources/messages_*_*.properties'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/messages_*_*.properties'
|
||||
- any-glob-to-any-file: 'scripts/ignore_translation.toml'
|
||||
- any-glob-to-any-file: 'src/main/resources/templates/fragments/languages.html'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/templates/fragments/languages.html'
|
||||
|
||||
Front End:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/main/resources/templates/**/*'
|
||||
- any-glob-to-any-file: 'src/main/resources/static/**/*'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/web/**'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/UI/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/templates/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/static/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/controller/web/**'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/UI/**/*'
|
||||
|
||||
Java:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/main/java/**/*.java'
|
||||
- any-glob-to-any-file: 'common/src/main/java/**/*.java'
|
||||
- any-glob-to-any-file: 'proprietary/src/main/java/**/*.java'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/**/*.java'
|
||||
|
||||
Back End:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/config/**/*'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/**/*'
|
||||
- any-glob-to-any-file: 'src/main/resources/settings.yml.template'
|
||||
- any-glob-to-any-file: 'src/main/resources/application.properties'
|
||||
- any-glob-to-any-file: 'src/main/resources/banner.txt'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/config/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/controller/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/settings.yml.template'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/application.properties'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/resources/banner.txt'
|
||||
- any-glob-to-any-file: 'scripts/png_to_webp.py'
|
||||
- any-glob-to-any-file: 'split_photos.py'
|
||||
|
||||
Security:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/config/interfaces/DatabaseInterface.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/config/security/**/*'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/api/DatabaseController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/api/EmailController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/api/H2SQLController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/web/AccountWebController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/web/DatabaseWebController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/api/UserController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/api/Email.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/exception/BackupNotFoundException.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/exception/NoProviderFoundExceptionjava'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/provider/**/*'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/AuthenticationType.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/ApiKeyAuthenticationToken.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/AttemptCounter.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/Authority.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/PersistentLogin.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/SessionEntity.java'
|
||||
- any-glob-to-any-file: 'proprietary/src/main/java/stirling/software/proprietary/security/**/*'
|
||||
- any-glob-to-any-file: 'scripts/download-security-jar.sh'
|
||||
- any-glob-to-any-file: '.github/workflows/dependency-review.yml'
|
||||
- any-glob-to-any-file: '.github/workflows/scorecards.yml'
|
||||
|
||||
API:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/config/OpenApiConfig.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/web/MetricsController.java'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/controller/api/**/*'
|
||||
- any-glob-to-any-file: 'src/main/java/stirling/software/SPDF/model/api/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/config/OpenApiConfig.java'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/controller/web/MetricsController.java'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/controller/api/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/main/java/stirling/software/SPDF/model/api/**/*'
|
||||
- any-glob-to-any-file: 'scripts/png_to_webp.py'
|
||||
- any-glob-to-any-file: 'split_photos.py'
|
||||
- any-glob-to-any-file: '.github/workflows/swagger.yml'
|
||||
@ -88,7 +73,9 @@ Devtools:
|
||||
Test:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: 'cucumber/**/*'
|
||||
- any-glob-to-any-file: 'src/test/**/*'
|
||||
- any-glob-to-any-file: 'common/src/test/**/*'
|
||||
- any-glob-to-any-file: 'proprietary/src/test/**/*'
|
||||
- any-glob-to-any-file: 'stirling-pdf/src/test/**/*'
|
||||
- any-glob-to-any-file: 'src/testing/**/*'
|
||||
- any-glob-to-any-file: '.pre-commit-config'
|
||||
- any-glob-to-any-file: '.github/workflows/pre_commit.yml'
|
||||
|
2
.github/scripts/check_language_properties.py
vendored
2
.github/scripts/check_language_properties.py
vendored
@ -317,7 +317,7 @@ def check_for_differences(reference_file, file_list, branch, actor):
|
||||
report.append("## ❌ Overall Check Status: **_Failed_**")
|
||||
report.append("")
|
||||
report.append(
|
||||
f"@{actor} please check your translation if it conforms to the standard. Follow the format of [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties)"
|
||||
f"@{actor} please check your translation if it conforms to the standard. Follow the format of [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/messages_en_GB.properties)"
|
||||
)
|
||||
else:
|
||||
report.append("## ✅ Overall Check Status: **_Success_**")
|
||||
|
10
.github/workflows/check_properties.yml
vendored
10
.github/workflows/check_properties.yml
vendored
@ -4,7 +4,7 @@ on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened]
|
||||
paths:
|
||||
- "src/main/resources/messages_*.properties"
|
||||
- "stirling-pdf/src/main/resources/messages_*.properties"
|
||||
|
||||
permissions:
|
||||
contents: read # Allow read access to repository content
|
||||
@ -61,7 +61,7 @@ jobs:
|
||||
run: |
|
||||
echo "Fetching PR changed files..."
|
||||
echo "Getting list of changed files from PR..."
|
||||
gh pr view ${{ steps.get-pr-data.outputs.pr_number }} --json files -q ".files[].path" | grep -E '^src/main/resources/messages_[a-zA-Z_]{2}_[a-zA-Z_]{2,7}\.properties$' > changed_files.txt # Filter only matching property files
|
||||
gh pr view ${{ steps.get-pr-data.outputs.pr_number }} --json files -q ".files[].path" | grep -E '^stirling-pdf/src/main/resources/messages_[a-zA-Z_]{2}_[a-zA-Z_]{2,7}\.properties$' > changed_files.txt # Filter only matching property files
|
||||
|
||||
- name: Determine reference file test
|
||||
id: determine-file
|
||||
@ -141,12 +141,12 @@ jobs:
|
||||
|
||||
// Determine reference file
|
||||
let referenceFilePath;
|
||||
if (changedFiles.includes("src/main/resources/messages_en_GB.properties")) {
|
||||
if (changedFiles.includes("stirling-pdf/src/main/resources/messages_en_GB.properties")) {
|
||||
console.log("Using PR branch reference file.");
|
||||
const { data: fileContent } = await github.rest.repos.getContent({
|
||||
owner: prRepoOwner,
|
||||
repo: prRepoName,
|
||||
path: "src/main/resources/messages_en_GB.properties",
|
||||
path: "stirling-pdf/src/main/resources/messages_en_GB.properties",
|
||||
ref: branch,
|
||||
});
|
||||
|
||||
@ -158,7 +158,7 @@ jobs:
|
||||
const { data: fileContent } = await github.rest.repos.getContent({
|
||||
owner: repoOwner,
|
||||
repo: repoName,
|
||||
path: "src/main/resources/messages_en_GB.properties",
|
||||
path: "stirling-pdf/src/main/resources/messages_en_GB.properties",
|
||||
ref: "main",
|
||||
});
|
||||
|
||||
|
4
.github/workflows/licenses-update.yml
vendored
4
.github/workflows/licenses-update.yml
vendored
@ -57,11 +57,11 @@ jobs:
|
||||
|
||||
- name: Move and rename license file
|
||||
run: |
|
||||
mv build/reports/dependency-license/index.json src/main/resources/static/3rdPartyLicenses.json
|
||||
mv build/reports/dependency-license/index.json stirling-pdf/src/main/resources/static/3rdPartyLicenses.json
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git add src/main/resources/static/3rdPartyLicenses.json
|
||||
git add stirling-pdf/src/main/resources/static/3rdPartyLicenses.json
|
||||
git diff --staged --quiet || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
|
||||
|
||||
- name: Create Pull Request
|
||||
|
15
.github/workflows/multiOSReleases.yml
vendored
15
.github/workflows/multiOSReleases.yml
vendored
@ -48,13 +48,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
enable_security: [true, false]
|
||||
disable_security: [true, false]
|
||||
include:
|
||||
- enable_security: true
|
||||
file_suffix: "-with-login"
|
||||
- enable_security: false
|
||||
file_suffix: ""
|
||||
- disable_security: true
|
||||
file_suffix: ""
|
||||
- disable_security: false
|
||||
@ -77,7 +72,7 @@ jobs:
|
||||
with:
|
||||
gradle-version: 8.14
|
||||
|
||||
- name: Generate jar (With Security=${{ matrix.enable_security }})
|
||||
- name: Generate jar (Without Security=${{ matrix.disable_security }})
|
||||
run: ./gradlew clean createExe
|
||||
env:
|
||||
ADDITIONAL_FEATURES_OFF: ${{ matrix.disable_security }}
|
||||
@ -103,12 +98,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
enable_security: [true, false]
|
||||
disable_security: [true, false]
|
||||
include:
|
||||
- enable_security: true
|
||||
file_suffix: "with-login-"
|
||||
- enable_security: false
|
||||
- disable_security: true
|
||||
file_suffix: ""
|
||||
- disable_security: false
|
||||
file_suffix: "with-login-"
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
|
||||
|
10
.github/workflows/sync_files.yml
vendored
10
.github/workflows/sync_files.yml
vendored
@ -8,8 +8,8 @@ on:
|
||||
paths:
|
||||
- "build.gradle"
|
||||
- "README.md"
|
||||
- "src/main/resources/messages_*.properties"
|
||||
- "src/main/resources/static/3rdPartyLicenses.json"
|
||||
- "stirling-pdf/src/main/resources/messages_*.properties"
|
||||
- "stirling-pdf/src/main/resources/static/3rdPartyLicenses.json"
|
||||
- "scripts/ignore_translation.toml"
|
||||
|
||||
permissions:
|
||||
@ -41,11 +41,11 @@ jobs:
|
||||
|
||||
- name: Sync translation property files
|
||||
run: |
|
||||
python .github/scripts/check_language_properties.py --reference-file "src/main/resources/messages_en_GB.properties" --branch main
|
||||
python .github/scripts/check_language_properties.py --reference-file "stirling-pdf/src/main/resources/messages_en_GB.properties" --branch main
|
||||
|
||||
- name: Commit translation files
|
||||
run: |
|
||||
git add src/main/resources/messages_*.properties
|
||||
git add stirling-pdf/src/main/resources/messages_*.properties
|
||||
git diff --staged --quiet || git commit -m ":memo: Sync translation files" || echo "No changes detected"
|
||||
|
||||
- name: Install dependencies
|
||||
@ -101,4 +101,4 @@ jobs:
|
||||
sign-commits: true
|
||||
add-paths: |
|
||||
README.md
|
||||
src/main/resources/messages_*.properties
|
||||
stirling-pdf/src/main/resources/messages_*.properties
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -124,6 +124,9 @@ SwaggerDoc.json
|
||||
*.rar
|
||||
*.db
|
||||
/build
|
||||
/stirling-pdf/build
|
||||
/common/build
|
||||
/proprietary/build
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
@ -20,7 +20,7 @@ repos:
|
||||
- --skip="./.*,*.csv,*.json,*.ambr"
|
||||
- --quiet-level=2
|
||||
files: \.(html|css|js|py|md)$
|
||||
exclude: (.vscode|.devcontainer|src/main/resources|Dockerfile|.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js)
|
||||
exclude: (.vscode|.devcontainer|stirling-pdf/src/main/resources|Dockerfile|.*/pdfjs.*|.*/thirdParty.*|bootstrap.*|.*\.min\..*|.*diff\.js)
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.26.0
|
||||
hooks:
|
||||
|
@ -332,7 +332,7 @@ Thymeleaf is a server-side Java HTML template engine. It is used in Stirling-PDF
|
||||
|
||||
### Thymeleaf overview
|
||||
|
||||
In Stirling-PDF, Thymeleaf is used to create HTML templates that are rendered on the server side. These templates are located in the `src/main/resources/templates` directory. Thymeleaf templates use a combination of HTML and special Thymeleaf attributes to dynamically generate content.
|
||||
In Stirling-PDF, Thymeleaf is used to create HTML templates that are rendered on the server side. These templates are located in the `stirling-pdf/src/main/resources/templates` directory. Thymeleaf templates use a combination of HTML and special Thymeleaf attributes to dynamically generate content.
|
||||
|
||||
Some examples of this are:
|
||||
|
||||
@ -384,7 +384,7 @@ This would generate n entries of tr for each person in exampleData
|
||||
### Adding a New Feature to the Backend (API)
|
||||
|
||||
1. **Create a New Controller:**
|
||||
- Create a new Java class in the `src/main/java/stirling/software/SPDF/controller/api` directory.
|
||||
- Create a new Java class in the `stirling-pdf/src/main/java/stirling/software/SPDF/controller/api` directory.
|
||||
- Annotate the class with `@RestController` and `@RequestMapping` to define the API endpoint.
|
||||
- Ensure to add API documentation annotations like `@Tag(name = "General", description = "General APIs")` and `@Operation(summary = "Crops a PDF document", description = "This operation takes an input PDF file and crops it according to the given coordinates. Input:PDF Output:PDF Type:SISO")`.
|
||||
|
||||
@ -411,7 +411,7 @@ This would generate n entries of tr for each person in exampleData
|
||||
```
|
||||
|
||||
2. **Define the Service Layer:** (Not required but often useful)
|
||||
- Create a new service class in the `src/main/java/stirling/software/SPDF/service` directory.
|
||||
- Create a new service class in the `stirling-pdf/src/main/java/stirling/software/SPDF/service` directory.
|
||||
- Implement the business logic for the new feature.
|
||||
|
||||
```java
|
||||
@ -463,7 +463,7 @@ This would generate n entries of tr for each person in exampleData
|
||||
### Adding a New Feature to the Frontend (UI)
|
||||
|
||||
1. **Create a New Thymeleaf Template:**
|
||||
- Create a new HTML file in the `src/main/resources/templates` directory.
|
||||
- Create a new HTML file in the `stirling-pdf/src/main/resources/templates` directory.
|
||||
- Use Thymeleaf attributes to dynamically generate content.
|
||||
- Use `extract-page.html` as a base example for the HTML template, which is useful to ensure importing of the general layout, navbar, and footer.
|
||||
|
||||
@ -507,7 +507,7 @@ This would generate n entries of tr for each person in exampleData
|
||||
```
|
||||
|
||||
2. **Create a New Controller for the UI:**
|
||||
- Create a new Java class in the `src/main/java/stirling/software/SPDF/controller/ui` directory.
|
||||
- Create a new Java class in the `stirling-pdf/src/main/java/stirling/software/SPDF/controller/ui` directory.
|
||||
- Annotate the class with `@Controller` and `@RequestMapping` to define the UI endpoint.
|
||||
|
||||
```java
|
||||
@ -537,7 +537,7 @@ This would generate n entries of tr for each person in exampleData
|
||||
|
||||
3. **Update the Navigation Bar:**
|
||||
- Add a link to the new feature page in the navigation bar.
|
||||
- Update the `src/main/resources/templates/fragments/navbar.html` file.
|
||||
- Update the `stirling-pdf/src/main/resources/templates/fragments/navbar.html` file.
|
||||
|
||||
```html
|
||||
<li class="nav-item">
|
||||
@ -551,7 +551,7 @@ When adding a new feature or modifying existing ones in Stirling-PDF, you'll nee
|
||||
|
||||
### 1. Locate Existing Language Files
|
||||
|
||||
Find the existing `messages.properties` files in the `src/main/resources` directory. You'll see files like:
|
||||
Find the existing `messages.properties` files in the `stirling-pdf/src/main/resources` directory. You'll see files like:
|
||||
|
||||
- `messages.properties` (default, usually English)
|
||||
- `messages_en_GB.properties`
|
||||
|
@ -4,7 +4,7 @@ FROM alpine:3.22.0@sha256:8a1f59ffb675680d47db6337b49d22281a139e9d709335b492be02
|
||||
# Copy necessary files
|
||||
COPY scripts /scripts
|
||||
COPY pipeline /pipeline
|
||||
COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||
COPY stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||
#COPY src/main/resources/static/fonts/*.otf /usr/share/fonts/opentype/noto/
|
||||
COPY build/libs/*.jar app.jar
|
||||
|
||||
|
@ -26,7 +26,7 @@ FROM alpine:3.22.0@sha256:8a1f59ffb675680d47db6337b49d22281a139e9d709335b492be02
|
||||
# Copy necessary files
|
||||
COPY scripts /scripts
|
||||
COPY pipeline /pipeline
|
||||
COPY src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||
COPY stirling-pdf/src/main/resources/static/fonts/*.ttf /usr/share/fonts/opentype/noto/
|
||||
COPY --from=build /app/build/libs/*.jar app.jar
|
||||
|
||||
ARG VERSION_TAG
|
||||
|
@ -10,7 +10,7 @@ Fork Stirling-PDF and create a new branch out of `main`.
|
||||
|
||||
Then add a reference to the language in the navbar by adding a new language entry to the dropdown:
|
||||
|
||||
- Edit the file: [languages.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/templates/fragments/languages.html)
|
||||
- Edit the file: [languages.html](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/templates/fragments/languages.html)
|
||||
|
||||
|
||||
For example, to add Polish, you would add:
|
||||
@ -25,7 +25,7 @@ The `data-bs-language-code` is the code used to reference the file in the next s
|
||||
|
||||
Start by copying the existing English property file:
|
||||
|
||||
- [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/src/main/resources/messages_en_GB.properties)
|
||||
- [messages_en_GB.properties](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/stirling-pdf/src/main/resources/messages_en_GB.properties)
|
||||
|
||||
Copy and rename it to `messages_{your data-bs-language-code here}.properties`. In the Polish example, you would set the name to `messages_pl_PL.properties`.
|
||||
|
||||
|
336
build.gradle
336
build.gradle
@ -26,21 +26,136 @@ ext {
|
||||
bouncycastleVersion = "1.80"
|
||||
springSecuritySamlVersion = "6.5.0"
|
||||
openSamlVersion = "4.3.2"
|
||||
commonmarkVersion = "0.24.0"
|
||||
tempJrePath = null
|
||||
}
|
||||
|
||||
group = "stirling.software"
|
||||
version = "0.46.2"
|
||||
jar {
|
||||
enabled = false
|
||||
manifest {
|
||||
attributes "Implementation-Title": "Stirling-PDF",
|
||||
"Implementation-Version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
bootJar {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false' || System.getenv('ADDITIONAL_FEATURES_OFF') == 'true'
|
||||
|| (project.hasProperty('ADDITIONAL_FEATURES_OFF')
|
||||
&& System.getProperty('ADDITIONAL_FEATURES_OFF') == 'true')) {
|
||||
exclude 'stirling/software/proprietary/security/**'
|
||||
}
|
||||
|
||||
if (System.getenv('STIRLING_PDF_DESKTOP_UI') != 'false'
|
||||
|| (project.hasProperty('STIRLING_PDF_DESKTOP_UI')
|
||||
&& project.getProperty('STIRLING_PDF_DESKTOP_UI') != 'false')) {
|
||||
exclude 'stirling/software/SPDF/UI/impl/**'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
java {
|
||||
if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false' || System.getenv('ADDITIONAL_FEATURES_OFF') == 'true'
|
||||
|| (project.hasProperty('ADDITIONAL_FEATURES_OFF')
|
||||
&& System.getProperty('ADDITIONAL_FEATURES_OFF') == 'true')) {
|
||||
exclude 'stirling/software/proprietary/security/**'
|
||||
}
|
||||
|
||||
if (System.getenv('STIRLING_PDF_DESKTOP_UI') != 'false'
|
||||
|| (project.hasProperty('STIRLING_PDF_DESKTOP_UI')
|
||||
&& project.getProperty('STIRLING_PDF_DESKTOP_UI') != 'false')) {
|
||||
exclude 'stirling/software/SPDF/UI/impl/**'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = 'stirling.software'
|
||||
version = '0.46.2'
|
||||
|
||||
afterEvaluate {
|
||||
if (project == rootProject) return
|
||||
tasks.register('wrapper', Wrapper) {
|
||||
gradleVersion = '8.14'
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'com.diffplug.spotless'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
java {
|
||||
// 17 is lowest but we support and recommend 21
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
bootJar {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://build.shibboleth.net/maven/releases" }
|
||||
maven { url = "https://maven.pkg.github.com/jcefmaven/jcefmaven" }
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
|
||||
// Exclude vulnerable BouncyCastle version used in tableau
|
||||
exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
|
||||
exclude group: 'org.bouncycastle', module: 'bcutil-jdk15on'
|
||||
exclude group: 'org.bouncycastle', module: 'bcmail-jdk15on'
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom "org.springframework.boot:spring-boot-dependencies:$springBootVersion"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
implementation 'io.github.pixee:java-security-toolkit:1.2.1'
|
||||
|
||||
//tmp for security bumps
|
||||
implementation 'ch.qos.logback:logback-core:1.5.18'
|
||||
implementation 'ch.qos.logback:logback-classic:1.5.18'
|
||||
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
||||
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testRuntimeOnly 'org.mockito:mockito-inline:5.2.0'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
dependsOn "spotlessApply"
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs << "-parameters"
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
|
||||
licenseReport {
|
||||
@ -99,10 +214,9 @@ jpackage {
|
||||
mainJar = "Stirling-PDF-${project.version}.jar"
|
||||
appName = "Stirling PDF"
|
||||
appVersion = project.version
|
||||
// appVersion = "2005.45.1"
|
||||
vendor = "Stirling PDF Inc"
|
||||
appDescription = "Stirling PDF - Your Local PDF Editor"
|
||||
icon = "src/main/resources/static/favicon.ico"
|
||||
icon = "stirling-pdf/src/main/resources/static/favicon.ico"
|
||||
verbose = true
|
||||
// mainClass = "org.springframework.boot.loader.launch.JarLauncher"
|
||||
|
||||
@ -140,10 +254,10 @@ jpackage {
|
||||
installDir = "C:/Program Files/Stirling-PDF"
|
||||
}
|
||||
|
||||
// macOS-specific configuration
|
||||
// MacOS-specific configuration
|
||||
mac {
|
||||
appVersion = getMacVersion(project.version.toString())
|
||||
icon = "src/main/resources/static/favicon.icns"
|
||||
icon = "stirling-pdf/src/main/resources/static/favicon.icns"
|
||||
type = "dmg"
|
||||
macPackageIdentifier = "Stirling PDF"
|
||||
macPackageName = "Stirling PDF"
|
||||
@ -165,7 +279,7 @@ jpackage {
|
||||
// Linux-specific configuration
|
||||
linux {
|
||||
appVersion = project.version
|
||||
icon = "src/main/resources/static/favicon.png"
|
||||
icon = "stirling-pdf/src/main/resources/static/favicon.png"
|
||||
type = "deb" // Can also use "rpm" for Red Hat-based systems
|
||||
|
||||
// Debian package configuration
|
||||
@ -205,6 +319,11 @@ jpackage {
|
||||
licenseFile = "LICENSE"
|
||||
}
|
||||
|
||||
tasks.wrapper {
|
||||
gradleVersion = "8.14"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
tasks.register('jpackageMacX64') {
|
||||
group = 'distribution'
|
||||
description = 'Packages app for MacOS x86_64'
|
||||
@ -237,7 +356,7 @@ tasks.register('jpackageMacX64') {
|
||||
'--main-class', 'org.springframework.boot.loader.launch.JarLauncher',
|
||||
'--runtime-image', file(jrePath + "/zulu-17.jre/Contents/Home"),
|
||||
'--dest', 'build/jpackage/x86_64',
|
||||
'--icon', 'src/main/resources/static/favicon.icns',
|
||||
'--icon', 'stirling-pdf/src/main/resources/static/favicon.icns',
|
||||
'--app-version', getMacVersion(project.version.toString()),
|
||||
'--mac-package-name', 'Stirling PDF (x86_64)',
|
||||
'--mac-package-identifier', 'Stirling PDF (x86_64)',
|
||||
@ -285,12 +404,12 @@ tasks.register('downloadTempJre') {
|
||||
def jreArchive = new File(tmpDir, 'jre.tar.gz')
|
||||
def jreDir = new File(tmpDir, 'jre')
|
||||
|
||||
println "Downloading JRE to $jreArchive..."
|
||||
println "Downloading JRE to $jreArchive"
|
||||
jreArchive.withOutputStream { out ->
|
||||
new URI(jreUrl).toURL().withInputStream { from -> out << from }
|
||||
}
|
||||
|
||||
println "Extracting JRE to $jreDir..."
|
||||
println "Extracting JRE to $jreDir"
|
||||
jreDir.mkdirs()
|
||||
providers.exec {
|
||||
commandLine 'tar', '-xzf', jreArchive.absolutePath, '-C', jreDir.absolutePath, '--strip-components=1'
|
||||
@ -322,7 +441,7 @@ tasks.register('cleanTempJre') {
|
||||
}
|
||||
|
||||
launch4j {
|
||||
icon = "${projectDir}/src/main/resources/static/favicon.ico"
|
||||
icon = "${projectDir}/stirling-pdf/src/main/resources/static/favicon.ico"
|
||||
|
||||
outfile="Stirling-PDF.exe"
|
||||
|
||||
@ -333,7 +452,7 @@ launch4j {
|
||||
}
|
||||
jarTask = tasks.bootJar
|
||||
|
||||
errTitle="Encountered error, Do you have Java 21?"
|
||||
errTitle="Encountered error, do you have Java 21?"
|
||||
downloadUrl="https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe"
|
||||
|
||||
if(System.getenv("STIRLING_PDF_DESKTOP_UI") == 'true') {
|
||||
@ -375,157 +494,12 @@ sonar {
|
||||
property "sonar.projectKey", "Stirling-Tools_Stirling-PDF"
|
||||
property "sonar.organization", "stirling-tools"
|
||||
|
||||
property "sonar.exclusions", "**/build-wrapper-dump.json, src/main/java/org/apache/**, src/main/resources/static/pdfjs/**, src/main/resources/static/pdfjs-legacy/**, src/main/resources/static/js/thirdParty/**"
|
||||
property "sonar.coverage.exclusions", "src/main/java/org/apache/**, src/main/resources/static/pdfjs/**, src/main/resources/static/pdfjs-legacy/**, src/main/resources/static/js/thirdParty/**"
|
||||
property "sonar.cpd.exclusions", "src/main/java/org/apache/**, src/main/resources/static/pdfjs/**, src/main/resources/static/pdfjs-legacy/**, src/main/resources/static/js/thirdParty/**"
|
||||
property "sonar.exclusions", "**/build-wrapper-dump.json, **/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
|
||||
property "sonar.coverage.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
|
||||
property "sonar.cpd.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
|
||||
}
|
||||
}
|
||||
|
||||
//gradleLint {
|
||||
// rules=['unused-dependency']
|
||||
// }
|
||||
tasks.wrapper {
|
||||
gradleVersion = "8.14"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
//tasks.withType(JavaCompile) {
|
||||
// options.compilerArgs << "-Xlint:deprecation"
|
||||
//}
|
||||
configurations.all {
|
||||
// Remove all commons-logging dependencies so that only spring-jcl is used
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
// Exclude Tomcat
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':common')
|
||||
|
||||
//tmp for security bumps
|
||||
implementation 'ch.qos.logback:logback-core:1.5.18'
|
||||
implementation 'ch.qos.logback:logback-classic:1.5.18'
|
||||
|
||||
// Exclude vulnerable BouncyCastle version used in tableau
|
||||
configurations.all {
|
||||
exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
|
||||
exclude group: 'org.bouncycastle', module: 'bcutil-jdk15on'
|
||||
exclude group: 'org.bouncycastle', module: 'bcmail-jdk15on'
|
||||
}
|
||||
|
||||
if (System.getenv("STIRLING_PDF_DESKTOP_UI") != "false") {
|
||||
implementation "me.friwi:jcefmaven:135.0.20"
|
||||
implementation "org.openjfx:javafx-controls:21"
|
||||
implementation "org.openjfx:javafx-swing:21"
|
||||
}
|
||||
|
||||
//security updates
|
||||
implementation "org.springframework:spring-webmvc:6.2.7"
|
||||
|
||||
implementation("io.github.pixee:java-security-toolkit:1.2.1")
|
||||
|
||||
// Exclude Tomcat and include Jetty
|
||||
// implementation("org.springframework.boot:spring-boot-starter-web:$springBootVersion")
|
||||
implementation "org.springframework.boot:spring-boot-starter-jetty:$springBootVersion"
|
||||
// implementation "org.springframework.boot:spring-boot-starter-thymeleaf:$springBootVersion"
|
||||
implementation 'com.posthog.java:posthog:1.2.0'
|
||||
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20240325.1'
|
||||
implementation 'org.snakeyaml:snakeyaml-engine:2.9'
|
||||
|
||||
if (System.getenv("DOCKER_ENABLE_SECURITY") != "false" && System.getenv("ADDITIONAL_FEATURES_OFF") != "true") {
|
||||
implementation project(':proprietary')
|
||||
}
|
||||
|
||||
// Batik
|
||||
implementation "org.apache.xmlgraphics:batik-all:1.19"
|
||||
|
||||
// TwelveMonkeys
|
||||
runtimeOnly "com.twelvemonkeys.imageio:imageio-batik:$imageioVersion"
|
||||
runtimeOnly "com.twelvemonkeys.imageio:imageio-bmp:$imageioVersion"
|
||||
runtimeOnly "com.twelvemonkeys.imageio:imageio-jpeg:$imageioVersion"
|
||||
runtimeOnly "com.twelvemonkeys.imageio:imageio-tiff:$imageioVersion"
|
||||
runtimeOnly "com.twelvemonkeys.imageio:imageio-webp:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-hdr:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-icns:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-iff:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-pcx:$imageioVersion@
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-pict:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-pnm:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-psd:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-sgi:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-tga:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-thumbsdb:$imageioVersion"
|
||||
// runtimeOnly "com.twelvemonkeys.imageio:imageio-xwd:$imageioVersion"
|
||||
|
||||
// Image metadata extractor
|
||||
implementation "com.drewnoakes:metadata-extractor:2.19.0"
|
||||
implementation "commons-io:commons-io:2.19.0"
|
||||
// implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.8"
|
||||
|
||||
// General PDF
|
||||
// https://mvnrepository.com/artifact/com.opencsv/opencsv
|
||||
implementation ("com.opencsv:opencsv:5.11")
|
||||
// implementation ("org.apache.pdfbox:pdfbox:$pdfboxVersion")
|
||||
implementation "org.apache.pdfbox:preflight:$pdfboxVersion"
|
||||
implementation ("org.apache.pdfbox:xmpbox:$pdfboxVersion")
|
||||
|
||||
// https://mvnrepository.com/artifact/technology.tabula/tabula
|
||||
implementation ('technology.tabula:tabula:1.0.5') {
|
||||
exclude group: "org.slf4j", module: "slf4j-simple"
|
||||
exclude group: "org.bouncycastle", module: "bcprov-jdk15on"
|
||||
exclude group: "com.google.code.gson", module: "gson"
|
||||
exclude group: "commons-io", module: "commons-io"
|
||||
}
|
||||
|
||||
implementation 'org.apache.pdfbox:jbig2-imageio:3.0.4'
|
||||
|
||||
implementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion"
|
||||
implementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion"
|
||||
implementation "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
|
||||
implementation "io.micrometer:micrometer-core:1.15.0"
|
||||
implementation group: "com.google.zxing", name: "core", version: "3.5.3"
|
||||
// https://mvnrepository.com/artifact/org.commonmark/commonmark
|
||||
implementation "org.commonmark:commonmark:0.24.0"
|
||||
implementation "org.commonmark:commonmark-ext-gfm-tables:0.24.0"
|
||||
// https://mvnrepository.com/artifact/com.bucket4j/bucket4j_jdk17
|
||||
implementation "com.bucket4j:bucket4j_jdk17-core:8.14.0"
|
||||
implementation "com.fathzer:javaluator:3.0.6"
|
||||
implementation 'com.vladsch.flexmark:flexmark-html2md-converter:0.64.8'
|
||||
|
||||
developmentOnly("org.springframework.boot:spring-boot-devtools:$springBootVersion")
|
||||
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
||||
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
||||
|
||||
// Mockito (core)
|
||||
testImplementation 'org.mockito:mockito-core:5.18.0'
|
||||
testRuntimeOnly 'org.mockito:mockito-inline:5.2.0'
|
||||
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
dependsOn "spotlessApply"
|
||||
}
|
||||
compileJava {
|
||||
options.compilerArgs << "-parameters"
|
||||
}
|
||||
|
||||
task writeVersion {
|
||||
def propsFile = file("$projectDir/src/main/resources/version.properties")
|
||||
def propsDir = propsFile.parentFile
|
||||
|
||||
doLast {
|
||||
if (!propsDir.exists()) {
|
||||
propsDir.mkdirs()
|
||||
}
|
||||
|
||||
def props = new Properties()
|
||||
props.setProperty("version", version)
|
||||
props.store(propsFile.newWriter(), null)
|
||||
}
|
||||
}
|
||||
|
||||
processResources.dependsOn(writeVersion)
|
||||
|
||||
swaggerhubUpload {
|
||||
// dependsOn = generateOpenApiDocs // Depends on your task generating Swagger docs
|
||||
api = "Stirling-PDF" // The name of your API on SwaggerHub
|
||||
@ -536,25 +510,43 @@ swaggerhubUpload {
|
||||
oas = "3.0.0" // The version of the OpenAPI Specification you"re using
|
||||
}
|
||||
|
||||
jar {
|
||||
enabled = false
|
||||
manifest {
|
||||
attributes "Implementation-Title": "Stirling-PDF",
|
||||
"Implementation-Version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("test") {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
task printVersion {
|
||||
tasks.register('writeVersion') {
|
||||
def propsFile = file("$projectDir/stirling-pdf/src/main/resources/version.properties")
|
||||
def propsDir = propsFile.parentFile
|
||||
|
||||
doLast {
|
||||
if (propsDir.exists()) {
|
||||
if (propsFile.exists()) {
|
||||
println "File exists: $propsFile"
|
||||
} else {
|
||||
println "$propsFile does not exist. Creating file."
|
||||
propsFile.createNewFile()
|
||||
}
|
||||
} else {
|
||||
println "Creating directory: $propsDir"
|
||||
propsDir.mkdirs()
|
||||
propsFile.createNewFile()
|
||||
}
|
||||
|
||||
def props = new Properties()
|
||||
props.setProperty("version", version)
|
||||
props.store(propsFile.newWriter(), null)
|
||||
}
|
||||
}
|
||||
|
||||
processResources.dependsOn(writeVersion)
|
||||
|
||||
tasks.register('printVersion') {
|
||||
doLast {
|
||||
println project.version
|
||||
}
|
||||
}
|
||||
|
||||
task printMacVersion {
|
||||
tasks.register('printMacVersion') {
|
||||
doLast {
|
||||
println getMacVersion(project.version.toString())
|
||||
}
|
||||
|
@ -1,34 +1,3 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'io.spring.dependency-management' version '1.1.7'
|
||||
}
|
||||
|
||||
group = 'stirling.software'
|
||||
version = '0.46.2'
|
||||
|
||||
ext {
|
||||
lombokVersion = "1.18.38"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'org.springframework.boot:spring-boot-dependencies:3.5.0'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api 'org.springframework.boot:spring-boot-starter-web'
|
||||
api 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||
|
@ -1,5 +1,7 @@
|
||||
package stirling.software.common.configuration;
|
||||
|
||||
import io.github.pixee.security.SystemCommand;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -164,7 +166,7 @@ public class AppConfig {
|
||||
@ConditionalOnMissingClass(
|
||||
"stirling.software.proprietary.security.configuration.SecurityConfiguration")
|
||||
public boolean missingActiveSecurity() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Bean(name = "directoryFilter")
|
||||
|
@ -10,6 +10,7 @@ import org.thymeleaf.IEngineConfiguration;
|
||||
import org.thymeleaf.templateresolver.AbstractConfigurableTemplateResolver;
|
||||
import org.thymeleaf.templateresource.FileTemplateResource;
|
||||
import org.thymeleaf.templateresource.ITemplateResource;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.InputStreamTemplateResource;
|
||||
|
@ -156,8 +156,7 @@ public class ApplicationProperties {
|
||||
@Data
|
||||
public static class InitialLogin {
|
||||
private String username;
|
||||
@ToString.Exclude
|
||||
private String password;
|
||||
@ToString.Exclude private String password;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@ -266,7 +265,8 @@ public class ApplicationProperties {
|
||||
case "google" -> getGoogle();
|
||||
case "github" -> getGithub();
|
||||
case "keycloak" -> getKeycloak();
|
||||
default -> throw new UnsupportedProviderException(
|
||||
default ->
|
||||
throw new UnsupportedProviderException(
|
||||
"Logout from the provider "
|
||||
+ registrationId
|
||||
+ " is not supported. "
|
||||
@ -326,8 +326,7 @@ public class ApplicationProperties {
|
||||
private Integer port;
|
||||
private String name;
|
||||
private String username;
|
||||
@ToString.Exclude
|
||||
private String password;
|
||||
@ToString.Exclude private String password;
|
||||
}
|
||||
|
||||
public enum Driver {
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
|
@ -2,7 +2,9 @@ package stirling.software.common.model.oauth2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||
|
||||
@NoArgsConstructor
|
||||
|
@ -2,7 +2,9 @@ package stirling.software.common.model.oauth2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||
|
||||
@NoArgsConstructor
|
||||
|
@ -2,7 +2,9 @@ package stirling.software.common.model.oauth2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||
|
||||
@NoArgsConstructor
|
||||
|
@ -1,13 +1,16 @@
|
||||
package stirling.software.common.model.oauth2;
|
||||
|
||||
import static stirling.software.common.model.enumeration.UsernameAttribute.EMAIL;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||
import stirling.software.common.model.exception.UnsupportedClaimException;
|
||||
import static stirling.software.common.model.enumeration.UsernameAttribute.EMAIL;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
@ -26,7 +26,6 @@ import org.springframework.stereotype.Service;
|
||||
import com.posthog.java.PostHog;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.service.UserServiceInterface;
|
||||
|
||||
@Service
|
||||
public class PostHogService {
|
||||
@ -209,7 +208,7 @@ public class PostHogService {
|
||||
|
||||
// New environment variables
|
||||
dockerMetrics.put("version_tag", System.getenv("VERSION_TAG"));
|
||||
dockerMetrics.put("without_enhanced_features", System.getenv("WITHOUT_ENHANCED_FEATURES"));
|
||||
dockerMetrics.put("additional_features_off", System.getenv("ADDITIONAL_FEATURES_OFF"));
|
||||
dockerMetrics.put("fat_docker", System.getenv("FAT_DOCKER"));
|
||||
|
||||
return dockerMetrics;
|
||||
|
@ -17,6 +17,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.configuration.RuntimePathConfig;
|
||||
|
||||
@Component
|
||||
|
@ -34,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import io.github.pixee.security.Filenames;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.service.CustomPDFDocumentFactory;
|
||||
|
||||
@Slf4j
|
||||
|
@ -1,19 +1,11 @@
|
||||
package stirling.software.common.util;
|
||||
|
||||
<<<<<<<< HEAD:common/src/main/java/stirling/software/common/util/ProviderUtils.java
|
||||
import static stirling.software.common.util.ValidationUtils.isCollectionEmpty;
|
||||
import static stirling.software.common.util.ValidationUtils.isStringEmpty;
|
||||
|
||||
import stirling.software.common.model.oauth2.Provider;
|
||||
|
||||
public class ProviderUtils {
|
||||
========
|
||||
import stirling.software.common.model.provider.Provider;
|
||||
import static stirling.software.common.util.ValidationUtil.isCollectionEmpty;
|
||||
import static stirling.software.common.util.ValidationUtil.isStringEmpty;
|
||||
|
||||
public class ProviderUtil {
|
||||
>>>>>>>> 7d4baf22 (renaming module):common/src/main/java/stirling/software/common/util/ProviderUtil.java
|
||||
|
||||
public static boolean validateProvider(Provider provider) {
|
||||
if (provider == null) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package stirling.software.common.util;
|
||||
|
||||
public class RequestUriUtil {
|
||||
public class RequestUriUtils {
|
||||
|
||||
public static boolean isStaticResource(String requestURI) {
|
||||
return isStaticResource("", requestURI);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package stirling.software.common.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import stirling.software.common.model.provider.Provider;
|
||||
|
||||
public class ValidationUtil {
|
||||
|
||||
|
@ -18,6 +18,7 @@ import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject;
|
||||
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||
|
||||
public class InvertFullColorStrategy extends ReplaceAndInvertColorStrategy {
|
||||
|
@ -9,6 +9,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.api.security.RedactionArea;
|
||||
|
||||
@Slf4j
|
||||
|
@ -14,8 +14,7 @@ public class StringToMapPropertyEditor extends PropertyEditorSupport {
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
try {
|
||||
TypeReference<HashMap<String, String>> typeRef =
|
||||
new TypeReference<>() {};
|
||||
TypeReference<HashMap<String, String>> typeRef = new TypeReference<>() {};
|
||||
Map<String, String> map = objectMapper.readValue(text, typeRef);
|
||||
setValue(map);
|
||||
} catch (Exception e) {
|
||||
|
@ -1,5 +1,14 @@
|
||||
package stirling.software.common.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.Mockito;
|
||||
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
@ -10,18 +19,6 @@ import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
|
||||
|
||||
class CheckProgramInstallTest {
|
||||
|
||||
private MockedStatic<ProcessExecutor> mockProcessExecutor;
|
||||
|
@ -19,7 +19,6 @@ import org.junit.jupiter.api.io.TempDir;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import stirling.software.common.configuration.RuntimePathConfig;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
|
@ -1,10 +1,7 @@
|
||||
package stirling.software.common.util;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@ -12,18 +9,16 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||
import stirling.software.common.model.oauth2.GitHubProvider;
|
||||
import stirling.software.common.model.oauth2.GoogleProvider;
|
||||
import stirling.software.common.model.oauth2.Provider;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
<<<<<<<< HEAD:common/src/test/java/stirling/software/common/util/ProviderUtilsTest.java
|
||||
class ProviderUtilsTest {
|
||||
========
|
||||
class ProviderUtilTest {
|
||||
>>>>>>>> 7d4baf22 (renaming module):common/src/test/java/stirling/software/common/util/ProviderUtilTest.java
|
||||
|
||||
@Test
|
||||
void testSuccessfulValidation() {
|
||||
@ -33,21 +28,13 @@ class ProviderUtilTest {
|
||||
when(provider.getClientSecret()).thenReturn("clientSecret");
|
||||
when(provider.getScopes()).thenReturn(List.of("read:user"));
|
||||
|
||||
<<<<<<<< HEAD:common/src/test/java/stirling/software/common/util/ProviderUtilsTest.java
|
||||
Assertions.assertTrue(ProviderUtils.validateProvider(provider));
|
||||
========
|
||||
assertTrue(ProviderUtil.validateProvider(provider));
|
||||
>>>>>>>> 7d4baf22 (renaming module):common/src/test/java/stirling/software/common/util/ProviderUtilTest.java
|
||||
assertTrue(ProviderUtils.validateProvider(provider));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("providerParams")
|
||||
void testUnsuccessfulValidation(Provider provider) {
|
||||
<<<<<<<< HEAD:common/src/test/java/stirling/software/common/util/ProviderUtilsTest.java
|
||||
Assertions.assertFalse(ProviderUtils.validateProvider(provider));
|
||||
========
|
||||
assertFalse(ProviderUtil.validateProvider(provider));
|
||||
>>>>>>>> 7d4baf22 (renaming module):common/src/test/java/stirling/software/common/util/ProviderUtilTest.java
|
||||
assertFalse(ProviderUtils.validateProvider(provider));
|
||||
}
|
||||
|
||||
public static Stream<Arguments> providerParams() {
|
||||
|
@ -1,26 +0,0 @@
|
||||
package stirling.software.common.util;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class RequestUriUtilTest {
|
||||
|
||||
@Test
|
||||
public void testIsStaticResource() {
|
||||
assertTrue(RequestUriUtil.isStaticResource("/css/styles.css"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/js/script.js"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/images/logo.png"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/public/index.html"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/pdfjs/pdf.worker.js"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/api/v1/info/status"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/some-path/icon.svg"));
|
||||
assertFalse(RequestUriUtil.isStaticResource("/api/v1/users"));
|
||||
assertFalse(RequestUriUtil.isStaticResource("/api/v1/orders"));
|
||||
assertFalse(RequestUriUtil.isStaticResource("/"));
|
||||
assertTrue(RequestUriUtil.isStaticResource("/login"));
|
||||
assertFalse(RequestUriUtil.isStaticResource("/register"));
|
||||
assertFalse(RequestUriUtil.isStaticResource("/api/v1/products"));
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package stirling.software.common.util.misc;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import stirling.software.common.model.api.misc.HighContrastColorCombination;
|
||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
class HighContrastColorReplaceDeciderTest {
|
||||
|
||||
|
@ -26,7 +26,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||
|
||||
class InvertFullColorStrategyTest {
|
||||
|
@ -9,7 +9,6 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import stirling.software.common.model.api.misc.ReplaceAndInvert;
|
||||
|
||||
class ReplaceAndInvertColorStrategyTest {
|
||||
|
@ -1,17 +1,14 @@
|
||||
package stirling.software.common.util.propertyeditor;
|
||||
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import stirling.software.common.model.api.security.RedactionArea;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import stirling.software.common.model.api.security.RedactionArea;
|
||||
|
||||
class StringToArrayListPropertyEditorTest {
|
||||
|
||||
private StringToArrayListPropertyEditor editor;
|
||||
|
@ -1,45 +0,0 @@
|
||||
§§Stirling PDF Enterprise Edition (EE) license (the “EE License”)
|
||||
|
||||
Copyright (c) 2025-present Stirling Tools
|
||||
|
||||
With regard to the Stirling PDF Software:
|
||||
|
||||
This software and associated documentation files (the "Software") may only be
|
||||
used in production, if you (and any entity that you represent) have agreed to,
|
||||
and are in compliance with, the Stirling PDF Terms of Service, available
|
||||
at https://www.stirlingpdf.com/terms-and-conditions (the “EE Terms”), or other
|
||||
agreement governing the use of the Software, as agreed by you and Stirling PDF,
|
||||
and otherwise have a valid Stirling PDF Enterprise Edition subscription for the
|
||||
correct number of user seats. Subject to the foregoing sentence, you are free to
|
||||
modify this Software and publish patches to the Software. You agree that Stirling PDF
|
||||
and/or its licensors (as applicable) retain all right, title and interest in and
|
||||
to all such modifications and/or patches, and all such modifications and/or
|
||||
patches may only be used, copied, modified, displayed, distributed, or otherwise
|
||||
exploited with a valid Stirling PDF Enterprise Edition subscription for the correct
|
||||
number of user seats. Notwithstanding the foregoing, you may copy and modify
|
||||
the Software for development and testing purposes, without requiring a
|
||||
subscription. You agree that Stirling PDF and/or its licensors (as applicable) retain
|
||||
all right, title and interest in and to all such modifications. You are not
|
||||
granted any other rights beyond what is expressly stated herein. Subject to the
|
||||
foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
|
||||
and/or sell the Software.
|
||||
|
||||
This EE License applies only to the part of this Software that is not
|
||||
distributed as part of MIT License. Any part of this Software
|
||||
distributed as part of MIT License or is served client-side as an image, font,
|
||||
cascading stylesheet (CSS), file which produces or is compiled, arranged,
|
||||
augmented, or combined into client-side JavaScript, in whole or in part, is
|
||||
copyrighted under the MIT Expat license. The full text of this EE License shall
|
||||
be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
For all third party components incorporated into the Stirling PDF Software, those
|
||||
components are licensed under the original license provided by the owner of the
|
||||
applicable component.
|
@ -1,125 +0,0 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'io.spring.dependency-management' version '1.1.7'
|
||||
}
|
||||
|
||||
group = 'stirling.software'
|
||||
version = '0.46.0'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://build.shibboleth.net/maven/releases" }
|
||||
maven { url = "https://maven.pkg.github.com/jcefmaven/jcefmaven" }
|
||||
}
|
||||
|
||||
java {
|
||||
// 17 is lowest but we support and recommend 21
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
ext {
|
||||
lombokVersion = "1.18.38"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
if (System.getenv("DOCKER_ENABLE_SECURITY") == "false") {
|
||||
exclude 'stirling/software/enterprise/security/UserAuthenticationFilter.java'
|
||||
exclude 'stirling/software/enterprise/security/UserBasedRateLimitingFilter.java'
|
||||
exclude 'stirling/software/enterprise/security/CustomAuthenticationSuccessHandler.java'
|
||||
exclude 'stirling/software/enterprise/security/CustomLogoutSuccessHandler.java'
|
||||
exclude 'stirling/software/enterprise/security/FirstLoginFilter.java'
|
||||
exclude 'stirling/software/enterprise/security/IPRateLimitingFilter.java'
|
||||
exclude 'stirling/software/enterprise/security/RateLimitResetScheduler.java'
|
||||
exclude 'stirling/software/enterprise/security/CustomAuthenticationFailureHandler.java'
|
||||
exclude 'stirling/software/enterprise/security/InitialSecuritySetup.java'
|
||||
exclude 'stirling/software/enterprise/security/configuration/**'
|
||||
exclude 'stirling/software/enterprise/security/controller/**'
|
||||
exclude 'stirling/software/enterprise/security/database/**'
|
||||
exclude 'stirling/software/enterprise/security/oauth2/**'
|
||||
exclude 'stirling/software/enterprise/security/saml2/**'
|
||||
exclude 'stirling/software/enterprise/security/service/**'
|
||||
exclude 'stirling/software/enterprise/security/session/**'
|
||||
exclude 'stirling/software/enterprise/security/model/ApiKeyAuthenticationToken.java'
|
||||
exclude 'stirling/software/enterprise/security/model/AttemptCounter.java'
|
||||
exclude 'stirling/software/enterprise/security/model/Authority.java'
|
||||
exclude 'stirling/software/enterprise/security/model/BackupNotFoundException.java'
|
||||
exclude 'stirling/software/enterprise/security/model/PersistentLogin.java'
|
||||
exclude 'stirling/software/enterprise/security/model/SessionEntity.java'
|
||||
exclude 'stirling/software/enterprise/security/model/User.java'
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
java {
|
||||
if (System.getenv("DOCKER_ENABLE_SECURITY") == "false") {
|
||||
exclude 'stirling/software/enterprise/security/**'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'org.springframework.boot:spring-boot-dependencies:3.4.5'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':common')
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-jetty'
|
||||
implementation 'io.swagger.core.v3:swagger-core-jakarta:2.2.30'
|
||||
implementation 'org.springframework:spring-webmvc:6.2.6'
|
||||
implementation 'com.posthog.java:posthog:1.2.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/com.bucket4j/bucket4j_jdk17
|
||||
implementation 'com.bucket4j:bucket4j_jdk17-core:8.14.0'
|
||||
implementation 'io.github.pixee:java-security-toolkit:1.2.1'
|
||||
implementation 'org.bouncycastle:bcprov-jdk18on:1.80'
|
||||
|
||||
if (System.getenv('DOCKER_ENABLE_SECURITY') != 'false') {
|
||||
implementation 'io.micrometer:micrometer-registry-prometheus'
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5:3.1.3.RELEASE'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
|
||||
|
||||
implementation "org.springframework.session:spring-session-core:3.4.3"
|
||||
implementation "org.springframework:spring-jdbc:6.2.6"
|
||||
|
||||
implementation 'com.unboundid.product.scim2:scim2-sdk-client:2.3.5'
|
||||
// Don't upgrade h2database
|
||||
runtimeOnly "com.h2database:h2:2.3.232"
|
||||
runtimeOnly "org.postgresql:postgresql:42.7.5"
|
||||
constraints {
|
||||
implementation "org.opensaml:opensaml-core:$openSamlVersion"
|
||||
implementation "org.opensaml:opensaml-saml-api:$openSamlVersion"
|
||||
implementation "org.opensaml:opensaml-saml-impl:$openSamlVersion"
|
||||
}
|
||||
implementation "org.springframework.security:spring-security-saml2-service-provider:$springSecuritySamlVersion"
|
||||
// implementation 'org.springframework.security:spring-security-core:$springSecuritySamlVersion'
|
||||
implementation 'com.coveo:saml-client:5.0.0'
|
||||
|
||||
}
|
||||
|
||||
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
||||
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
||||
|
||||
testImplementation platform('org.junit:junit-bom:5.10.0')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
// testRuntimeOnly 'org.mockito:mockito-inline:5.2.0'
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
<<<<<<<< HEAD:common/src/main/java/stirling/software/common/configuration/DatabaseConfig.java
|
||||
package stirling.software.SPDF.config.security.database;
|
||||
========
|
||||
package stirling.software.enterprise.security.configuration;
|
||||
>>>>>>>> 7d4baf22 (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/configuration/DatabaseConfig.java
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
<<<<<<<< HEAD:common/src/main/java/stirling/software/common/configuration/DatabaseConfig.java
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
========
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
>>>>>>>> 7d4baf22 (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/configuration/DatabaseConfig.java
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.boot.jdbc.DatabaseDriver;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
<<<<<<<< HEAD:common/src/main/java/stirling/software/common/configuration/DatabaseConfig.java
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
========
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
>>>>>>>> 7d4baf22 (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/configuration/DatabaseConfig.java
|
||||
import stirling.software.common.configuration.InstallationPathConfig;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||
|
||||
@Slf4j
|
||||
@Getter
|
||||
@Lazy
|
||||
@Configuration
|
||||
<<<<<<<< HEAD:common/src/main/java/stirling/software/common/configuration/DatabaseConfig.java
|
||||
@ConditionalOnProperty(name = "premium.proFeatures.database", havingValue = "true")
|
||||
========
|
||||
@EnableJpaRepositories(basePackages = "stirling.software.enterprise.security.database.repository")
|
||||
@EntityScan({"stirling.software.enterprise.security.model"})
|
||||
>>>>>>>> 7d4baf22 (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/configuration/DatabaseConfig.java
|
||||
public class DatabaseConfig {
|
||||
|
||||
public final String DATASOURCE_DEFAULT_URL;
|
||||
|
||||
public static final String DATASOURCE_URL_TEMPLATE = "jdbc:%s://%s:%4d/%s";
|
||||
public static final String DEFAULT_USERNAME = "sa";
|
||||
|
||||
private final ApplicationProperties.Datasource datasource;
|
||||
private final boolean runningProOrHigher;
|
||||
|
||||
public DatabaseConfig(
|
||||
ApplicationProperties.Datasource datasource,
|
||||
@Qualifier("runningProOrHigher") boolean runningProOrHigher) {
|
||||
DATASOURCE_DEFAULT_URL =
|
||||
"jdbc:h2:file:"
|
||||
+ InstallationPathConfig.getConfigPath()
|
||||
+ "stirling-pdf-DB-2.3.232;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL";
|
||||
log.debug("Database URL: {}", DATASOURCE_DEFAULT_URL);
|
||||
this.datasource = datasource;
|
||||
this.runningProOrHigher = runningProOrHigher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the <code>DataSource</code> for the connection to the DB. If <code>useDefault</code>
|
||||
* is set to <code>true</code>, it will use the default H2 DB. If it is set to <code>false
|
||||
* </code>, it will use the user's custom configuration set in the settings.yml.
|
||||
*
|
||||
* @return a <code>DataSource</code> using the configuration settings in the settings.yml
|
||||
* @throws UnsupportedProviderException if the type of database selected is not supported
|
||||
*/
|
||||
@Bean
|
||||
@Qualifier("dataSource")
|
||||
public DataSource dataSource() throws UnsupportedProviderException {
|
||||
DataSourceBuilder<?> dataSourceBuilder = DataSourceBuilder.create();
|
||||
|
||||
if (!runningProOrHigher) {
|
||||
return useDefaultDataSource(dataSourceBuilder);
|
||||
}
|
||||
|
||||
if (!datasource.isEnableCustomDatabase()) {
|
||||
return useDefaultDataSource(dataSourceBuilder);
|
||||
}
|
||||
|
||||
log.info("Using custom database configuration");
|
||||
|
||||
if (!datasource.getCustomDatabaseUrl().isBlank()) {
|
||||
if (datasource.getCustomDatabaseUrl().contains("postgresql")) {
|
||||
dataSourceBuilder.driverClassName(DatabaseDriver.POSTGRESQL.getDriverClassName());
|
||||
}
|
||||
|
||||
dataSourceBuilder.url(datasource.getCustomDatabaseUrl());
|
||||
} else {
|
||||
dataSourceBuilder.driverClassName(getDriverClassName(datasource.getType()));
|
||||
dataSourceBuilder.url(
|
||||
generateCustomDataSourceUrl(
|
||||
datasource.getType(),
|
||||
datasource.getHostName(),
|
||||
datasource.getPort(),
|
||||
datasource.getName()));
|
||||
}
|
||||
dataSourceBuilder.username(datasource.getUsername());
|
||||
dataSourceBuilder.password(datasource.getPassword());
|
||||
|
||||
return dataSourceBuilder.build();
|
||||
}
|
||||
|
||||
private DataSource useDefaultDataSource(DataSourceBuilder<?> dataSourceBuilder) {
|
||||
log.info("Using default H2 database");
|
||||
|
||||
dataSourceBuilder.url(DATASOURCE_DEFAULT_URL)
|
||||
.driverClassName(DatabaseDriver.H2.getDriverClassName())
|
||||
.username(DEFAULT_USERNAME);
|
||||
|
||||
return dataSourceBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the URL the <code>DataSource</code> will use to connect to the database
|
||||
*
|
||||
* @param dataSourceType the type of the database
|
||||
* @param hostname the host name
|
||||
* @param port the port number to use for the database
|
||||
* @param dataSourceName the name the database to connect to
|
||||
* @return the <code>DataSource</code> URL
|
||||
*/
|
||||
private String generateCustomDataSourceUrl(
|
||||
String dataSourceType, String hostname, Integer port, String dataSourceName) {
|
||||
return DATASOURCE_URL_TEMPLATE.formatted(dataSourceType, hostname, port, dataSourceName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects the database driver based on the type of database chosen.
|
||||
*
|
||||
* @param driverName the type of the driver (e.g. 'h2', 'postgresql')
|
||||
* @return the fully qualified driver for the database chosen
|
||||
* @throws UnsupportedProviderException when an unsupported database is selected
|
||||
*/
|
||||
private String getDriverClassName(String driverName) throws UnsupportedProviderException {
|
||||
try {
|
||||
ApplicationProperties.Driver driver =
|
||||
ApplicationProperties.Driver.valueOf(driverName.toUpperCase());
|
||||
|
||||
switch (driver) {
|
||||
case H2 -> {
|
||||
log.debug("H2 driver selected");
|
||||
return DatabaseDriver.H2.getDriverClassName();
|
||||
}
|
||||
case POSTGRESQL -> {
|
||||
log.debug("Postgres driver selected");
|
||||
return DatabaseDriver.POSTGRESQL.getDriverClassName();
|
||||
}
|
||||
default -> {
|
||||
log.warn("{} driver selected", driverName);
|
||||
throw new UnsupportedProviderException(
|
||||
driverName + " is not currently supported");
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.warn("Unknown driver: {}", driverName);
|
||||
throw new UnsupportedProviderException(driverName + " is not currently supported");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,321 +0,0 @@
|
||||
package stirling.software.enterprise.security.configuration;
|
||||
|
||||
import java.util.Optional;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider;
|
||||
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository;
|
||||
import org.springframework.security.saml2.provider.service.web.authentication.OpenSaml4AuthenticationRequestResolver;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
|
||||
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
|
||||
import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler;
|
||||
import org.springframework.security.web.savedrequest.NullRequestCache;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import stirling.software.common.configuration.AppConfig;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.enterprise.security.CustomAuthenticationFailureHandler;
|
||||
import stirling.software.enterprise.security.CustomAuthenticationSuccessHandler;
|
||||
import stirling.software.enterprise.security.CustomLogoutSuccessHandler;
|
||||
import stirling.software.enterprise.security.filter.FirstLoginFilter;
|
||||
import stirling.software.enterprise.security.filter.IPRateLimitingFilter;
|
||||
import stirling.software.enterprise.security.filter.UserAuthenticationFilter;
|
||||
import stirling.software.enterprise.security.database.repository.JPATokenRepositoryImpl;
|
||||
import stirling.software.enterprise.security.database.repository.PersistentLoginRepository;
|
||||
import stirling.software.enterprise.security.model.User;
|
||||
import stirling.software.enterprise.security.oauth2.CustomOAuth2AuthenticationFailureHandler;
|
||||
import stirling.software.enterprise.security.oauth2.CustomOAuth2AuthenticationSuccessHandler;
|
||||
import stirling.software.enterprise.security.saml2.CustomSaml2AuthenticationFailureHandler;
|
||||
import stirling.software.enterprise.security.saml2.CustomSaml2AuthenticationSuccessHandler;
|
||||
import stirling.software.enterprise.security.saml2.CustomSaml2ResponseAuthenticationConverter;
|
||||
import stirling.software.enterprise.security.service.CustomOAuth2UserService;
|
||||
import stirling.software.enterprise.security.service.CustomUserDetailsService;
|
||||
import stirling.software.enterprise.security.service.LoginAttemptService;
|
||||
import stirling.software.enterprise.security.service.UserService;
|
||||
import stirling.software.enterprise.security.session.SessionPersistentRegistry;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableMethodSecurity
|
||||
@Slf4j
|
||||
@DependsOn("runningProOrHigher")
|
||||
public class SecurityConfiguration {
|
||||
|
||||
private final CustomUserDetailsService userDetailsService;
|
||||
private final UserService userService;
|
||||
private final boolean loginEnabledValue;
|
||||
private final boolean runningProOrHigher;
|
||||
|
||||
private final ApplicationProperties applicationProperties;
|
||||
private final AppConfig appConfig;
|
||||
private final UserAuthenticationFilter userAuthenticationFilter;
|
||||
private final LoginAttemptService loginAttemptService;
|
||||
private final FirstLoginFilter firstLoginFilter;
|
||||
private final SessionPersistentRegistry sessionRegistry;
|
||||
private final PersistentLoginRepository persistentLoginRepository;
|
||||
private final GrantedAuthoritiesMapper oAuth2userAuthoritiesMapper;
|
||||
private final RelyingPartyRegistrationRepository saml2RelyingPartyRegistrations;
|
||||
private final OpenSaml4AuthenticationRequestResolver saml2AuthenticationRequestResolver;
|
||||
|
||||
public SecurityConfiguration(
|
||||
PersistentLoginRepository persistentLoginRepository,
|
||||
CustomUserDetailsService userDetailsService,
|
||||
@Lazy UserService userService,
|
||||
@Qualifier("loginEnabled") boolean loginEnabledValue,
|
||||
@Qualifier("runningProOrHigher") boolean runningProOrHigher,
|
||||
AppConfig appConfig,
|
||||
ApplicationProperties applicationProperties,
|
||||
UserAuthenticationFilter userAuthenticationFilter,
|
||||
LoginAttemptService loginAttemptService,
|
||||
FirstLoginFilter firstLoginFilter,
|
||||
SessionPersistentRegistry sessionRegistry,
|
||||
@Autowired(required = false) GrantedAuthoritiesMapper oAuth2userAuthoritiesMapper,
|
||||
@Autowired(required = false)
|
||||
RelyingPartyRegistrationRepository saml2RelyingPartyRegistrations,
|
||||
@Autowired(required = false)
|
||||
OpenSaml4AuthenticationRequestResolver saml2AuthenticationRequestResolver) {
|
||||
this.userDetailsService = userDetailsService;
|
||||
this.userService = userService;
|
||||
this.loginEnabledValue = loginEnabledValue;
|
||||
this.runningProOrHigher = runningProOrHigher;
|
||||
this.appConfig = appConfig;
|
||||
this.applicationProperties = applicationProperties;
|
||||
this.userAuthenticationFilter = userAuthenticationFilter;
|
||||
this.loginAttemptService = loginAttemptService;
|
||||
this.firstLoginFilter = firstLoginFilter;
|
||||
this.sessionRegistry = sessionRegistry;
|
||||
this.persistentLoginRepository = persistentLoginRepository;
|
||||
this.oAuth2userAuthoritiesMapper = oAuth2userAuthoritiesMapper;
|
||||
this.saml2RelyingPartyRegistrations = saml2RelyingPartyRegistrations;
|
||||
this.saml2AuthenticationRequestResolver = saml2AuthenticationRequestResolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
if (applicationProperties.getSecurity().getCsrfDisabled() || !loginEnabledValue) {
|
||||
http.csrf(csrf -> csrf.disable());
|
||||
}
|
||||
|
||||
if (loginEnabledValue) {
|
||||
http.addFilterBefore(
|
||||
userAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
if (!applicationProperties.getSecurity().getCsrfDisabled()) {
|
||||
CookieCsrfTokenRepository cookieRepo =
|
||||
CookieCsrfTokenRepository.withHttpOnlyFalse();
|
||||
CsrfTokenRequestAttributeHandler requestHandler =
|
||||
new CsrfTokenRequestAttributeHandler();
|
||||
requestHandler.setCsrfRequestAttributeName(null);
|
||||
http.csrf(
|
||||
csrf ->
|
||||
csrf.ignoringRequestMatchers(
|
||||
request -> {
|
||||
String apiKey = request.getHeader("X-API-KEY");
|
||||
// If there's no API key, don't ignore CSRF
|
||||
// (return false)
|
||||
if (apiKey == null || apiKey.trim().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// Validate API key using existing UserService
|
||||
try {
|
||||
Optional<User> user =
|
||||
userService.getUserByApiKey(apiKey);
|
||||
// If API key is valid, ignore CSRF (return
|
||||
// true)
|
||||
// If API key is invalid, don't ignore CSRF
|
||||
// (return false)
|
||||
return user.isPresent();
|
||||
} catch (Exception e) {
|
||||
// If there's any error validating the API
|
||||
// key, don't ignore CSRF
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.csrfTokenRepository(cookieRepo)
|
||||
.csrfTokenRequestHandler(requestHandler));
|
||||
}
|
||||
http.addFilterBefore(rateLimitingFilter(), UsernamePasswordAuthenticationFilter.class);
|
||||
http.addFilterAfter(firstLoginFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
http.sessionManagement(
|
||||
sessionManagement ->
|
||||
sessionManagement
|
||||
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
|
||||
.maximumSessions(10)
|
||||
.maxSessionsPreventsLogin(false)
|
||||
.sessionRegistry(sessionRegistry)
|
||||
.expiredUrl("/login?logout=true"));
|
||||
http.authenticationProvider(daoAuthenticationProvider());
|
||||
http.requestCache(requestCache -> requestCache.requestCache(new NullRequestCache()));
|
||||
http.logout(
|
||||
logout ->
|
||||
logout.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
|
||||
.logoutSuccessHandler(
|
||||
new CustomLogoutSuccessHandler(applicationProperties, appConfig))
|
||||
.clearAuthentication(true)
|
||||
.invalidateHttpSession(true)
|
||||
.deleteCookies("JSESSIONID", "remember-me"));
|
||||
http.rememberMe(
|
||||
rememberMeConfigurer -> // Use the configurator directly
|
||||
rememberMeConfigurer
|
||||
.tokenRepository(persistentTokenRepository())
|
||||
.tokenValiditySeconds( // 14 days
|
||||
14 * 24 * 60 * 60)
|
||||
.userDetailsService( // Your existing UserDetailsService
|
||||
userDetailsService)
|
||||
.useSecureCookie( // Enable secure cookie
|
||||
true)
|
||||
.rememberMeParameter( // Form parameter name
|
||||
"remember-me")
|
||||
.rememberMeCookieName( // Cookie name
|
||||
"remember-me")
|
||||
.alwaysRemember(false));
|
||||
http.authorizeHttpRequests(
|
||||
authz ->
|
||||
authz.requestMatchers(
|
||||
req -> {
|
||||
String uri = req.getRequestURI();
|
||||
String contextPath = req.getContextPath();
|
||||
// Remove the context path from the URI
|
||||
String trimmedUri =
|
||||
uri.startsWith(contextPath)
|
||||
? uri.substring(
|
||||
contextPath.length())
|
||||
: uri;
|
||||
return trimmedUri.startsWith("/login")
|
||||
|| trimmedUri.startsWith("/oauth")
|
||||
|| trimmedUri.startsWith("/saml2")
|
||||
|| trimmedUri.endsWith(".svg")
|
||||
|| trimmedUri.startsWith("/register")
|
||||
|| trimmedUri.startsWith("/error")
|
||||
|| trimmedUri.startsWith("/images/")
|
||||
|| trimmedUri.startsWith("/public/")
|
||||
|| trimmedUri.startsWith("/css/")
|
||||
|| trimmedUri.startsWith("/fonts/")
|
||||
|| trimmedUri.startsWith("/js/")
|
||||
|| trimmedUri.startsWith(
|
||||
"/api/v1/info/status");
|
||||
})
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
.authenticated());
|
||||
// Handle User/Password Logins
|
||||
if (applicationProperties.getSecurity().isUserPass()) {
|
||||
http.formLogin(
|
||||
formLogin ->
|
||||
formLogin
|
||||
.loginPage("/login")
|
||||
.successHandler(
|
||||
new CustomAuthenticationSuccessHandler(
|
||||
loginAttemptService, userService))
|
||||
.failureHandler(
|
||||
new CustomAuthenticationFailureHandler(
|
||||
loginAttemptService, userService))
|
||||
.defaultSuccessUrl("/")
|
||||
.permitAll());
|
||||
}
|
||||
// Handle OAUTH2 Logins
|
||||
if (applicationProperties.getSecurity().isOauth2Active()) {
|
||||
http.oauth2Login(
|
||||
oauth2 ->
|
||||
oauth2.loginPage("/oauth2")
|
||||
/*
|
||||
This Custom handler is used to check if the OAUTH2 user trying to log in, already exists in the database.
|
||||
If user exists, login proceeds as usual. If user does not exist, then it is auto-created but only if 'OAUTH2AutoCreateUser'
|
||||
is set as true, else login fails with an error message advising the same.
|
||||
*/
|
||||
.successHandler(
|
||||
new CustomOAuth2AuthenticationSuccessHandler(
|
||||
loginAttemptService,
|
||||
applicationProperties,
|
||||
userService))
|
||||
.failureHandler(
|
||||
new CustomOAuth2AuthenticationFailureHandler())
|
||||
. // Add existing Authorities from the database
|
||||
userInfoEndpoint(
|
||||
userInfoEndpoint ->
|
||||
userInfoEndpoint
|
||||
.oidcUserService(
|
||||
new CustomOAuth2UserService(
|
||||
applicationProperties,
|
||||
userService,
|
||||
loginAttemptService))
|
||||
.userAuthoritiesMapper(
|
||||
oAuth2userAuthoritiesMapper))
|
||||
.permitAll());
|
||||
}
|
||||
// Handle SAML
|
||||
if (applicationProperties.getSecurity().isSaml2Active() && runningProOrHigher) {
|
||||
// Configure the authentication provider
|
||||
OpenSaml4AuthenticationProvider authenticationProvider =
|
||||
new OpenSaml4AuthenticationProvider();
|
||||
authenticationProvider.setResponseAuthenticationConverter(
|
||||
new CustomSaml2ResponseAuthenticationConverter(userService));
|
||||
http.authenticationProvider(authenticationProvider)
|
||||
.saml2Login(
|
||||
saml2 -> {
|
||||
try {
|
||||
saml2.loginPage("/saml2")
|
||||
.relyingPartyRegistrationRepository(
|
||||
saml2RelyingPartyRegistrations)
|
||||
.authenticationManager(
|
||||
new ProviderManager(authenticationProvider))
|
||||
.successHandler(
|
||||
new CustomSaml2AuthenticationSuccessHandler(
|
||||
loginAttemptService,
|
||||
applicationProperties,
|
||||
userService))
|
||||
.failureHandler(
|
||||
new CustomSaml2AuthenticationFailureHandler())
|
||||
.authenticationRequestResolver(
|
||||
saml2AuthenticationRequestResolver);
|
||||
} catch (Exception e) {
|
||||
log.error("Error configuring SAML 2 login", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log.debug("SAML 2 login is not enabled. Using default.");
|
||||
http.authorizeHttpRequests(authz -> authz.anyRequest().permitAll());
|
||||
}
|
||||
return http.build();
|
||||
}
|
||||
|
||||
public DaoAuthenticationProvider daoAuthenticationProvider() {
|
||||
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||
provider.setUserDetailsService(userDetailsService);
|
||||
provider.setPasswordEncoder(passwordEncoder());
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IPRateLimitingFilter rateLimitingFilter() {
|
||||
// Example limit TODO add config level
|
||||
int maxRequestsPerIp = 1000000;
|
||||
return new IPRateLimitingFilter(maxRequestsPerIp, maxRequestsPerIp);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PersistentTokenRepository persistentTokenRepository() {
|
||||
return new JPATokenRepositoryImpl(persistentLoginRepository);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package stirling.software.enterprise.security.model.api.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UpdateUserDetails extends UpdateUserUsername {
|
||||
|
||||
@Schema(
|
||||
description = "new password for user",
|
||||
format = "password",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String newPassword;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package stirling.software.enterprise.security.model.api.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UpdateUserUsername extends UsernameAndPass {
|
||||
|
||||
@Schema(description = "new username for user")
|
||||
private String newUsername;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package stirling.software.enterprise.security.model.api.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public class Username {
|
||||
|
||||
@Schema(description = "username of user", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String username;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package stirling.software.enterprise.security.model.api.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UsernameAndPass extends Username {
|
||||
|
||||
@Schema(description = "password of user", format = "password")
|
||||
private String password;
|
||||
}
|
@ -1,28 +1,7 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'io.spring.dependency-management' version '1.1.7'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "https://build.shibboleth.net/maven/releases" }
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
exclude group: 'commons-logging', module: 'commons-logging'
|
||||
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
||||
}
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'org.springframework.boot:spring-boot-dependencies:3.5.0'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':common')
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/CustomAuthenticationSuccessHandler.java
|
||||
package stirling.software.proprietary.security;
|
||||
========
|
||||
package stirling.software.enterprise.security;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/CustomAuthenticationSuccessHandler.java
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -18,16 +14,8 @@ import jakarta.servlet.http.HttpSession;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.util.RequestUriUtils;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/CustomAuthenticationSuccessHandler.java
|
||||
import stirling.software.proprietary.security.service.LoginAttemptService;
|
||||
import stirling.software.proprietary.security.service.UserService;
|
||||
========
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
import stirling.software.enterprise.security.service.LoginAttemptService;
|
||||
import stirling.software.enterprise.security.service.UserService;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/CustomAuthenticationSuccessHandler.java
|
||||
|
||||
@Slf4j
|
||||
public class CustomAuthenticationSuccessHandler
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/CustomLogoutSuccessHandler.java
|
||||
package stirling.software.proprietary.security;
|
||||
========
|
||||
package stirling.software.enterprise.security;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/CustomLogoutSuccessHandler.java
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.cert.X509Certificate;
|
||||
@ -32,13 +28,8 @@ import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
||||
import stirling.software.common.model.ApplicationProperties.Security.SAML2;
|
||||
import stirling.software.common.model.oauth2.KeycloakProvider;
|
||||
import stirling.software.common.util.UrlUtils;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/CustomLogoutSuccessHandler.java
|
||||
import stirling.software.proprietary.security.saml2.CertificateUtils;
|
||||
import stirling.software.proprietary.security.saml2.CustomSaml2AuthenticatedPrincipal;
|
||||
========
|
||||
import stirling.software.enterprise.security.saml2.CertificateUtils;
|
||||
import stirling.software.enterprise.security.saml2.CustomSaml2AuthenticatedPrincipal;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/CustomLogoutSuccessHandler.java
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@ -47,7 +38,6 @@ public class CustomLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler {
|
||||
public static final String LOGOUT_PATH = "/login?logout=true";
|
||||
|
||||
private final ApplicationProperties applicationProperties;
|
||||
private final AppConfig appConfig;
|
||||
|
||||
private final AppConfig appConfig;
|
||||
|
||||
|
@ -10,6 +10,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
|
||||
/**
|
||||
|
@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.DependsOn;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.authentication.ProviderManager;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
@ -55,6 +56,7 @@ import stirling.software.proprietary.security.session.SessionPersistentRegistry;
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableMethodSecurity
|
||||
@DependsOn("runningProOrHigher")
|
||||
public class SecurityConfiguration {
|
||||
|
||||
private final CustomUserDetailsService userDetailsService;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/controller/web/DatabaseWebController.java
|
||||
package stirling.software.proprietary.security.controller.web;
|
||||
========
|
||||
package stirling.software.enterprise.security.controller.web;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/controller/web/DatabaseWebController.java
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -19,11 +15,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.FileInfo;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/controller/web/DatabaseWebController.java
|
||||
import stirling.software.proprietary.security.service.DatabaseService;
|
||||
========
|
||||
import stirling.software.enterprise.security.service.DatabaseService;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/controller/web/DatabaseWebController.java
|
||||
|
||||
@Controller
|
||||
@Tag(name = "Database Management", description = "Database management and security APIs")
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/database/H2SQLCondition.java
|
||||
package stirling.software.proprietary.security.database;
|
||||
========
|
||||
package stirling.software.enterprise.security.database;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/database/H2SQLCondition.java
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/database/ScheduledTasks.java
|
||||
package stirling.software.proprietary.security.database;
|
||||
========
|
||||
package stirling.software.enterprise.security.database;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/database/ScheduledTasks.java
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
@ -13,11 +9,7 @@ import org.springframework.stereotype.Component;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import stirling.software.common.model.exception.UnsupportedProviderException;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/database/ScheduledTasks.java
|
||||
import stirling.software.proprietary.security.service.DatabaseServiceInterface;
|
||||
========
|
||||
import stirling.software.enterprise.security.service.DatabaseServiceInterface;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/database/ScheduledTasks.java
|
||||
|
||||
@Component
|
||||
@Conditional(H2SQLCondition.class)
|
||||
|
@ -1,18 +1,9 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/database/repository/PersistentLoginRepository.java
|
||||
package stirling.software.proprietary.security.database.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import stirling.software.proprietary.security.model.PersistentLogin;
|
||||
========
|
||||
package stirling.software.enterprise.security.database.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import stirling.software.enterprise.security.model.PersistentLogin;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/database/repository/PersistentLoginRepository.java
|
||||
|
||||
@Repository
|
||||
public interface PersistentLoginRepository extends JpaRepository<PersistentLogin, String> {
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/EnterpriseEndpointFilter.java
|
||||
package stirling.software.proprietary.security.filter;
|
||||
========
|
||||
package stirling.software.enterprise.security.filter;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/EnterpriseEndpointFilter.java
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -1,24 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/FirstLoginFilter.java
|
||||
package stirling.software.proprietary.security.filter;
|
||||
========
|
||||
package stirling.software.enterprise.security.filter;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
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 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;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/FirstLoginFilter.java
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -40,13 +20,8 @@ import jakarta.servlet.http.HttpSession;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.util.RequestUriUtils;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/FirstLoginFilter.java
|
||||
import stirling.software.proprietary.security.model.User;
|
||||
import stirling.software.proprietary.security.service.UserService;
|
||||
========
|
||||
import stirling.software.enterprise.security.model.User;
|
||||
import stirling.software.enterprise.security.service.UserService;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/FirstLoginFilter.java
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/IPRateLimitingFilter.java
|
||||
package stirling.software.proprietary.security.filter;
|
||||
========
|
||||
package stirling.software.enterprise.security.filter;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/IPRateLimitingFilter.java
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/UserAuthenticationFilter.java
|
||||
package stirling.software.proprietary.security.filter;
|
||||
========
|
||||
package stirling.software.enterprise.security.filter;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/UserAuthenticationFilter.java
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@ -31,19 +27,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
||||
import stirling.software.common.model.ApplicationProperties.Security.SAML2;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/UserAuthenticationFilter.java
|
||||
import stirling.software.proprietary.security.model.ApiKeyAuthenticationToken;
|
||||
import stirling.software.proprietary.security.model.User;
|
||||
import stirling.software.proprietary.security.saml2.CustomSaml2AuthenticatedPrincipal;
|
||||
import stirling.software.proprietary.security.service.UserService;
|
||||
import stirling.software.proprietary.security.session.SessionPersistentRegistry;
|
||||
========
|
||||
import stirling.software.enterprise.security.model.ApiKeyAuthenticationToken;
|
||||
import stirling.software.enterprise.security.model.User;
|
||||
import stirling.software.enterprise.security.saml2.CustomSaml2AuthenticatedPrincipal;
|
||||
import stirling.software.enterprise.security.service.UserService;
|
||||
import stirling.software.enterprise.security.session.SessionPersistentRegistry;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/UserAuthenticationFilter.java
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/filter/UserBasedRateLimitingFilter.java
|
||||
package stirling.software.proprietary.security.filter;
|
||||
========
|
||||
package stirling.software.enterprise.security.filter;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/filter/UserBasedRateLimitingFilter.java
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/ApiKeyAuthenticationToken.java
|
||||
package stirling.software.proprietary.security.model;
|
||||
========
|
||||
package stirling.software.enterprise.security.model;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/model/ApiKeyAuthenticationToken.java
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/AttemptCounter.java
|
||||
package stirling.software.proprietary.security.model;
|
||||
========
|
||||
package stirling.software.enterprise.security.model;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/model/AttemptCounter.java
|
||||
|
||||
public class AttemptCounter {
|
||||
private int attemptCount;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/Authority.java
|
||||
package stirling.software.proprietary.security.model;
|
||||
========
|
||||
package stirling.software.enterprise.security.model;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/model/Authority.java
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/PersistentLogin.java
|
||||
package stirling.software.proprietary.security.model;
|
||||
========
|
||||
package stirling.software.enterprise.security.model;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/model/PersistentLogin.java
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/SessionEntity.java
|
||||
package stirling.software.proprietary.security.model;
|
||||
========
|
||||
package stirling.software.enterprise.security.model;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/model/SessionEntity.java
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/User.java
|
||||
package stirling.software.proprietary.security.model;
|
||||
========
|
||||
package stirling.software.enterprise.security.model;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/model/User.java
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
@ -18,7 +14,6 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import stirling.software.common.model.enumeration.Role;
|
||||
|
||||
import stirling.software.common.model.enumeration.Role;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/exception/BackupNotFoundException.java
|
||||
package stirling.software.proprietary.security.model.exception;
|
||||
========
|
||||
package stirling.software.common.model.exception;
|
||||
>>>>>>>> f833293d (renaming module):common/src/main/java/stirling/software/common/model/exception/BackupNotFoundException.java
|
||||
|
||||
public class BackupNotFoundException extends RuntimeException {
|
||||
public BackupNotFoundException(String message) {
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/model/exception/NoProviderFoundException.java
|
||||
package stirling.software.proprietary.security.model.exception;
|
||||
========
|
||||
package stirling.software.common.model.exception;
|
||||
>>>>>>>> f833293d (renaming module):common/src/main/java/stirling/software/common/model/exception/NoProviderFoundException.java
|
||||
|
||||
public class NoProviderFoundException extends Exception {
|
||||
public NoProviderFoundException(String message) {
|
||||
|
@ -1,14 +1,7 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/oauth2/CustomOAuth2AuthenticationFailureHandler.java
|
||||
package stirling.software.proprietary.security.oauth2;
|
||||
========
|
||||
package stirling.software.enterprise.security.oauth2;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/oauth2/CustomOAuth2AuthenticationFailureHandler.java
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.DisabledException;
|
||||
import org.springframework.security.authentication.LockedException;
|
||||
@ -17,6 +10,12 @@ import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
|
||||
import org.springframework.security.oauth2.core.OAuth2Error;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class CustomOAuth2AuthenticationFailureHandler
|
||||
extends SimpleUrlAuthenticationFailureHandler {
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/oauth2/CustomOAuth2AuthenticationSuccessHandler.java
|
||||
package stirling.software.proprietary.security.oauth2;
|
||||
========
|
||||
package stirling.software.enterprise.security.oauth2;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/oauth2/CustomOAuth2AuthenticationSuccessHandler.java
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/saml2/CertificateUtils.java
|
||||
package stirling.software.proprietary.security.saml2;
|
||||
========
|
||||
package stirling.software.enterprise.security.saml2;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/saml2/CertificateUtils.java
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@ -10,6 +6,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
|
||||
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
|
||||
import org.bouncycastle.openssl.PEMKeyPair;
|
||||
import org.bouncycastle.openssl.PEMParser;
|
||||
|
@ -1,12 +1,9 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/saml2/CustomSaml2AuthenticatedPrincipal.java
|
||||
package stirling.software.proprietary.security.saml2;
|
||||
========
|
||||
package stirling.software.enterprise.security.saml2;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/saml2/CustomSaml2AuthenticatedPrincipal.java
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticatedPrincipal;
|
||||
|
||||
|
@ -1,13 +1,7 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/saml2/CustomSaml2AuthenticationFailureHandler.java
|
||||
package stirling.software.proprietary.security.saml2;
|
||||
========
|
||||
package stirling.software.enterprise.security.saml2;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/saml2/CustomSaml2AuthenticationFailureHandler.java
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.authentication.ProviderNotFoundException;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
@ -15,6 +9,11 @@ import org.springframework.security.saml2.core.Saml2Error;
|
||||
import org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationException;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@ConditionalOnProperty(name = "security.saml2.enabled", havingValue = "true")
|
||||
public class CustomSaml2AuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
|
||||
|
@ -1,17 +1,10 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/saml2/SAML2Configuration.java
|
||||
package stirling.software.proprietary.security.saml2;
|
||||
========
|
||||
package stirling.software.enterprise.security.saml2;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/saml2/SAML2Configuration.java
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.opensaml.saml.saml2.core.AuthnRequest;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -25,13 +18,19 @@ import org.springframework.security.saml2.provider.service.registration.RelyingP
|
||||
import org.springframework.security.saml2.provider.service.registration.Saml2MessageBinding;
|
||||
import org.springframework.security.saml2.provider.service.web.HttpSessionSaml2AuthenticationRequestRepository;
|
||||
import org.springframework.security.saml2.provider.service.web.authentication.OpenSaml4AuthenticationRequestResolver;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.ApplicationProperties.Security.SAML2;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
@ConditionalOnProperty(value = "security.saml2.enabled", havingValue = "true")
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnBooleanProperty("security.saml2.enabled")
|
||||
public class SAML2Configuration {
|
||||
|
||||
private final ApplicationProperties applicationProperties;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/AppUpdateAuthService.java
|
||||
package stirling.software.proprietary.security.service;
|
||||
========
|
||||
package stirling.software.enterprise.security.service;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/AppUpdateAuthService.java
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -14,13 +10,8 @@ import lombok.RequiredArgsConstructor;
|
||||
|
||||
import stirling.software.common.configuration.interfaces.ShowAdminInterface;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/AppUpdateAuthService.java
|
||||
import stirling.software.proprietary.security.database.repository.UserRepository;
|
||||
import stirling.software.proprietary.security.model.User;
|
||||
========
|
||||
import stirling.software.enterprise.security.database.repository.UserRepository;
|
||||
import stirling.software.enterprise.security.model.User;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/AppUpdateAuthService.java
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/CustomOAuth2UserService.java
|
||||
package stirling.software.proprietary.security.service;
|
||||
========
|
||||
package stirling.software.enterprise.security.service;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/CustomOAuth2UserService.java
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -20,11 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
import stirling.software.common.model.ApplicationProperties.Security.OAUTH2;
|
||||
import stirling.software.common.model.enumeration.UsernameAttribute;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/CustomOAuth2UserService.java
|
||||
import stirling.software.proprietary.security.model.User;
|
||||
========
|
||||
import stirling.software.enterprise.security.model.User;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/CustomOAuth2UserService.java
|
||||
|
||||
@Slf4j
|
||||
public class CustomOAuth2UserService implements OAuth2UserService<OidcUserRequest, OidcUser> {
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/DatabaseServiceInterface.java
|
||||
package stirling.software.proprietary.security.service;
|
||||
========
|
||||
package stirling.software.enterprise.security.service;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/DatabaseServiceInterface.java
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/LoginAttemptService.java
|
||||
package stirling.software.proprietary.security.service;
|
||||
========
|
||||
package stirling.software.enterprise.security.service;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/LoginAttemptService.java
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -15,11 +11,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import stirling.software.common.model.ApplicationProperties;
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/service/LoginAttemptService.java
|
||||
import stirling.software.proprietary.security.model.AttemptCounter;
|
||||
========
|
||||
import stirling.software.enterprise.security.model.AttemptCounter;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/service/LoginAttemptService.java
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/session/CustomHttpSessionListener.java
|
||||
package stirling.software.proprietary.security.session;
|
||||
========
|
||||
package stirling.software.enterprise.security.session;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/session/CustomHttpSessionListener.java
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -3,7 +3,6 @@ package stirling.software.proprietary.security.session;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.core.session.SessionRegistryImpl;
|
||||
import stirling.software.proprietary.security.database.repository.SessionRepository;
|
||||
|
||||
import stirling.software.proprietary.security.database.repository.SessionRepository;
|
||||
|
||||
@ -16,7 +15,8 @@ public class SessionRegistryConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SessionPersistentRegistry sessionPersistentRegistry(SessionRepository sessionRepository) {
|
||||
public SessionPersistentRegistry sessionPersistentRegistry(
|
||||
SessionRepository sessionRepository) {
|
||||
return new SessionPersistentRegistry(sessionRepository);
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,16 @@
|
||||
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/session/SessionScheduled.java
|
||||
package stirling.software.proprietary.security.session;
|
||||
========
|
||||
package stirling.software.enterprise.security.session;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/main/java/stirling/software/enterprise/security/session/SessionScheduled.java
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.security.core.session.SessionInformation;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class SessionScheduled {
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/test/java/stirling/software/proprietary/security/CustomLogoutSuccessHandlerTest.java
|
||||
package stirling.software.proprietary.security;
|
||||
========
|
||||
package stirling.software.enterprise.security;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/test/java/stirling/software/enterprise/security/CustomLogoutSuccessHandlerTest.java
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
@ -1,8 +1,4 @@
|
||||
<<<<<<<< HEAD:proprietary/src/test/java/stirling/software/proprietary/security/configuration/DatabaseConfigTest.java
|
||||
package stirling.software.proprietary.security.configuration;
|
||||
========
|
||||
package stirling.software.enterprise.security.configuration;
|
||||
>>>>>>>> f833293d (renaming module):enterprise/src/test/java/stirling/software/enterprise/security/configuration/DatabaseConfigTest.java
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
@ -1,5 +1,5 @@
|
||||
echo "Running Stirling PDF with ADDITIONAL_FEATURES_OFF=${ADDITIONAL_FEATURES_OFF} and VERSION_TAG=${VERSION_TAG}"
|
||||
# Check for $ADDITIONAL_FEATURES_OFF and download the appropriate JAR if required
|
||||
# Check for ADDITIONAL_FEATURES_OFF and download the appropriate JAR if required
|
||||
if [ "$ADDITIONAL_FEATURES_OFF" = "false" ] && [ "$VERSION_TAG" != "alpha" ]; then
|
||||
if [ ! -f app-security.jar ]; then
|
||||
echo "Trying to download from: https://files.stirlingpdf.com/v$VERSION_TAG/Stirling-PDF-with-login.jar"
|
||||
|
@ -4,4 +4,4 @@ plugins {
|
||||
}
|
||||
rootProject.name = 'Stirling-PDF'
|
||||
|
||||
include 'common', 'proprietary'
|
||||
include 'stirling-pdf', 'common', 'proprietary'
|
||||
|
@ -1,77 +0,0 @@
|
||||
// package stirling.software.SPDF.config.fingerprint;
|
||||
//
|
||||
// import java.security.MessageDigest;
|
||||
// import java.security.NoSuchAlgorithmException;
|
||||
//
|
||||
// import org.springframework.stereotype.Component;
|
||||
//
|
||||
// import jakarta.servlet.http.HttpServletRequest;
|
||||
//
|
||||
// @Component
|
||||
// public class FingerprintGenerator {
|
||||
//
|
||||
// public String generateFingerprint(HttpServletRequest request) {
|
||||
// if (request == null) {
|
||||
// return "";
|
||||
// }
|
||||
// StringBuilder fingerprintBuilder = new StringBuilder();
|
||||
//
|
||||
// // Add IP address
|
||||
// fingerprintBuilder.append(request.getRemoteAddr());
|
||||
//
|
||||
// // Add X-Forwarded-For header if present (for clients behind proxies)
|
||||
// String forwardedFor = request.getHeader("X-Forwarded-For");
|
||||
// if (forwardedFor != null) {
|
||||
// fingerprintBuilder.append(forwardedFor);
|
||||
// }
|
||||
//
|
||||
// // Add User-Agent
|
||||
// String userAgent = request.getHeader("User-Agent");
|
||||
// if (userAgent != null) {
|
||||
// fingerprintBuilder.append(userAgent);
|
||||
// }
|
||||
//
|
||||
// // Add Accept-Language header
|
||||
// String acceptLanguage = request.getHeader("Accept-Language");
|
||||
// if (acceptLanguage != null) {
|
||||
// fingerprintBuilder.append(acceptLanguage);
|
||||
// }
|
||||
//
|
||||
// // Add Accept header
|
||||
// String accept = request.getHeader("Accept");
|
||||
// if (accept != null) {
|
||||
// fingerprintBuilder.append(accept);
|
||||
// }
|
||||
//
|
||||
// // Add Connection header
|
||||
// String connection = request.getHeader("Connection");
|
||||
// if (connection != null) {
|
||||
// fingerprintBuilder.append(connection);
|
||||
// }
|
||||
//
|
||||
// // Add server port
|
||||
// fingerprintBuilder.append(request.getServerPort());
|
||||
//
|
||||
// // Add secure flag
|
||||
// fingerprintBuilder.append(request.isSecure());
|
||||
//
|
||||
// // Generate a hash of the fingerprint
|
||||
// return generateHash(fingerprintBuilder.toString());
|
||||
// }
|
||||
//
|
||||
// private String generateHash(String input) {
|
||||
// try {
|
||||
// MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
// byte[] hash = digest.digest(input.getBytes());
|
||||
// StringBuilder hexString = new StringBuilder();
|
||||
// for (byte b : hash) {
|
||||
// String hex = Integer.toHexString(0xff & b);
|
||||
// if (hex.length() == 1) hexString.append('0');
|
||||
// hexString.append(hex);
|
||||
// }
|
||||
// return hexString.toString();
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw new RuntimeException("Failed to generate fingerprint hash", e);
|
||||
// }
|
||||
// }
|
||||
// }
|
@ -1,38 +0,0 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ConditionalOnProperty(value = "mail.enabled", havingValue = "true", matchIfMissing = false)
|
||||
public class Email extends GeneralFile {
|
||||
|
||||
@Schema(
|
||||
description = "The recipient's email address",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
format = "email")
|
||||
private String to;
|
||||
|
||||
@Schema(
|
||||
description = "The subject of the email",
|
||||
defaultValue = "Stirling Software PDF Notification",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String subject;
|
||||
|
||||
@Schema(
|
||||
description = "The body of the email",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED,
|
||||
defaultValue =
|
||||
"This message was automatically generated by Stirling-PDF, an innovative"
|
||||
+ " solution from Stirling Software. For more information, visit our <a"
|
||||
+ " href=\"https://stirling-software.com\">website</a>.<br><br>Please do"
|
||||
+ " not reply directly to this email.")
|
||||
private String body;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package stirling.software.SPDF.model.api;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
public class GeneralFile {
|
||||
|
||||
@Schema(
|
||||
description = "The input file",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
format = "binary")
|
||||
private MultipartFile fileInput;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package stirling.software.SPDF.model.api.converters;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFWithPageNums;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ConvertToImageRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(
|
||||
description = "The output image format",
|
||||
defaultValue = "png",
|
||||
allowableValues = {"png", "jpeg", "jpg", "gif", "webp"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String imageFormat;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Choose between a single image containing all pages or separate images for each"
|
||||
+ " page",
|
||||
defaultValue = "multiple",
|
||||
allowableValues = {"single", "multiple"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String singleOrMultiple;
|
||||
|
||||
@Schema(
|
||||
description = "The color type of the output image(s)",
|
||||
defaultValue = "color",
|
||||
allowableValues = {"color", "greyscale", "blackwhite"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String colorType;
|
||||
|
||||
@Schema(
|
||||
description = "The DPI (dots per inch) for the output image(s)",
|
||||
defaultValue = "300",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer dpi;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package stirling.software.SPDF.model.api.general;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OverlayPdfsRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"An array of PDF files to be used as overlays on the base PDF. The order in"
|
||||
+ " these files is applied based on the selected mode.",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private MultipartFile[] overlayFiles;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"The mode of overlaying: 'SequentialOverlay' for sequential application,"
|
||||
+ " 'InterleavedOverlay' for round-robin application, 'FixedRepeatOverlay'"
|
||||
+ " for fixed repetition based on provided counts",
|
||||
allowableValues = {"SequentialOverlay", "InterleavedOverlay", "FixedRepeatOverlay"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String overlayMode;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"An array of integers specifying the number of times each corresponding overlay"
|
||||
+ " file should be applied in the 'FixedRepeatOverlay' mode. This should"
|
||||
+ " match the length of the overlayFiles array.",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private int[] counts;
|
||||
|
||||
@Schema(
|
||||
description = "Overlay position 0 is Foregound, 1 is Background",
|
||||
allowableValues = {"0", "1"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED,
|
||||
type = "number")
|
||||
private int overlayPosition;
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.SPDF.model.api.PDFWithPageNums;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AddStampRequest extends PDFWithPageNums {
|
||||
|
||||
@Schema(
|
||||
description = "The stamp type (text or image)",
|
||||
allowableValues = {"text", "image"},
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String stampType;
|
||||
|
||||
@Schema(description = "The stamp text", defaultValue = "Stirling Software")
|
||||
private String stampText;
|
||||
|
||||
@Schema(description = "The stamp image")
|
||||
private MultipartFile stampImage;
|
||||
|
||||
@Schema(
|
||||
description = "The selected alphabet of the stamp text",
|
||||
allowableValues = {"roman", "arabic", "japanese", "korean", "chinese"},
|
||||
defaultValue = "roman")
|
||||
private String alphabet = "roman";
|
||||
|
||||
@Schema(
|
||||
description = "The font size of the stamp text and image",
|
||||
defaultValue = "30",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float fontSize;
|
||||
|
||||
@Schema(
|
||||
description = "The rotation of the stamp in degrees",
|
||||
defaultValue = "0",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float rotation;
|
||||
|
||||
@Schema(
|
||||
description = "The opacity of the stamp (0.0 - 1.0)",
|
||||
defaultValue = "0.5",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float opacity;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Position for stamp placement based on a 1-9 grid (1: bottom-left, 2: bottom-center,"
|
||||
+ " 3: bottom-right, 4: middle-left, 5: middle-center, 6: middle-right,"
|
||||
+ " 7: top-left, 8: top-center, 9: top-right)",
|
||||
allowableValues = {"1", "2", "3", "4", "5", "6", "7", "8", "9"},
|
||||
defaultValue = "5",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private int position;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Override X coordinate for stamp placement. If set, it will override the"
|
||||
+ " position-based calculation. Negative value means no override.",
|
||||
defaultValue = "-1",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float overrideX; // Default to -1 indicating no override
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Override Y coordinate for stamp placement. If set, it will override the"
|
||||
+ " position-based calculation. Negative value means no override.",
|
||||
defaultValue = "-1",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float overrideY; // Default to -1 indicating no override
|
||||
|
||||
@Schema(
|
||||
description = "Specifies the margin size for the stamp.",
|
||||
allowableValues = {"small", "medium", "large", "x-large"},
|
||||
defaultValue = "medium",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String customMargin;
|
||||
|
||||
@Schema(description = "The color of the stamp text", defaultValue = "#d3d3d3")
|
||||
private String customColor;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package stirling.software.SPDF.model.api.misc;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MetadataRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "Delete all metadata if set to true",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean deleteAll;
|
||||
|
||||
@Schema(
|
||||
description = "The author of the document",
|
||||
defaultValue = "author",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String author;
|
||||
|
||||
@Schema(
|
||||
description = "The creation date of the document (format: yyyy/MM/dd HH:mm:ss)",
|
||||
pattern = "yyyy/MM/dd HH:mm:ss",
|
||||
defaultValue = "2023/10/01 12:00:00",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String creationDate;
|
||||
|
||||
@Schema(
|
||||
description = "The creator of the document",
|
||||
defaultValue = "creator",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String creator;
|
||||
|
||||
@Schema(
|
||||
description = "The keywords for the document",
|
||||
defaultValue = "keywords",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String keywords;
|
||||
|
||||
@Schema(
|
||||
description = "The modification date of the document (format: yyyy/MM/dd HH:mm:ss)",
|
||||
pattern = "yyyy/MM/dd HH:mm:ss",
|
||||
defaultValue = "2023/10/01 12:00:00",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String modificationDate;
|
||||
|
||||
@Schema(
|
||||
description = "The producer of the document",
|
||||
defaultValue = "producer",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String producer;
|
||||
|
||||
@Schema(
|
||||
description = "The subject of the document",
|
||||
defaultValue = "subject",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String subject;
|
||||
|
||||
@Schema(
|
||||
description = "The title of the document",
|
||||
defaultValue = "title",
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String title;
|
||||
|
||||
@Schema(
|
||||
description = "The trapped status of the document",
|
||||
defaultValue = "False",
|
||||
allowableValues = {"True", "False", "Unknown"},
|
||||
requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private String trapped;
|
||||
|
||||
@Schema(
|
||||
description =
|
||||
"Map list of key and value of custom parameters. Note these must start with"
|
||||
+ " customKey and customValue if they are non-standard")
|
||||
private Map<String, String> allRequestParams;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package stirling.software.SPDF.model.api.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RedactPdfRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "List of text to redact from the PDF",
|
||||
defaultValue = "text,text2",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String listOfText;
|
||||
|
||||
@Schema(
|
||||
description = "Whether to use regex for the listOfText",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean useRegex;
|
||||
|
||||
@Schema(
|
||||
description = "Whether to use whole word search",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean wholeWordSearch;
|
||||
|
||||
@Schema(
|
||||
description = "The color for redaction",
|
||||
defaultValue = "#000000",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String redactColor;
|
||||
|
||||
@Schema(
|
||||
description = "Custom padding for redaction",
|
||||
type = "number",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private float customPadding;
|
||||
|
||||
@Schema(
|
||||
description = "Convert the redacted PDF to an image",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean convertPDFToImage;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package stirling.software.SPDF.model.api.security;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import stirling.software.common.model.api.PDFFile;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SanitizePdfRequest extends PDFFile {
|
||||
|
||||
@Schema(
|
||||
description = "Remove JavaScript actions from the PDF",
|
||||
defaultValue = "true",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeJavaScript;
|
||||
|
||||
@Schema(
|
||||
description = "Remove embedded files from the PDF",
|
||||
defaultValue = "true",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeEmbeddedFiles;
|
||||
|
||||
@Schema(
|
||||
description = "Remove XMP metadata from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeXMPMetadata;
|
||||
|
||||
@Schema(
|
||||
description = "Remove document info metadata from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeMetadata;
|
||||
|
||||
@Schema(
|
||||
description = "Remove links from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeLinks;
|
||||
|
||||
@Schema(
|
||||
description = "Remove fonts from the PDF",
|
||||
defaultValue = "false",
|
||||
requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Boolean removeFonts;
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
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