Defaulting JWT settings to false (#4416)

Defaulting the configuration settings for Stirling PDF's JWT to false to
avoid any unexpected issues
This commit is contained in:
Dario Ghunney Ware
2025-09-30 12:02:11 +01:00
committed by GitHub
parent 7bd31a954e
commit dabc52ef73
15 changed files with 111 additions and 107 deletions
@@ -227,7 +227,9 @@ public class LoadingWindow extends JDialog {
if (!existingPids
.contains(
pid)) {
log.debug("Found new explorer.exe with PID: {}", pid);
log.debug(
"Found new explorer.exe with PID: {}",
pid);
ProcessBuilder
killProcess =
new ProcessBuilder(
@@ -245,7 +247,9 @@ public class LoadingWindow extends JDialog {
2,
TimeUnit
.SECONDS);
log.debug("Explorer process terminated: {}", pid);
log.debug(
"Explorer process terminated: {}",
pid);
}
}
}
@@ -87,13 +87,15 @@ public class FilterController {
PDDocument document = pdfDocumentFactory.load(inputFile);
int actualPageCount = document.getNumberOfPages();
// Perform the comparison
boolean valid = switch (comparator) {
case "Greater" -> actualPageCount > pageCount;
case "Equal" -> actualPageCount == pageCount;
case "Less" -> actualPageCount < pageCount;
default ->
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
};
boolean valid =
switch (comparator) {
case "Greater" -> actualPageCount > pageCount;
case "Equal" -> actualPageCount == pageCount;
case "Less" -> actualPageCount < pageCount;
default ->
throw ExceptionUtils.createInvalidArgumentException(
"comparator", comparator);
};
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
return null;
@@ -123,13 +125,15 @@ public class FilterController {
float standardArea = standardSize.getWidth() * standardSize.getHeight();
// Perform the comparison
boolean valid = switch (comparator) {
case "Greater" -> actualArea > standardArea;
case "Equal" -> actualArea == standardArea;
case "Less" -> actualArea < standardArea;
default ->
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
};
boolean valid =
switch (comparator) {
case "Greater" -> actualArea > standardArea;
case "Equal" -> actualArea == standardArea;
case "Less" -> actualArea < standardArea;
default ->
throw ExceptionUtils.createInvalidArgumentException(
"comparator", comparator);
};
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
return null;
@@ -149,13 +153,15 @@ public class FilterController {
long actualFileSize = inputFile.getSize();
// Perform the comparison
boolean valid = switch (comparator) {
case "Greater" -> actualFileSize > fileSize;
case "Equal" -> actualFileSize == fileSize;
case "Less" -> actualFileSize < fileSize;
default ->
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
};
boolean valid =
switch (comparator) {
case "Greater" -> actualFileSize > fileSize;
case "Equal" -> actualFileSize == fileSize;
case "Less" -> actualFileSize < fileSize;
default ->
throw ExceptionUtils.createInvalidArgumentException(
"comparator", comparator);
};
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
return null;
@@ -179,13 +185,15 @@ public class FilterController {
int actualRotation = firstPage.getRotation();
// Perform the comparison
boolean valid = switch (comparator) {
case "Greater" -> actualRotation > rotation;
case "Equal" -> actualRotation == rotation;
case "Less" -> actualRotation < rotation;
default ->
throw ExceptionUtils.createInvalidArgumentException("comparator", comparator);
};
boolean valid =
switch (comparator) {
case "Greater" -> actualRotation > rotation;
case "Equal" -> actualRotation == rotation;
case "Less" -> actualRotation < rotation;
default ->
throw ExceptionUtils.createInvalidArgumentException(
"comparator", comparator);
};
if (valid) return WebResponseUtils.multiPartFileToWebResponse(inputFile);
return null;
@@ -23,9 +23,9 @@ import lombok.extern.slf4j.Slf4j;
import stirling.software.SPDF.model.api.misc.MetadataRequest;
import stirling.software.common.service.CustomPDFDocumentFactory;
import stirling.software.common.service.PdfMetadataService;
import stirling.software.common.util.GeneralUtils;
import stirling.software.common.util.RegexPatternUtils;
import stirling.software.common.service.PdfMetadataService;
import stirling.software.common.util.WebResponseUtils;
import stirling.software.common.util.propertyeditor.StringToMapPropertyEditor;
@@ -170,14 +170,15 @@ public class WatermarkController {
throws IOException {
String resourceDir = "";
PDFont font = new PDType1Font(Standard14Fonts.FontName.HELVETICA);
resourceDir = switch (alphabet) {
case "arabic" -> "static/fonts/NotoSansArabic-Regular.ttf";
case "japanese" -> "static/fonts/Meiryo.ttf";
case "korean" -> "static/fonts/malgun.ttf";
case "chinese" -> "static/fonts/SimSun.ttf";
case "thai" -> "static/fonts/NotoSansThai-Regular.ttf";
default -> "static/fonts/NotoSans-Regular.ttf";
};
resourceDir =
switch (alphabet) {
case "arabic" -> "static/fonts/NotoSansArabic-Regular.ttf";
case "japanese" -> "static/fonts/Meiryo.ttf";
case "korean" -> "static/fonts/malgun.ttf";
case "chinese" -> "static/fonts/SimSun.ttf";
case "thai" -> "static/fonts/NotoSansThai-Regular.ttf";
default -> "static/fonts/NotoSans-Regular.ttf";
};
ClassPathResource classPathResource = new ClassPathResource(resourceDir);
String fileExtension = resourceDir.substring(resourceDir.lastIndexOf("."));
@@ -288,8 +288,8 @@ public class GeneralWebController {
case "eot" -> "embedded-opentype";
case "svg" -> "svg";
default ->
// or throw an exception if an unexpected extension is encountered
"";
// or throw an exception if an unexpected extension is encountered
"";
};
}