renamed module: enterprise > proprietary

updating paths (DOCKER_SECURITY_ENABLE > ADDITIONAL_FEATURES)
This commit is contained in:
Dario Ghunney Ware 2025-05-28 22:43:06 +01:00
parent 38aa75143c
commit b39c81e242
656 changed files with 145946 additions and 1113 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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) {

View File

@ -1,6 +1,6 @@
package stirling.software.common.util;
public class RequestUriUtil {
public class RequestUriUtils {
public static boolean isStaticResource(String requestURI) {
return isStaticResource("", requestURI);

View File

@ -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 {

View File

@ -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

View File

@ -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) {

View File

@ -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"));
}
}

196
enterprise/.gitignore vendored
View File

@ -1,196 +0,0 @@
### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.exe
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
.classpath
.project
version.properties
#### Stirling-PDF Files ###
pipeline/watchedFolders/
pipeline/finishedFolders/
customFiles/
configs/
watchedFolders/
clientWebUI/
!cucumber/
!cucumber/exampleFiles/
!cucumber/exampleFiles/example_html.zip
exampleYmlFiles/stirling/
/testing/file_snapshots
SwaggerDoc.json
# Gradle
.gradle
.lock
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
.apt_generated_test/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project
### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
*.db
/build
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pyo
# Virtual environments
.env*
.venv*
env*/
venv*/
ENV/
env.bak/
venv.bak/
# VS Code
/.vscode/**/*
!/.vscode/settings.json
!/.vscode/extensions.json
# IntelliJ IDEA
.idea/
*.iml
out/
# Ignore Mac DS_Store files
.DS_Store
**/.DS_Store
# cucumber
/cucumber/reports/**
# Certs and Security Files
*.p12
*.pk8
*.pem
*.crt
*.cer
*.cert
*.der
*.key
*.csr
*.kdbx
*.jks
*.asc
# SSH Keys
*.pub
*.priv
id_rsa
id_rsa.pub
id_ecdsa
id_ecdsa.pub
id_ed25519
id_ed25519.pub
.ssh/
*ssh
# cache
.cache
.ruff_cache
.mypy_cache
.pytest_cache
.ipynb_checkpoints
**/jcef-bundle/
# node_modules
node_modules/
*.mjs

View File

@ -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.

View File

@ -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()
}

View File

@ -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");
}
}
}

View File

@ -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);
}
}

View File

@ -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

View File

@ -10,6 +10,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import stirling.software.common.model.ApplicationProperties;
/**

View File

@ -1,4 +1,5 @@
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/configuration/ee/EEAppConfig.java
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/configuration/ee/EEAppConfig.java
package stirling.software.proprietary.security.configuration.ee;
import static stirling.software.proprietary.security.configuration.ee.KeygenLicenseVerifier.License;
@ -7,6 +8,11 @@ package stirling.software.SPDF.EE.configuration;
import static stirling.software.SPDF.EE.configuration.KeygenLicenseVerifier.License;
>>>>>>>> 75ec5e00 (moving security package and relevant files over to proprietary):src/main/java/stirling/software/SPDF/EE/configuration/EEAppConfig.java
========
package stirling.software.SPDF.EE;
import static stirling.software.SPDF.EE.KeygenLicenseVerifier.License;
>>>>>>>> 58c1bccf (renamed module: enterprise > proprietary):stirling-pdf/src/main/java/stirling/software/SPDF/EE/EEAppConfig.java
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,8 +1,12 @@
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/configuration/ee/KeygenLicenseVerifier.java
<<<<<<<< HEAD:proprietary/src/main/java/stirling/software/proprietary/security/configuration/ee/KeygenLicenseVerifier.java
package stirling.software.proprietary.security.configuration.ee;
========
package stirling.software.SPDF.EE.configuration;
>>>>>>>> 75ec5e00 (moving security package and relevant files over to proprietary):src/main/java/stirling/software/SPDF/EE/configuration/KeygenLicenseVerifier.java
========
package stirling.software.SPDF.EE;
>>>>>>>> 58c1bccf (renamed module: enterprise > proprietary):stirling-pdf/src/main/java/stirling/software/SPDF/EE/KeygenLicenseVerifier.java
import java.net.URI;
import java.net.http.HttpClient;

View File

@ -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")

View File

@ -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;

View File

@ -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)

View File

@ -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> {

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -1,15 +1,9 @@
<<<<<<<< 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.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
@ -24,6 +18,12 @@ 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;

View File

@ -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

View File

@ -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> {

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;
@ -18,7 +17,8 @@ public class SessionRegistryConfig {
}
@Bean
public SessionPersistentRegistry sessionPersistentRegistry(SessionRepository sessionRepository) {
public SessionPersistentRegistry sessionPersistentRegistry(
SessionRepository sessionRepository) {
return new SessionPersistentRegistry(sessionRepository);
}
}

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -4,7 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
<<<<<<<< HEAD:proprietary/src/test/java/stirling/software/proprietary/security/configuration/ee/LicenseKeyCheckerTest.java
import static stirling.software.proprietary.security.configuration.ee.KeygenLicenseVerifier.License;
========
import static stirling.software.SPDF.EE.KeygenLicenseVerifier.License;
>>>>>>>> 58c1bccf (renamed module: enterprise > proprietary):stirling-pdf/src/test/java/stirling/software/SPDF/EE/LicenseKeyCheckerTest.java
import java.io.IOException;
import java.nio.file.Files;

View File

@ -0,0 +1,47 @@
multipart.enabled=true
logging.level.org.springframework=WARN
logging.level.org.hibernate=WARN
logging.level.org.eclipse.jetty=WARN
#logging.level.org.springframework.security.saml2=TRACE
#logging.level.org.springframework.security=DEBUG
#logging.level.org.opensaml=DEBUG
#logging.level.stirling.software.SPDF.config.security: DEBUG
logging.level.com.zaxxer.hikari=WARN
spring.jpa.open-in-view=false
server.forward-headers-strategy=NATIVE
server.error.path=/error
server.error.whitelabel.enabled=false
server.error.include-stacktrace=always
server.error.include-exception=true
server.error.include-message=always
#logging.level.org.springframework.web=DEBUG
#logging.level.org.springframework=DEBUG
#logging.level.org.springframework.security=DEBUG
spring.servlet.multipart.max-file-size=2000MB
spring.servlet.multipart.max-request-size=2000MB
server.servlet.session.tracking-modes=cookie
server.servlet.context-path=${SYSTEM_ROOTURIPATH:/}
spring.devtools.restart.enabled=true
spring.devtools.livereload.enabled=true
spring.devtools.restart.exclude=stirling.software.proprietary.security/**
spring.thymeleaf.encoding=UTF-8
spring.web.resources.mime-mappings.webmanifest=application/manifest+json
spring.mvc.async.request-timeout=${SYSTEM_CONNECTIONTIMEOUTMILLISECONDS:1200000}
management.endpoints.web.exposure.include=beans
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
spring.datasource.url=jdbc:h2:file:./configs/stirling-pdf-DB-2.3.232;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=update
server.servlet.session.timeout:30m
# Change the default URL path for OpenAPI JSON
springdoc.api-docs.path=/v1/api-docs
# Set the URL of the OpenAPI JSON for the Swagger UI
springdoc.swagger-ui.url=/v1/api-docs
springdoc.swagger-ui.path=/index.html
posthog.api.key=phc_fiR65u5j6qmXTYL56MNrLZSWqLaDW74OrZH0Insd2xq
posthog.host=https://eu.i.posthog.com

View File

@ -0,0 +1,6 @@
____ _____ ___ ____ _ ___ _ _ ____ ____ ____ _____
/ ___|_ _|_ _| _ \| | |_ _| \ | |/ ___| | _ \| _ \| ___|
\___ \ | | | || |_) | | | || \| | | _ _____| |_) | | | | |_
___) || | | || _ <| |___ | || |\ | |_| |_____| __/| |_| | _|
|____/ |_| |___|_| \_\_____|___|_| \_|\____| |_| |____/|_|
Powered by Spring Boot ${spring-boot.version}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<define name="LOG_PATH" class="stirling.software.SPDF.config.LogbackPropertyLoader" />
<!-- Console Appender -->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- Rolling File Appender for Auth Logs -->
<appender name="AUTHLOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/invalid-auths.log</file>
<encoder>
<pattern>%d %p %c{1} [%thread] %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/auth-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>1</maxHistory>
</rollingPolicy>
</appender>
<!-- Rolling File Appender for General Logs -->
<appender name="GENERAL" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/info.log</file>
<encoder>
<pattern>%d %p %c{1} [%thread] %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/info-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>1</maxHistory>
</rollingPolicy>
</appender>
<!-- Root Logger -->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="GENERAL"/>
</root>
<!-- Specific Logger -->
<logger name="stirling.software.SPDF.config.security.CustomAuthenticationFailureHandler"
level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="AUTHLOG"/>
</logger>
</configuration>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,160 @@
#############################################################################################################
# Welcome to settings file from #
# ____ _____ ___ ____ _ ___ _ _ ____ ____ ____ _____ #
# / ___|_ _|_ _| _ \| | |_ _| \ | |/ ___| | _ \| _ \| ___| #
# \___ \ | | | || |_) | | | || \| | | _ _____| |_) | | | | |_ #
# ___) || | | || _ <| |___ | || |\ | |_| |_____| __/| |_| | _| #
# |____/ |_| |___|_| \_\_____|___|_| \_|\____| |_| |____/|_| #
# #
# Do not comment out any entry, it will be removed on next startup #
# If you want to override with environment parameter follow parameter naming SECURITY_INITIALLOGIN_USERNAME #
#############################################################################################################
security:
enableLogin: false # set to 'true' to enable login
csrfDisabled: false # set to 'true' to disable CSRF protection (not recommended for production)
loginAttemptCount: 5 # lock user account after 5 tries; when using e.g. Fail2Ban you can deactivate the function with -1
loginResetTimeMinutes: 120 # lock account for 2 hours after x attempts
loginMethod: all # Accepts values like 'all' and 'normal'(only Login with Username/Password), 'oauth2'(only Login with OAuth2) or 'saml2'(only Login with SAML2)
initialLogin:
username: '' # initial username for the first login
password: '' # initial password for the first login
oauth2:
enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work)
client:
keycloak:
issuer: '' # URL of the Keycloak realm's OpenID Connect Discovery endpoint
clientId: '' # client ID for Keycloak OAuth2
clientSecret: '' # client secret for Keycloak OAuth2
scopes: openid, profile, email # scopes for Keycloak OAuth2
useAsUsername: preferred_username # field to use as the username for Keycloak OAuth2. Available options are: [email | name | given_name | family_name | preferred_name]
google:
clientId: '' # client ID for Google OAuth2
clientSecret: '' # client secret for Google OAuth2
scopes: email, profile # scopes for Google OAuth2
useAsUsername: email # field to use as the username for Google OAuth2. Available options are: [email | name | given_name | family_name]
github:
clientId: '' # client ID for GitHub OAuth2
clientSecret: '' # client secret for GitHub OAuth2
scopes: read:user # scope for GitHub OAuth2
useAsUsername: login # field to use as the username for GitHub OAuth2. Available options are: [email | login | name]
issuer: '' # set to any Provider that supports OpenID Connect Discovery (/.well-known/openid-configuration) endpoint
clientId: '' # client ID from your Provider
clientSecret: '' # client secret from your Provider
autoCreateUser: true # set to 'true' to allow auto-creation of non-existing users
blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin
useAsUsername: email # default is 'email'; custom fields can be used as the username
scopes: openid, profile, email # specify the scopes for which the application will request permissions
provider: google # set this to your OAuth Provider's name, e.g., 'google' or 'keycloak'
saml2:
enabled: false # Only enabled for paid enterprise clients (enterpriseEdition.enabled must be true)
provider: '' # The name of your Provider
autoCreateUser: true # set to 'true' to allow auto-creation of non-existing users
blockRegistration: false # set to 'true' to deny login with SSO without prior registration by an admin
registrationId: stirling # The name of your Service Provider (SP) app name. Should match the name in the path for your SSO & SLO URLs
idpMetadataUri: https://dev-XXXXXXXX.okta.com/app/externalKey/sso/saml/metadata # The uri for your Provider's metadata
idpSingleLoginUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/sso/saml # The URL for initiating SSO. Provided by your Provider
idpSingleLogoutUrl: https://dev-XXXXXXXX.okta.com/app/dev-XXXXXXXX_stirlingpdf_1/externalKey/slo/saml # The URL for initiating SLO. Provided by your Provider
idpIssuer: '' # The ID of your Provider
idpCert: classpath:okta.cert # The certificate your Provider will use to authenticate your app's SAML authentication requests. Provided by your Provider
privateKey: classpath:saml-private-key.key # Your private key. Generated from your keypair
spCert: classpath:saml-public-cert.crt # Your signing certificate. Generated from your keypair
premium:
key: 00000000-0000-0000-0000-000000000000
enabled: true # Enable license key checks for pro/enterprise features
proFeatures:
database: true # Enable database features
SSOAutoLogin: false
CustomMetadata:
autoUpdateMetadata: false
author: username
creator: Stirling-PDF
producer: Stirling-PDF
googleDrive:
enabled: false
clientId: ''
apiKey: ''
appId: ''
mail:
enabled: false # set to 'true' to enable sending emails
host: smtp.example.com # SMTP server hostname
port: 587 # SMTP server port
username: '' # SMTP server username
password: '' # SMTP server password
from: '' # sender email address
legal:
termsAndConditions: https://www.stirlingpdf.com/terms-and-conditions # URL to the terms and conditions of your application (e.g. https://example.com/terms). Empty string to disable or filename to load from local file in static folder
privacyPolicy: https://www.stirlingpdf.com/privacy-policy # URL to the privacy policy of your application (e.g. https://example.com/privacy). Empty string to disable or filename to load from local file in static folder
accessibilityStatement: '' # URL to the accessibility statement of your application (e.g. https://example.com/accessibility). Empty string to disable or filename to load from local file in static folder
cookiePolicy: '' # URL to the cookie policy of your application (e.g. https://example.com/cookie). Empty string to disable or filename to load from local file in static folder
impressum: '' # URL to the impressum of your application (e.g. https://example.com/impressum). Empty string to disable or filename to load from local file in static folder
system:
defaultLocale: en-US # set the default language (e.g. 'de-DE', 'fr-FR', etc)
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
enableAlphaFunctionality: false # set to enable functionality which might need more testing before it fully goes live (this feature might make no changes)
showUpdate: false # see when a new update is available
showUpdateOnlyAdmin: false # only admins can see when a new update is available, depending on showUpdate it must be set to 'true'
customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template HTML files
tessdataDir: /usr/share/tessdata # path to the directory containing the Tessdata files. This setting is relevant for Windows systems. For Windows users, this path should be adjusted to point to the appropriate directory where the Tessdata files are stored.
enableAnalytics: null # set to 'true' to enable analytics, set to 'false' to disable analytics; for enterprise users, this is set to true
enableUrlToPDF: false # Set to 'true' to enable URL to PDF, INTERNAL ONLY, known security issues, should not be used externally
disableSanitize: false # set to true to disable Sanitize HTML; (can lead to injections in HTML)
datasource:
enableCustomDatabase: false # Enterprise users ONLY, set this property to 'true' if you would like to use your own custom database configuration
customDatabaseUrl: '' # eg jdbc:postgresql://localhost:5432/postgres, set the url for your own custom database connection. If provided, the type, hostName, port and name are not necessary and will not be used
username: postgres # set the database username
password: postgres # set the database password
type: postgresql # the type of the database to set (e.g. 'h2', 'postgresql')
hostName: localhost # the host name to use for the database url. Set to 'localhost' when running the app locally. Set to match the name of the container name of your database container when running the app on a server (Docker configuration)
port: 5432 # set the port number of the database. Ensure this matches the port the database is listening to
name: postgres # set the name of your database. Should match the name of the database you create
customPaths:
pipeline:
watchedFoldersDir: '' #Defaults to /pipeline/watchedFolders
finishedFoldersDir: '' #Defaults to /pipeline/finishedFolders
operations:
weasyprint: '' #Defaults to /opt/venv/bin/weasyprint
unoconvert: '' #Defaults to /opt/venv/bin/unoconvert
fileUploadLimit: '' # Defaults to "". No limit when string is empty. Set a number, between 0 and 999, followed by one of the following strings to set a limit. "KB", "MB", "GB".
ui:
appName: '' # application's visible name
homeDescription: '' # short description or tagline shown on the homepage
appNameNavbar: '' # name displayed on the navigation bar
languages: [] # If empty, all languages are enabled. To display only German and Polish ["de_DE", "pl_PL"]. British English is always enabled.
endpoints:
toRemove: [] # list endpoints to disable (e.g. ['img-to-pdf', 'remove-pages'])
groupsToRemove: [] # list groups to disable (e.g. ['LibreOffice'])
metrics:
enabled: true # 'true' to enable Info APIs (`/api/*`) endpoints, 'false' to disable
# Automatically Generated Settings (Do Not Edit Directly)
AutomaticallyGenerated:
key: example
UUID: example
appVersion: 0.35.0
processExecutor:
sessionLimit: # Process executor instances limits
libreOfficeSessionLimit: 1
pdfToHtmlSessionLimit: 1
qpdfSessionLimit: 4
tesseractSessionLimit: 1
pythonOpenCvSessionLimit: 8
weasyPrintSessionLimit: 16
installAppSessionLimit: 1
calibreSessionLimit: 1
timeoutMinutes: # Process executor timeout in minutes
libreOfficetimeoutMinutes: 30
pdfToHtmltimeoutMinutes: 20
pythonOpenCvtimeoutMinutes: 30
weasyPrinttimeoutMinutes: 30
installApptimeoutMinutes: 60
calibretimeoutMinutes: 30
tesseractTimeoutMinutes: 30

File diff suppressed because it is too large Load Diff

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