From b7372c54a6cc323ccae3a8135a5ff0d22fa57d62 Mon Sep 17 00:00:00 2001
From: hamdirahalpartner-del
Date: Wed, 18 Nov 2026 14:26:37 +0100
Subject: [PATCH] refactor(idp-core)!: migrate API errors to RFC 7807
ProblemDetail
Signed-off-by: hamdirahalpartner-del
---
.../scripts/check_flyway_migration_order.sh | 24 +-
.github/scripts/check_navigation.sh | 6 +-
.github/scripts/extract_specs.sh | 8 +-
.github/scripts/summarize_owasp.sh | 8 +-
.github/workflows/basic_code_checks.yml | 28 +-
.github/workflows/build_and_push.yml | 4 +-
.github/workflows/copilot-setup-steps.yml | 6 +-
.github/workflows/deploy_docs.yml | 4 +-
.github/workflows/lint_pull_request_title.yml | 2 +-
.github/workflows/zap_security_check.yml | 4 +-
.github/workflows/zap_security_report.yml | 2 +-
.gitignore | 2 +-
.mvn/wrapper/maven-wrapper.properties | 7 +-
Dockerfile | 19 +-
docs/src/concepts/authentication.md | 1028 ++++----------
docs/src/concepts/entities.md | 24 +
docs/src/concepts/entity-filtering.md | 8 +-
docs/src/concepts/entity-templates.md | 3 +
docs/src/concepts/relations.md | 8 +
.../src/contributing/code/code-conventions.md | 19 +-
.../code/domain-infrastructure.md | 6 +-
.../contributing/code/exception-handling.md | 50 +-
docs/src/deployment/configuration.md | 50 +-
docs/src/deployment/docker.md | 108 +-
docs/src/deployment/observability.md | 366 ++---
docs/src/features/data-integration.md | 8 +-
docs/src/features/entity-dynamic-mapping.md | 15 +
docs/src/features/webhooks.md | 51 +-
docs/src/getting-started/configuration.md | 14 +-
docs/src/static/swagger.yaml | 917 +++++++------
docs/uv.lock | 25 +-
flyway-migration-order-report.md | 0
mvnw | 8 +-
mvnw.cmd | 412 +++---
pom.xml | 66 +-
.../domain/constant/JsltConstraints.java | 21 +
.../domain/constant/SearchConstraints.java | 10 +-
.../domain/constant/ValidationMessages.java | 14 +-
.../PrincipalNotAuthorizedException.java | 22 +
.../authorization/AuthorizationAction.java | 6 +
.../authorization/AuthorizationMode.java | 6 +
.../authorization/AuthorizationPolicy.java | 23 +
.../authorization/AuthorizationRequest.java | 26 +
.../authorization/AuthorizationResource.java | 28 +
.../enums/RelationTargetValidationMode.java | 10 +
.../webhook/WebhookSecurity.java | 5 +-
.../WebhookSecurityValidationPolicy.java | 7 +
.../model/search/PaginationCriteria.java | 28 +
.../domain/model/search/SortCriteria.java | 9 +
.../port/audit/AuditIdentityProviderPort.java | 15 +
.../GlobalAuthorizationService.java | 84 ++
.../service/entity/EntityAuditService.java | 2 -
.../domain/service/entity/EntityService.java | 63 +-
.../entity/EntityValidationService.java | 26 +-
.../entity_graph/EntityGraphService.java | 28 +-
.../PrincipalProvisioningService.java | 53 +-
.../relation/RelationValidationService.java | 263 +++-
.../service/search/SortParameterParser.java | 58 +
.../webhook/WebhookConnectorService.java | 14 +-
.../WebhookConnectorValidationService.java | 6 +-
.../WebhookSecurityValidationService.java | 19 +-
.../api/auth/AuthorizationRequestFactory.java | 114 ++
.../adapters/api/auth/AuthorizedResource.java | 25 +
.../api/auth/GlobalAuthorizationFilter.java | 130 ++
.../api/auth/JitProvisioningFilter.java | 128 +-
.../api/auth/ProvisionedPrincipalContext.java | 13 +
.../adapters/api/auth/RequestAuthorizer.java | 63 +
.../api/auth/UnifiedUserProvider.java | 44 +-
.../api/auth/UserIdentityProvider.java | 6 -
.../AuthenticationProperties.java | 85 +-
.../AuthorizationConfiguration.java | 43 +
.../AuthorizationProperties.java | 24 +
.../api/configuration/JwtConfiguration.java | 59 +-
.../PrincipalExtractionProperties.java | 43 +
.../PrincipalProvisioningMode.java | 6 +
.../PrincipalProvisioningProperties.java | 12 +
.../RelationValidationConfiguration.java | 24 +
.../RelationValidationProperties.java | 12 +
.../api/configuration/SearchProperties.java | 20 +
.../configuration/SecurityConfiguration.java | 15 +-
.../configuration/SecurityRoleProperties.java | 20 -
.../configuration/SwaggerConfiguration.java | 31 +
.../api/configuration/SwaggerDescription.java | 25 +-
.../ValidatingPageableArgumentResolver.java | 63 +
.../api/configuration/WebConfiguration.java | 19 +
.../FallbackDenyAllFilterChainConfig.java | 67 +
.../security/chains/JwtFilterChainConfig.java | 7 +-
.../chains/MockFilterChainConfig.java | 27 +-
.../chains/OAuth2LoginFilterChainConfig.java | 9 +-
.../api/controller/AuditController.java | 16 +-
.../api/controller/EntityController.java | 109 +-
.../EntityDynamicMappingController.java | 59 +-
.../api/controller/EntityGraphController.java | 9 +-
.../controller/EntityTemplateController.java | 33 +-
...InboundWebhookConfigurationController.java | 17 +-
.../api/controller/PrincipalController.java | 16 +-
.../api/dto/in/EntitySearchRequestDtoIn.java | 7 +-
.../InboundWebhookSecurityContractDtoIn.java | 13 +-
.../api/dto/out/entity/EntitySummaryDto.java | 20 +-
.../MissingPrincipalIdentifierException.java | 22 +
.../api/handler/ApiErrorResponseWriter.java | 55 +
.../api/handler/ApiExceptionHandler.java | 839 ++++--------
.../webhook/InboundWebhookMapper.java | 17 +-
.../EntityDtoOutFromEntityNodeMapper.java | 56 +-
.../entity_template/EntityTemplateMapper.java | 1 -
.../api/principal/PrincipalExtractor.java | 22 +-
.../JwtPrincipalExtractionStrategy.java | 214 +--
...OAuth2UserPrincipalExtractionStrategy.java | 22 +-
.../entity_mapping/jslt/JsltEngine.java | 53 +-
.../jslt/JsltMappingEngineAdapter.java | 47 +-
.../configuration/IngestionConstants.java | 11 +-
.../WebhookExceptionHandlerHelper.java | 54 +-
.../processor/IngestionProcessor.java | 33 +-
.../processor/SecurityProcessor.java | 34 +-
.../security/JwtBearerSecurityValidator.java | 55 +-
.../WebhookSecurityConfiguration.java | 11 +-
.../security/WebhookSecurityProperties.java | 6 +-
.../persistence/PostgresEntityAdapter.java | 32 +-
.../audit/UserIdentityProviderHolder.java | 14 +-
src/main/resources/application-local.yml | 28 +-
src/main/resources/application.yml | 102 +-
...add_entity_relations_relation_id_index.sql | 6 +
.../idp_core/AbstractIntegrationTest.java | 21 +-
.../idp_core/SecurityConfigurationTest.java | 23 +-
.../HexagonalArchitectureTest.java | 2 +-
.../MaintainabilityArchitectureTest.java | 39 +
.../GlobalAuthorizationServiceTest.java | 367 +++++
.../service/entity/EntityServiceTest.java | 116 +-
.../entity/EntityValidationServiceTest.java | 40 +-
.../entity_graph/EntityGraphServiceTest.java | 29 +
.../principal/PrincipalExtractorTest.java | 361 ++---
.../PrincipalProvisioningServiceTest.java | 54 +-
.../RelationValidationServiceTest.java | 216 ++-
.../search/SortParameterParserTest.java | 65 +
.../webhook/WebhookConnectorServiceTest.java | 7 +-
...WebhookConnectorValidationServiceTest.java | 35 +-
.../WebhookSecurityValidationServiceTest.java | 70 +-
.../auth/AuthorizationRequestFactoryTest.java | 96 ++
.../auth/GlobalAuthorizationFilterTest.java | 222 +++
.../api/auth/JitProvisioningFilterTest.java | 224 ++-
.../api/auth/TestHandlerMappings.java | 40 +
.../api/auth/UnifiedUserProviderTest.java | 97 +-
.../AuthenticationPropertiesTest.java | 30 +
.../AuthorizationConfigurationTest.java | 49 +
.../configuration/JwtConfigurationTest.java | 73 +
.../PrincipalExtractionPropertiesTest.java | 49 +
.../RelationValidationConfigurationTest.java | 47 +
.../SecurityRolePropertiesTest.java | 34 -
.../SwaggerConfigurationTest.java | 163 +++
.../FallbackDenyAllFilterChainConfigTest.java | 62 +
.../chains/JwtFilterChainConfigTest.java | 22 +
.../chains/MockFilterChainConfigTest.java | 23 +-
.../OAuth2LoginFilterChainConfigTest.java | 23 +
.../chains/PublicFilterChainConfigTest.java | 5 +-
.../api/controller/AuditControllerTest.java | 21 +-
.../api/controller/EntityControllerTest.java | 298 +++-
.../EntityDynamicMappingControllerTest.java | 177 ++-
...namicMappingDeletionAuthorizationTest.java | 97 ++
.../EntityTemplateControllerTest.java | 187 ++-
...nboundWebhookManagementControllerTest.java | 181 ++-
.../controller/PrincipalControllerTest.java | 18 +-
.../handler/ApiErrorResponseWriterTest.java | 47 +
.../api/handler/ApiExceptionHandlerTest.java | 1213 +++++++++--------
.../EntityDtoOutFromEntityNodeMapperTest.java | 67 +
.../webhook/InboundWebhookMapperTest.java | 100 +-
.../entity_mapping/jslt/JsltEngineTest.java | 97 ++
.../jslt/JsltMappingEngineAdapterTest.java | 45 +
.../InboundWebhookIngestionRouteTest.java | 61 +-
.../WebhookExceptionHandlerHelperTest.java | 65 +
.../processor/IngestionProcessorTest.java | 41 +
.../JwtBearerSecurityValidatorTest.java | 53 +-
.../WebhookJwtDecoderProviderTest.java | 4 +-
.../PostgresEntityAdapterTest.java | 23 +
.../audit/CustomRevisionListenerTest.java | 4 +-
.../audit/UserIdentityProviderHolderTest.java | 45 +-
src/test/resources/application-test.yml | 21 +-
.../db/test/R__1_Insert_test_data.sql | 6 +-
.../R__6_insert_principal_user_for_test.sql | 52 +
...ity_optional_missing_relation_target.json} | 0
179 files changed, 8538 insertions(+), 4412 deletions(-)
delete mode 100644 flyway-migration-order-report.md
create mode 100644 src/main/java/com/decathlon/idp_core/domain/constant/JsltConstraints.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/exception/authorization/PrincipalNotAuthorizedException.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationAction.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationMode.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationPolicy.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationRequest.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationResource.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/enums/RelationTargetValidationMode.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurityValidationPolicy.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/model/search/SortCriteria.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/port/audit/AuditIdentityProviderPort.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/service/authorization/GlobalAuthorizationService.java
create mode 100644 src/main/java/com/decathlon/idp_core/domain/service/search/SortParameterParser.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizationRequestFactory.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizedResource.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/GlobalAuthorizationFilter.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/ProvisionedPrincipalContext.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/RequestAuthorizer.java
delete mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UserIdentityProvider.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthorizationConfiguration.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthorizationProperties.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/PrincipalExtractionProperties.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/PrincipalProvisioningMode.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/PrincipalProvisioningProperties.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/RelationValidationConfiguration.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/RelationValidationProperties.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/SearchProperties.java
delete mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/SecurityRoleProperties.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/ValidatingPageableArgumentResolver.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/security/chains/FallbackDenyAllFilterChainConfig.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/exception/MissingPrincipalIdentifierException.java
create mode 100644 src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/handler/ApiErrorResponseWriter.java
create mode 100644 src/main/resources/db/migration/V7_2__add_entity_relations_relation_id_index.sql
create mode 100644 src/test/java/com/decathlon/idp_core/domain/service/authorization/GlobalAuthorizationServiceTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/domain/service/search/SortParameterParserTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizationRequestFactoryTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/GlobalAuthorizationFilterTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/TestHandlerMappings.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthenticationPropertiesTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthorizationConfigurationTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/JwtConfigurationTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/PrincipalExtractionPropertiesTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/RelationValidationConfigurationTest.java
delete mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/SecurityRolePropertiesTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/SwaggerConfigurationTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/security/chains/FallbackDenyAllFilterChainConfigTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/controller/EntityDynamicMappingDeletionAuthorizationTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/handler/ApiErrorResponseWriterTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/api/mapper/entity/EntityDtoOutFromEntityNodeMapperTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/entity_mapping/jslt/JsltEngineTest.java
create mode 100644 src/test/java/com/decathlon/idp_core/infrastructure/adapters/ingestion/exception_handler/WebhookExceptionHandlerHelperTest.java
create mode 100644 src/test/resources/db/test/R__6_insert_principal_user_for_test.sql
rename src/test/resources/integration_test/json/entity/v1/{postEntity_400_relation_target_entity_does_not_exist.json => postEntity_optional_missing_relation_target.json} (100%)
diff --git a/.github/scripts/check_flyway_migration_order.sh b/.github/scripts/check_flyway_migration_order.sh
index b8a7a019..349ddd24 100755
--- a/.github/scripts/check_flyway_migration_order.sh
+++ b/.github/scripts/check_flyway_migration_order.sh
@@ -58,7 +58,7 @@ MODIFIED_FILES=$(git diff --name-only --diff-filter=M "$BASE_REF" HEAD -- "$MIGR
BASE_MAX_FILE=""
BASE_MAX_KEY="0"
while IFS= read -r file; do
- [ -z "$file" ] && continue
+ [[ -z "$file" ]] && continue
if [[ ! $(basename "$file") =~ $NAME_PATTERN ]]; then
continue
fi
@@ -69,13 +69,13 @@ while IFS= read -r file; do
fi
done <<< "$BASE_FILES"
-if [ -n "$BASE_MAX_FILE" ]; then
+if [[ -n "$BASE_MAX_FILE" ]]; then
printf -- "Highest migration on %s: %s (version %s)\n" "$BASE_REF" "$(basename "$BASE_MAX_FILE")" "$(version_label "$BASE_MAX_FILE")"
else
printf -- "No migration found on %s\n" "$BASE_REF"
fi
-if [ -z "$ADDED_FILES" ] && [ -z "$DELETED_FILES" ] && [ -z "$MODIFIED_FILES" ]; then
+if [[ -z "$ADDED_FILES" ]] && [[ -z "$DELETED_FILES" ]] && [[ -z "$MODIFIED_FILES" ]]; then
printf -- "No migration change detected in this pull request.\n"
: > "$REPORT_FILE"
exit 0
@@ -83,13 +83,13 @@ fi
# Rule 1: an already merged migration must never be modified or deleted
while IFS= read -r file; do
- [ -z "$file" ] && continue
+ [[ -z "$file" ]] && continue
ERRORS+=("\`$file\` is modified. A migration already merged on \`$BASE_REF\` has been applied on running environments: its checksum is frozen. Create a new migration instead.")
EXIT_CODE=1
done <<< "$MODIFIED_FILES"
while IFS= read -r file; do
- [ -z "$file" ] && continue
+ [[ -z "$file" ]] && continue
ERRORS+=("\`$file\` is deleted or renamed. A migration already merged on \`$BASE_REF\` must be kept as is. Create a new migration instead.")
EXIT_CODE=1
done <<< "$DELETED_FILES"
@@ -97,7 +97,7 @@ done <<< "$DELETED_FILES"
# Rule 2: added migrations must be well named and strictly above the highest merged version
SEEN_KEYS=()
while IFS= read -r file; do
- [ -z "$file" ] && continue
+ [[ -z "$file" ]] && continue
name=$(basename "$file")
if [[ ! $name =~ $NAME_PATTERN ]]; then
@@ -109,14 +109,14 @@ while IFS= read -r file; do
key=$(version_key "$file")
label=$(version_label "$file")
- if [ -n "$BASE_MAX_FILE" ] && awk -v a="$key" -v b="$BASE_MAX_KEY" 'BEGIN { exit !(a <= b) }'; then
+ if [[ -n "$BASE_MAX_FILE" ]] && awk -v a="$key" -v b="$BASE_MAX_KEY" 'BEGIN { exit !(a <= b) }'; then
ERRORS+=("\`$name\` (version \`$label\`) is lower than or equal to \`$(basename "$BASE_MAX_FILE")\` (version \`$(version_label "$BASE_MAX_FILE")\`) already merged on \`$BASE_REF\`. Renumber it above \`$(version_label "$BASE_MAX_FILE")\` so Flyway applies it on every environment.")
EXIT_CODE=1
continue
fi
for seen in ${SEEN_KEYS[@]+"${SEEN_KEYS[@]}"}; do
- if [ "${seen%%:*}" = "$key" ]; then
+ if [[ "${seen%%:*}" = "$key" ]]; then
ERRORS+=("\`$name\` uses version \`$label\` already used by \`${seen#*:}\` in this pull request. Flyway versions must be unique.")
EXIT_CODE=1
fi
@@ -128,11 +128,11 @@ done <<< "$ADDED_FILES"
# Build the markdown report
{
- if [ "$EXIT_CODE" -eq 0 ]; then
+ if [[ "$EXIT_CODE" -eq 0 ]]; then
printf -- "No Flyway migration ordering issue detected.\n\n"
printf -- "| Added migration | Version |\n|---|---|\n"
while IFS= read -r file; do
- [ -z "$file" ] && continue
+ [[ -z "$file" ]] && continue
printf -- "| \`%s\` | \`%s\` |\n" "$(basename "$file")" "$(version_label "$file")"
done <<< "$ADDED_FILES"
else
@@ -141,7 +141,7 @@ done <<< "$ADDED_FILES"
printf -- "- %s\n" "$error"
done
printf -- "\nHighest migration currently on \`%s\`: " "$BASE_REF"
- if [ -n "$BASE_MAX_FILE" ]; then
+ if [[ -n "$BASE_MAX_FILE" ]]; then
printf -- "\`%s\`\n" "$(basename "$BASE_MAX_FILE")"
else
printf -- "none\n"
@@ -151,7 +151,7 @@ done <<< "$ADDED_FILES"
cat "$REPORT_FILE"
-if [ "$EXIT_CODE" -ne 0 ]; then
+if [[ "$EXIT_CODE" -ne 0 ]]; then
for error in "${ERRORS[@]}"; do
printf -- "::error:: %s\n" "$(printf -- '%s' "$error" | tr -d '`')"
done
diff --git a/.github/scripts/check_navigation.sh b/.github/scripts/check_navigation.sh
index 0af04906..47c2d3e5 100755
--- a/.github/scripts/check_navigation.sh
+++ b/.github/scripts/check_navigation.sh
@@ -12,7 +12,7 @@ echo "🔍 Checking for broken navigation links in ${SITE_DIR}..."
# Find files with 'none' placeholders in navigation
while IFS= read -r file; do
- if [ -n "$file" ]; then
+ if [[ -n "$file" ]]; then
# Get line numbers where 'none' appears in md-ellipsis context
line_nums=$(grep -n "^\s*none\s*$" "$file" | cut -d: -f1 2>/dev/null || true)
@@ -39,7 +39,7 @@ while IFS= read -r file; do
fi
done < <(find "$SITE_DIR" -name "*.html" -type f)
-if [ $EXIT_CODE -eq 0 ]; then
+if [[ $EXIT_CODE -eq 0 ]]; then
echo "✅ No broken navigation links found"
else
echo ""
@@ -54,7 +54,7 @@ else
# Try to find it in the source directory
found_files=$(find "$SRC_DIR" -name "$filename" 2>/dev/null || true)
- if [ -n "$found_files" ]; then
+ if [[ -n "$found_files" ]]; then
echo "$found_files" | while read -r found; do
echo " ❌ $found"
done
diff --git a/.github/scripts/extract_specs.sh b/.github/scripts/extract_specs.sh
index 5ad8dea4..62cf84fd 100755
--- a/.github/scripts/extract_specs.sh
+++ b/.github/scripts/extract_specs.sh
@@ -13,7 +13,7 @@ PR_BRANCH=$(git rev-parse --abbrev-ref HEAD)
git fetch origin main
git checkout origin/main
# 1. Check if the static swagger file exists on the 'main' branch
-if [ -f "$MAIN_SWAGGER" ]; then
+if [[ -f "$MAIN_SWAGGER" ]]; then
# If it exists, copy it as the reference spec
cp "$MAIN_SWAGGER" "specs/static-swagger-main.yaml"
else
@@ -22,7 +22,7 @@ else
mvn clean package -B
JAR_PATH=$(find target -maxdepth 1 -name "*.jar" | head -n 1)
- if [ -z "$JAR_PATH" ]; then
+ if [[ -z "$JAR_PATH" ]]; then
printf -- "::error:: No JAR found in target/ folder.\n"
exit 1
fi
@@ -39,7 +39,7 @@ else
printf -- "Waiting for API endpoint (%s) to be reachable...\n" "$API_URL"
- while [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; do
+ while [[ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]]; do
# Use curl with --fail and --silent to check for a successful connection (HTTP 2xx response)
if curl --fail --silent -o /dev/null "$API_URL"; then
printf -- "API is up after %d seconds.\n" "$((ATTEMPT * SLEEP_TIME))"
@@ -50,7 +50,7 @@ else
ATTEMPT=$((ATTEMPT + 1))
done
# Check if the maximum number of attempts was reached (timeout)
- if [ "$ATTEMPT" -eq "$MAX_ATTEMPTS" ]; then
+ if [[ "$ATTEMPT" -eq "$MAX_ATTEMPTS" ]]; then
printf -- "::error:: Application failed to start and expose Swagger endpoint after %d attempts.\n" "$MAX_ATTEMPTS"
printf -- "Swagger endpoint unreachable. Dumping logs:\n"
pgrep -a java || printf -- "No Java process found\n"
diff --git a/.github/scripts/summarize_owasp.sh b/.github/scripts/summarize_owasp.sh
index 561bc043..e2d740d6 100755
--- a/.github/scripts/summarize_owasp.sh
+++ b/.github/scripts/summarize_owasp.sh
@@ -6,19 +6,19 @@ SUMMARY_FILE="${GITHUB_STEP_SUMMARY:-/dev/stdout}"
echo "### OWASP Dependency Check Summary" >> "$SUMMARY_FILE"
SARIF_REPORT=""
-if [ -f "$PWD/target/security-reports/dependency-check-report.sarif" ]; then
+if [[ -f "$PWD/target/security-reports/dependency-check-report.sarif" ]]; then
SARIF_REPORT="$PWD/target/security-reports/dependency-check-report.sarif"
-elif [ -f "$PWD/target/dependency-check-report.sarif" ]; then
+elif [[ -f "$PWD/target/dependency-check-report.sarif" ]]; then
SARIF_REPORT="$PWD/target/dependency-check-report.sarif"
fi
-if [ -n "$SARIF_REPORT" ]; then
+if [[ -n "$SARIF_REPORT" ]]; then
echo "| Vulnerability | CVSS | Package |" >> "$SUMMARY_FILE"
echo "|:--|:--:|:--|" >> "$SUMMARY_FILE"
if command -v jq >/dev/null 2>&1; then
VULN_COUNT=$(jq '.runs[].results | length' "$SARIF_REPORT" | awk '{s+=$1} END {print s}')
- if [ "$VULN_COUNT" -gt 0 ]; then
+ if [[ "$VULN_COUNT" -gt 0 ]]; then
jq -r '.runs[].results[] | [.ruleId, (.properties.cvssScore // "N/A"), (.message.text | split("\n")[0])] | @tsv' "$SARIF_REPORT" |
while IFS=$'\t' read -r ruleId cvss message; do
printf "| %s | %s | %s |\n" "$ruleId" "$cvss" "$message" >> "$SUMMARY_FILE"
diff --git a/.github/workflows/basic_code_checks.yml b/.github/workflows/basic_code_checks.yml
index 945ff648..0d0d63fb 100644
--- a/.github/workflows/basic_code_checks.yml
+++ b/.github/workflows/basic_code_checks.yml
@@ -24,7 +24,7 @@ jobs:
- name: Lint GitHub Actions Workflows
if: github.event_name == 'pull_request'
- uses: reviewdog/action-actionlint@13465d022aa41c282f730be17574b5ce692d0186 # v1.78.1
+ uses: reviewdog/action-actionlint@7abf25e1607ec65838b73d0484ff31f8e9499d80 # v1.81.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
@@ -46,7 +46,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25
@@ -78,7 +78,7 @@ jobs:
${{ runner.os }}-maven-
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25
@@ -108,7 +108,7 @@ jobs:
label: code-coverage/jacoco
- name: Upload built jar
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: idp-core-jar
path: target/
@@ -130,13 +130,13 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download built jar
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: idp-core-jar
path: target
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25
@@ -158,7 +158,7 @@ jobs:
${{ runner.os }}-owasp-dc-data-
- name: Upload SpotBugs XML
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: spotbugs-report
path: target/spotbugsXml.xml
@@ -192,13 +192,13 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download built jar
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: idp-core-jar
path: target
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25
@@ -213,7 +213,7 @@ jobs:
SPRING_JPA_DATABASE_PLATFORM: 'org.hibernate.dialect.H2Dialect'
SPRING_FLYWAY_ENABLED: 'false'
SPRING_JPA_HIBERNATE_DDL_AUTO: 'none'
- SPRING_DATASOURCE_URL: 'jdbc:h2:mem'
+ SPRING_DATASOURCE_URL: 'jdbc:h2:mem:idp_core;DB_CLOSE_DELAY=-1'
SPRING_DATASOURCE_DRIVER_CLASS_NAME: 'org.h2.Driver'
run: |
mkdir -p specs
@@ -231,7 +231,7 @@ jobs:
kill "$API_PID"
- name: Upload static swagger declared by developer
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: swagger-declared
path: specs
@@ -261,14 +261,14 @@ jobs:
fetch-depth: 0
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25
cache: maven
- name: Download swagger declared artifact
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: swagger-declared
path: specs
@@ -452,7 +452,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download built jar
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: idp-core-jar
path: target
diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml
index f2df7fc0..a3dbfd3a 100644
--- a/.github/workflows/build_and_push.yml
+++ b/.github/workflows/build_and_push.yml
@@ -24,7 +24,7 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.release.tag_name || github.event.inputs.tag_name }}
- name: Set up JDK 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: 'temurin'
java-version: 25
@@ -34,7 +34,7 @@ jobs:
id: compile
run: mvn clean verify
- name: Login to Docker Hub
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
+ uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml
index e0553814..b7843ebb 100644
--- a/.github/workflows/copilot-setup-steps.yml
+++ b/.github/workflows/copilot-setup-steps.yml
@@ -23,19 +23,19 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: temurin
java-version: 25
cache: maven
- name: Set up Python
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.14'
- name: Install uv
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: false
diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml
index 703d137a..21d99134 100644
--- a/.github/workflows/deploy_docs.yml
+++ b/.github/workflows/deploy_docs.yml
@@ -35,12 +35,12 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
+ uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.14'
- name: Install uv
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
enable-cache: false
diff --git a/.github/workflows/lint_pull_request_title.yml b/.github/workflows/lint_pull_request_title.yml
index 993b1c34..62a0e7b3 100644
--- a/.github/workflows/lint_pull_request_title.yml
+++ b/.github/workflows/lint_pull_request_title.yml
@@ -20,7 +20,7 @@ jobs:
steps:
- name: Check PR title convention
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
+ uses: amannn/action-semantic-pull-request@2252a14e810aa9b85c2d560bd7070c802206ecf6 # v6.1.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
diff --git a/.github/workflows/zap_security_check.yml b/.github/workflows/zap_security_check.yml
index 5bc080a0..5642399c 100644
--- a/.github/workflows/zap_security_check.yml
+++ b/.github/workflows/zap_security_check.yml
@@ -56,7 +56,7 @@ jobs:
# Step B: Setup JDK
- name: Setup Java 25
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
+ uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0
with:
distribution: 'temurin'
java-version: '25'
@@ -78,7 +78,7 @@ jobs:
echo "${{ github.event.issue.number }}" > target/zap-reports/pr_number.txt
- name: Upload ZAP Report Artifact
if: always()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: zap-scan-report
path: target/zap-reports/
diff --git a/.github/workflows/zap_security_report.yml b/.github/workflows/zap_security_report.yml
index aabe6a60..f1d8c964 100644
--- a/.github/workflows/zap_security_report.yml
+++ b/.github/workflows/zap_security_report.yml
@@ -20,7 +20,7 @@ jobs:
steps:
- name: Download ZAP Report Artifact
if: github.event.workflow_run.event == 'issue_comment'
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: zap-scan-report
path: zap-reports
diff --git a/.gitignore b/.gitignore
index fee3e653..46a6e700 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,7 +44,7 @@ buildNumber.properties
.env
application-secret.*
-
+flyway-migration-order-report.md
# BlueJ files
*.ctxt
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
index 308007b5..c179c80b 100644
--- a/.mvn/wrapper/maven-wrapper.properties
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -1,2 +1,5 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
+wrapperVersion=3.3.4
+distributionType=bin
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.10.0/apache-maven-3.10.0-bin.zip
+distributionSha256Sum=1f6d9909266510f039f59aa0e13dcd2c66da85f043e56276e41f2918f8bddaff
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar
diff --git a/Dockerfile b/Dockerfile
index 7dd4bd05..e36042e2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,15 +1,18 @@
-FROM eclipse-temurin:25-jre-alpine
+FROM eclipse-temurin:25-jre-jammy
-ENV PORT=8080
+ENV SERVER_PORT=8080 \
+ PORT=8080
-RUN apk add --no-cache shadow && \
- groupadd -r idp-core-group && \
- useradd --no-log-init -r -g idp-core-group idp-core-user && \
- apk del shadow
+WORKDIR /opt
-USER idp-core-user:idp-core-group
+RUN groupadd -r -g 1001 idp-core-group && \
+ useradd -r -u 1001 -g idp-core-group -s /bin/false idp-core-user
-WORKDIR /opt
COPY ./target/idp-core*.jar /opt/app.jar
+USER 1001:1001
+
+HEALTHCHECK --interval=30s --timeout=5s --start-period=25s --retries=3 \
+ CMD wget -q --spider "http://localhost:${SERVER_PORT}/actuator/health" || exit 1
+
ENTRYPOINT ["java", "-jar", "/opt/app.jar"]
diff --git a/docs/src/concepts/authentication.md b/docs/src/concepts/authentication.md
index 15de6cf7..5a841b3a 100644
--- a/docs/src/concepts/authentication.md
+++ b/docs/src/concepts/authentication.md
@@ -1,897 +1,405 @@
---
-title: Authentication and Security Filters
-description: Learn how authentication, security filters, and JWT claim mappings work in IDP-Core. Understand the filter chain architecture and how to add custom authentication methods.
+title: Authentication and Authorization
+description: Supported authentication modes, how to enable them, what a principal is, how principals are provisioned, and how authorization works.
---
-IDP-Core implements a flexible, modular authentication system based on Spring Security's filter chain architecture. This
-document explains how the system works, how to configure it for different Identity Providers, and how to extend it with
-custom authentication methods.
-
-## Architecture Overview
-
-The authentication system consists of four main components working together:
+IDP-Core separates three concerns. **Authentication** proves who calls the API. **Principal provisioning** turns that
+identity into a catalog record. **Authorization** decides what that principal can do.
```mermaid
-graph LR
- A["HTTP Request"] --> B["Security Filter Chain"]
- B --> C["Authentication Filter JWT/API Key/Mock"]
- C --> D["PrincipalExtractor Strategy Pattern"]
- D --> E["JitProvisioningFilter Auto-Provisioning"]
- E --> F["Domain Service Authorization"]
- F --> G["Controller Business Logic"]
-```
-
-- **Security Filter Chain**: Routes requests through configured authentication mechanisms in order
-- **Authentication Filters**: Extract credentials (JWT tokens, API keys, etc.) and create `Authentication` objects
-- **Principal Extractor**: Converts authentication tokens into domain `PrincipalInfo` objects
-- **JIT Provisioning Filter**: Automatically creates principals in the database on first authentication
-- **Domain Services**: Enforce business rules and authorization checks
-
-## Filter Chain Architecture
-
-IDP-Core uses a **multi-chain architecture** where each authentication mechanism has its own dedicated
-`SecurityFilterChain` with a specific `@Order`. This allows:
-
-- **Independent configuration** of each mechanism without interference
-- **Environment-specific activation** using `@ConditionalOnProperty`
-- **Clear precedence rules** via ordering (lower numbers evaluate first)
-- **Flexible extensibility** for adding new mechanisms
-
-### Filter Chain Ordering
-
-Chains are evaluated in strict order of `@Order` value:
-
-| Order | Chain | Purpose |
-|-------|-----------------------------------------|-------------------------------------------------------------------------|
-| 1 | `PublicFilterChainConfig` | Permits public paths without authentication (actuator, swagger, health) |
-| 2 | `JwtFilterChainConfig` | OAuth2 resource server with JWT validation |
-| 3 | `ApiKeyFilterChainConfig` | Simple API key authentication for webhooks and service-to-service |
-| 4+ | Future / Other authentication mechanism | Your custom authentication mechanisms |
-| last | `MockFilterChainConfig` | Local development only - generates mock JWT tokens |
-
-When a request arrives, Spring Security evaluates chains in order. The first chain whose `securityMatcher` matches the
-request path handles that request. If no `securityMatcher` is specified, the chain protects all remaining unmatched
-paths.
-
-### Public Filter Chain (Order 1)
-
-```java
-
-@Configuration
-@Order(1)
-public class PublicFilterChainConfig {
- @Bean
- public SecurityFilterChain publicFilterChain(HttpSecurity http) throws Exception {
- http.securityMatcher("/", "/actuator/**", "/swagger-ui/**", "/v3/api-docs/**")
- .authorizeHttpRequests(auth -> auth.anyRequest().permitAll())
- .csrf(csrf -> csrf.disable());
- return http.build();
- }
-}
+flowchart LR
+ A[HTTP request] --> B[Authentication mode JWT / OAuth2 login / Mock]
+ B --> C[Principal extraction PrincipalInfo]
+ C --> D[Provisioning JIT or LINK_ONLY]
+ D --> E[Global authorization policy]
+ E --> F[Controller]
```
-The public chain explicitly permits these paths without any authentication. All other paths fall through to subsequent
-chains.
-
-### JWT Filter Chain (Order 2)
-
-The JWT chain provides OAuth2 resource server authentication:
-
-- Expects JWT tokens in the `Authorization: Bearer ` header
-- Validates token signature using the configured JWKS endpoint
-- Extracts claims and creates `JwtAuthenticationToken`
-- Invokes claim mapping to standardize different IdP claim names
-- Applies service account detection to classify M2M vs. human users
+## Authentication modes
-## JWT Claim Mappings
+Each mode has its own `SecurityFilterChain` that you enable with a property. Public paths (health, Swagger, API docs)
+bypass authentication.
-Different Identity Providers (IdPs) use different claim names in their JWT tokens for the same semantic meaning. The
-claim mapping system allows you to configure these differences without code changes.
+| Mode | Enable with | Use for |
+| ------------------------------------------- | -------------------------------------------------- | --------------------------------- |
+| [JWT resource server](#jwt-resource-server) | `app.security.authentication.jwt.enabled` | Production API calls (users, M2M) |
+| [OAuth2 login](#oauth2-login) | `app.security.authentication.oauth2-login.enabled` | Browser login, for example GitHub |
+| [Mock](#mock-authentication) | `app.security.authentication.mock.enabled` | Local development only |
+| [API key](#api-key) | `app.security.authentication.api-key.enabled` | Not usable yet (placeholder) |
-### Optional Claim Mapping Configuration
-
-Configure claim mappings in `application.yml` under `app.security.authentication.user-claim-mappings`:
-When JWT authentication is enabled, only these two pieces of information are
-mandatory:
+> [!WARNING]
+> Never enable mock authentication in production. It skips all token validation.
-- spring.security.oauth2.resourceserver.jwt.jwk-set-uri required for signature validation.
-- A valid JWT signature and standard sub claim, sub is effectively required for JIT provisioning because it is the final identifier fallback.
+### JWT resource server
-When `app.security.authentication.jwt.enabled` is `false`, the JWT decoder and
-JWT filter chain are not created, so `OAUTH_JWK_URI` is not required. Swagger
-can be disabled independently with `app.security.swagger.enabled=false`; when
-enabled without OAuth configuration, it publishes only the available security
-schemes.
+The JWT chain validates `Authorization: Bearer ` requests as an OAuth2 resource server. It validates the
+signature against the identity provider (IdP) JWKS endpoint, then hands the token to principal extraction.
-```yaml
-app:
+```yaml title="application.yml"
+spring:
security:
- authentication:
- user-claim-mappings:
- sub: "sub" # Unique user identifier - Mandatory
- preferred_username: "preferred_username" # Human-readable username
- name: "name" # Display name
- email: "email" # Email address
- groups: "groups" # Group memberships
- client_id: "client_id" # OAuth2 client identifier
- azp: "azp" # Authorized party (alternative client ID)
- grant_type: "grant_type" # OAuth2 grant type
- gty: "gty" # Grant type variant
- service_name: "service_name" # Custom M2M service identifier
-```
-
-### Common IdP Configurations
-
-=== "Auth0"
+ oauth2:
+ resourceserver:
+ jwt:
+ jwk-set-uri: ${OAUTH_JWK_URI}
-```yaml
app:
security:
authentication:
- user-claim-mappings:
- sub: "sub"
- preferred_username: "preferred_username"
- name: "name"
- email: "email"
- groups: "groups"
- client_id: "client_id"
- azp: "azp"
- grant_type: "grant_type"
- gty: "gty"
- service_name: "service_name"
+ jwt:
+ enabled: true
+ issuer-uri: ${OAUTH_ISSUER_URI:}
+ audiences: ${OAUTH_AUDIENCES:}
```
-=== "Keycloak"
+A valid signature only proves that the token comes from your identity provider. Set `OAUTH_ISSUER_URI` to the expected
+`iss` claim and `OAUTH_AUDIENCES` to a comma-separated list of accepted `aud` values so that IDP-Core rejects tokens
+issued for other applications of the same provider. Both settings are optional; IDP-Core logs a warning at startup
+for each one that's missing.
-```yaml
+When `jwt.enabled` is `false`, IDP-Core creates neither the JWT decoder nor the JWT chain, so `OAUTH_JWK_URI` isn't
+required. When no authentication mode is enabled at all (`jwt`, `oauth2-login`, `api-key`, and `mock` are all
+`false`), IDP-Core denies every request outside the public paths and the webhook entry point. You can disable Swagger independently with `app.security.swagger.enabled=false`. When you enable Swagger
+without OAuth configuration, it publishes only the available security schemes.
-app:
- security:
- authentication:
- user-claim-mappings:
- sub: "sub"
- preferred_username: "preferred_username"
- name: "name"
- email: "email"
- groups: "groups"
- client_id: "clientId" # Note: camelCase in Keycloak
- azp: "azp"
- grant_type: "grant_type"
- gty: "gty"
- service_name: "service_name"
-```
+#### Map IdP claims
-=== "Azure AD"
-
-```yaml
-app:
- security:
- authentication:
- user-claim-mappings:
- sub: "oid" # Object ID in Azure
- preferred_username: "unique_name"
- name: "name"
- email: "email"
- groups: "groups"
- client_id: "appid"
- azp: "appid"
- grant_type: "grant_type"
- gty: "gty"
- service_name: "custom_service_name"
-```
+Identity providers name the same claim differently. Map them under `app.security.authentication.user-claim-mappings`:
-When a JWT is received, the `PrincipalExtractor` uses these mappings to extract the actual claim values from the token,
-ensuring that regardless of IdP differences, your application always receives standardized `PrincipalInfo` objects.
+=== "Auth0"
-### How Claim Mappings Work
+ ```yaml
+ app:
+ security:
+ authentication:
+ user-claim-mappings:
+ preferred_username: "preferred_username"
+ name: "name"
+ email: "email"
+ groups: "groups"
+ ```
-While the examples above cover standard configurations, understanding the extraction engine's fallback logic is crucial
-when dealing with custom claims or missing data.
+=== "Keycloak"
-The extraction strategy doesn't just rename claims; it applies specific fallback rules if a mapped claim is missing from
-the token:
+ ```yaml
+ app:
+ security:
+ authentication:
+ user-claim-mappings:
+ preferred_username: "preferred_username"
+ name: "name"
+ email: "email"
+ groups: "groups"
+ client_id: "clientId" # camelCase in Keycloak
+ ```
-| Principal field | Mapping key | Fallback when the mapped claim is absent |
-|--------------------|----------------------|------------------------------------------|
-| `identifier` | `preferred_username` | Original JWT `sub` |
-| `name` | `name` | Extracted `identifier` |
-| `attributes.email` | `email` | Attribute omitted |
-| `groups` | `groups` | Empty list |
+=== "Azure AD"
-> [!WARNING]
-> The current JWT extraction strategy ignores the `sub` mapping and reads the
-> original JWT subject directly. Setting `sub: uuid` alone does not select
-> `uuid` as the principal identifier. Use `preferred_username: uuid` for human
-> principals to select that claim with the current implementation.
-> Service accounts use different rules: mapped `client_id`, then mapped `azp`,
-> then the original JWT `sub`.
+ ```yaml
+ app:
+ security:
+ authentication:
+ user-claim-mappings:
+ preferred_username: "unique_name"
+ name: "name"
+ email: "email"
+ groups: "groups"
+ client_id: "appid"
+ ```
-### Example: UUID Identifier and Subject as Display Name
+#### Classify human and machine tokens
-The following decoded JWT payload contains only fictional values.
-It illustrates claim extraction, not a complete token for authentication.
-
-```json
-{
- "sub": "demo-user",
- "uuid": "00000000-0000-4000-8000-000000000001",
- "email": "demo-user@example.com"
-}
-```
-
-To use `uuid` as the human principal identifier and `sub` as its display name,
-configure:
+IDP-Core must decide whether a token represents a person or a service. Configure claims that only human tokens carry,
+plus the identifier claim for each kind:
```yaml
app:
security:
authentication:
- user-claim-mappings:
- preferred_username: uuid
- name: sub
- email: email
+ principal-extraction:
+ human-indicator-claims:
+ - email
+ human:
+ id-claim: email
+ machine:
+ id-claim: client_id
+ id-prefix: "machine:"
```
-For a token classified as human, the extracted `PrincipalInfo` contains:
-
-- `identifier`: `00000000-0000-4000-8000-000000000001`
-- `kind`: `HUMAN`
-- `name`: `demo-user`
-- `attributes.email`: `demo-user@example.com`
-- `groups`: `[]`
-
-> [!WARNING]
-> Changing the identifier mapping can provision a separate catalog principal.
-> Plan how to handle existing principals and their references before changing it.
+A token is human when at least one indicator claim has a non-blank value. Otherwise, IDP-Core treats it as a machine
+principal (`SERVICE_ACCOUNT`). The selected identifier claim must be non-blank, or IDP-Core rejects the request with
+HTTP 401. `machine.id-prefix` is optional and only affects the machine identifier.
-## Service Account Detection
-
-Service accounts are **machine-to-machine (M2M) credentials** used for service-to-service authentication (for example,
-API clients, automation tools). Identifying them correctly is important for:
-
-- Applying different authorization rules for services vs. humans
-- Audit logging and security monitoring
-- Rate limiting and quota management
+> [!IMPORTANT]
+> Use indicators that your provider sets only on human tokens. IDP-Core doesn't infer the kind from `scope`,
+> `client_id`, `grant_type`, or `token_type`.
-IDP-Core supports two detection modes:
+### OAuth2 login
-### Strict Mode (Recommended)
+OAuth2 login runs the browser authorization-code flow through Spring Security. It's the closest local equivalent of
+real user authentication. The following example uses GitHub:
-In strict mode, a single **definitive claim** unambiguously identifies M2M tokens:
+```yaml title="src/main/resources/application-local.yml"
+spring:
+ security:
+ oauth2:
+ client:
+ registration:
+ github:
+ client-id: ${GITHUB_CLIENT_ID}
+ client-secret: ${GITHUB_CLIENT_SECRET}
+ scope:
+ - read:user
+ - user:email
-```yaml
app:
+ idp-core-prefix-url: http://localhost:8084
security:
authentication:
- service-account-detection:
+ jwt:
+ enabled: false
+ oauth2-login:
enabled: true
- mode: "strict"
- definitive-claim-name: "token_type"
- definitive-claim-value: "m2m"
+ mock:
+ enabled: false
+ user-claim-mappings:
+ preferred_username: login
+ name: name
+ email: email
```
-The system checks if the token contains `token_type=m2m`. If it does, the principal is classified as a
-`SERVICE_ACCOUNT`; otherwise, it's a `HUMAN_USER`.
+Create a GitHub OAuth App with these settings:
-**Benefits:**
+- Homepage URL: `http://localhost:8084`
+- Authorization callback URL: `http://localhost:8084/login/oauth2/code/github`
-- Prevents false positives (human users misidentified as services)
-- More secure - reduces risk of access control bypass
-- Clear, deterministic behavior
+Start the application, then open `http://localhost:8084/oauth2/authorization/github`:
-**Requirements:**
+```bash
+export SPRING_PROFILE=local
+export GITHUB_CLIENT_ID=your-github-client-id
+export GITHUB_CLIENT_SECRET=your-github-client-secret
+./mvnw spring-boot:run
+```
-- Your IdP or API gateway must inject the definitive claim
-- May require custom configuration at the IdP level
+After the callback succeeds, the next authenticated request to `/api/v1/**` provisions the GitHub user.
-### Legacy Mode (Backwards Compatibility)
+### Mock authentication
-In legacy mode, the system checks multiple optional claims with OR logic:
+Mock authentication injects a fixed JWT for every request, so you can work without an IdP:
```yaml
app:
security:
authentication:
- service-account-detection:
+ mock:
enabled: true
- mode: "legacy"
- legacy-fallback-claims:
- - "grant_type"
- - "service_name"
- - "client_id"
```
-In legacy mode, IDP-Core classifies a token as a `SERVICE_ACCOUNT` when **any** of
-the following conditions is true:
-
-- The claim mapped to `grant_type` or `gty` has the value
- `client_credentials`.
-- The claim mapped to `service_name` is present.
-- The claim mapped to `client_id` or `azp` has the same value as `sub`.
+The token has `sub` and `preferred_username` set to `local-developer`, `email` set to `developer@local.dev`, and the
+`ROLE_USER` and `ROLE_API_CLIENT` authorities. The mock principal passes through the same extraction, provisioning, and
+authorization steps as a real token. Include your configured human indicator claim in the mock token if you need a
+human principal.
-If none of these conditions is met, the token is classified as a `HUMAN_USER`.
+### API key
-**Benefits:**
+The `app.security.authentication.api-key` chain is a placeholder. It doesn't validate credentials or establish a
+principal, so don't enable it. Inbound webhook delivery uses connector-level validation instead. See
+[Webhook Security](webhooks.md#security-strategies).
-- Works immediately without IdP reconfiguration
-- Maintains backwards compatibility with existing deployments
+### Chain ordering
-**Drawbacks:**
+Spring Security uses the first chain whose `securityMatcher` matches the request. Lower `@Order` values run first:
+`PublicFilterChainConfig` (1), `JwtFilterChainConfig` (2), `ApiKeyFilterChainConfig` (3), and
+`MockFilterChainConfig` (4). Keep the paths excluded from provisioning in sync with the public chain.
-- Prone to false positives (for example, human user with `client_id` present)
-- Less secure - may misclassify humans as services
-- Will be deprecated in future versions
+## Principals and provisioning
-> [!WARNING]
-> Migrate from legacy to strict mode is really encouraged for the systems meeting the prerequisites. Legacy mode is only recommended for existing systems
-that cannot immediately reconfigure their Identity Provider configuration.
+### What is a principal
-## Principal Extraction
-
-Once a JWT is validated and claims are mapped, the `PrincipalExtractor` converts the token into a domain `PrincipalInfo`
-object.
-
-### Extraction Strategy Pattern
-
-The extraction system uses the **Strategy pattern** to support multiple token types:
-
-```java
-public PrincipalInfo extractPrincipalInfo(Authentication authentication) {
- if (authentication instanceof JwtAuthenticationToken jwtToken) {
- return extractFromJwt(jwtToken);
- }
-
- // Fallback for other authentication types
- return createFallbackPrincipal(authentication);
-}
-```
-
-Each strategy:
-
-1. Reads the configured claim mappings from `AuthenticationProperties`
-2. Extracts values from the token using mapped claim names
-3. Classifies the principal as `HUMAN_USER` or `SERVICE_ACCOUNT` using service account detection
-4. Returns a unified `PrincipalInfo` domain object
-
-### PrincipalInfo Domain Model
+A principal is the authenticated caller, stored in the catalog as an entity of the `principal` template. It's the key
+for provisioning, audit records, and authorization. IDP-Core represents it in code as `PrincipalInfo`:
```java
public record PrincipalInfo(
- String identifier, // Unique ID (for example, email, username)
+ String identifier, // Stable unique ID
PrincipalKind kind, // HUMAN or SERVICE_ACCOUNT
String name, // Display name
- Map attributes, // Additional attributes
+ Map attributes, // For example, email
List groups // Group memberships
) {
}
```
-## Just-In-Time (JIT) Provisioning
-
-After successful authentication, the `JitProvisioningFilter` automatically creates a principal record in the database if
-it doesn't exist. This enables:
-
-- **Self-service access**: Users don't need manual provisioning before first login
-- **Automatic sync**: User data stays in sync with the IdP
-- **Reduced overhead**: No need to pre-populate users before they access the system
-
-### How JIT Provisioning Works
+| Kind | Represents |
+| ----------------- | ------------------------------------ |
+| `HUMAN` | A person who signs in through an IdP |
+| `SERVICE_ACCOUNT` | A machine-to-machine (M2M) client |
-1. Request passes through an authentication filter successfully
-2. `JitProvisioningFilter` extracts the `PrincipalInfo` from Spring Security Context
-3. Checks if the principal exists in the database (by identifier)
-4. If not found, creates a new principal record with the extracted information
-5. Continues to the controller
+### Choose the identifier
-### Excluding Paths
+The identifier is never guessed or substituted. A missing or blank identifier returns HTTP 401.
-Not all authenticated requests should trigger provisioning (for example, public paths, health checks). Configure
-excluded paths in `application.yml`:
+| Authentication mode | Identifier source |
+| --------------------------- | ------------------------------------------------------------- |
+| JWT human token | `principal-extraction.human.id-claim` |
+| JWT machine token | `principal-extraction.machine.id-claim`, plus optional prefix |
+| OAuth2 login | Provider-configured principal name (GitHub uses numeric `id`) |
+| OpenID Connect (OIDC) login | Standard `sub` claim |
+| Mock | `sub` (`local-developer`) |
-```yaml
-app:
- security:
- authentication:
- jit-provisioning-excluded-paths:
- - "/"
- - "/actuator/**"
- - "/swagger-ui/**"
- - "/swagger-ui.html"
- - "/v3/api-docs/**"
-```
+IDP-Core has no setting to override the OAuth2 or OIDC identifier.
-> [!IMPORTANT]
-> Keep the JIT excluded paths in sync with the `PublicFilterChainConfig` permission mechanism. If you add a public path
-to one, add it to both.
-
-## API Key Authentication
+> [!WARNING]
+> Changing an identifier mapping provisions a new principal. IDP-Core doesn't rename, merge, or look up principals that
+> it provisioned earlier. Choose a stable, globally unique claim such as a UUID.
-For webhook receivers and service-to-service calls that don't use OAuth2, IDP-Core supports simple API key
-authentication.
+### Extract the other fields
-### Enabling API Key Authentication
+The other fields use limited fallbacks:
-```yaml
-app:
- security:
- authentication:
- api-key:
- enabled: true
-```
+| Principal field | Mapping key | Fallback when absent |
+| ------------------ | ----------- | ------------------------------------- |
+| `name` | `name` | `preferred_username`, then identifier |
+| `attributes.email` | `email` | Attribute omitted |
+| `groups` | `groups` | Empty list |
-API keys are provided via the `X-API-Key` header:
+For example, with `human.id-claim: uuid` and `user-claim-mappings.name: sub`, this fictional payload:
-```bash
-curl -H "X-API-Key: your-secret-key" https://api.example.com/api/v1/webhooks
+```json
+{
+ "sub": "demo-user",
+ "uuid": "00000000-0000-4000-8000-000000000001",
+ "email": "demo-user@example.com"
+}
```
-The `ApiKeyFilterChainConfig` validates the key and creates an authenticated principal without requiring JIT
-provisioning (API keys are pre-configured, not JIT-provisioned).
+produces a `HUMAN` principal with identifier `00000000-0000-4000-8000-000000000001`, name `demo-user`, and
+`attributes.email` set to `demo-user@example.com`.
-## Mock Authentication (Local Development)
+### Provisioning modes
-For local development and testing, enable mock authentication to generate tokens without an IdP:
+After authentication, `JitProvisioningFilter` links the caller to a `principal` entity. The
+`app.security.principal-provisioning.mode` flag controls what happens when no principal exists for the identifier:
```yaml
app:
security:
- authentication:
- mock:
- enabled: true
+ principal-provisioning:
+ mode: ${IDP_PRINCIPAL_PROVISIONING_MODE:LINK_ONLY}
```
-The `MockFilterChainConfig` generates a mock JWT token with configurable claims via request parameters:
+| Mode | Missing principal | Use for |
+| ----------- | ------------------------------------------------------------------ | ------------------------------------------------ |
+| `JIT` | IDP-Core creates it from the token, so first login self-provisions | Open access where the IdP is the source of truth |
+| `LINK_ONLY` | IDP-Core rejects the request with HTTP 401 | Controlled access: principals exist beforehand |
-```bash
-curl -H "Authorization: Bearer mock?sub=test-user&email=test@example.com" \
- http://localhost:8080/api/v1/entities
-```
+The flag defaults to `JIT` when you leave it unset, but `application.yml` sets `LINK_ONLY`. Set
+`IDP_PRINCIPAL_PROVISIONING_MODE` to change it.
-> [!WARNING]
-> Mock authentication must never be enabled in production. It bypasses all JWT validation and should only be used in
-`local` or `test` Spring profiles.
+#### JIT mode
-## GitHub Authentication for Local Development
+1. `PrincipalExtractor` converts the `Authentication` to `PrincipalInfo`.
+2. `PrincipalProvisioningService` creates the principal when it's missing.
+3. IDP-Core looks the principal up again and continues the request. If no principal matches, it returns HTTP 401.
-If you want to exercise the real user authentication path locally, use GitHub as the OAuth2 provider instead of the
-mock filter. This setup exercises the same JIT provisioning flow as production-style authenticated requests:
+#### LINK_ONLY mode
-1. Spring Security completes the OAuth2 login with GitHub.
-2. `OAuth2LoginFilterChainConfig` stores the authenticated `OAuth2User` in the security context.
-3. `JitProvisioningFilter` extracts a `PrincipalInfo` through `PrincipalExtractor`.
-4. `PrincipalProvisioningService` creates or refreshes the `principal` entity on the first authenticated request.
+IDP-Core never creates principals from token data. A principal must exist already, for example from an ingestion
+webhook or an administrator.
-### Local Profile Configuration
+1. `PrincipalExtractor` converts the `Authentication` to `PrincipalInfo`.
+2. IDP-Core looks up the linked principal by identifier.
+3. If found, the request continues.
+4. If missing and the identifier isn't a [break-glass identifier](#break-glass-identifiers), IDP-Core returns HTTP 401
+ with `No linked principal matches the authenticated identity`.
+5. If missing and the identifier is a break-glass identifier, IDP-Core creates the principal with `is_admin: true`.
-The `local` profile now expects a GitHub OAuth App and enables browser-based OAuth2 login.
+A failure in provisioning itself, such as a database error, is logged and the request continues. A missing or blank
+identifier always returns HTTP 401 in both modes.
-```yaml title="src/main/resources/application-local.yml"
-spring:
- security:
- oauth2:
- client:
- registration:
- github:
- client-id: ${GITHUB_CLIENT_ID}
- client-secret: ${GITHUB_CLIENT_SECRET}
- scope:
- - read:user
- - user:email
+#### Excluded paths
+Exclude public paths from provisioning in either mode:
+
+```yaml
app:
- idp-core-prefix-url: http://localhost:8084
security:
authentication:
- jwt:
- enabled: false
- oauth2-login:
- enabled: true
- mock:
- enabled: false
- user-claim-mappings:
- sub: id
- preferred_username: login
- name: name
- email: email
+ jit-provisioning-excluded-paths:
+ - "/"
+ - "/actuator/**"
+ - "/swagger-ui/**"
+ - "/swagger-ui.html"
+ - "/v3/api-docs/**"
```
-### GitHub OAuth App Setup
-
-Create a GitHub OAuth App and configure:
-
-- Homepage URL: `http://localhost:8084`
-- Authorization callback URL: `http://localhost:8084/login/oauth2/code/github`
-
-Export the client credentials before you start the app:
-
-```bash
-export SPRING_PROFILE=local
-export GITHUB_CLIENT_ID=your-github-client-id
-export GITHUB_CLIENT_SECRET=your-github-client-secret
-./mvnw spring-boot:run
-```
+JIT provisioning always creates the principal with `is_admin: false`. It ignores `is_admin` and `kind` from extracted
+attributes, and it doesn't overwrite existing principal data.
-Then open `http://localhost:8084/oauth2/authorization/github` in your browser. After the callback succeeds, the next
-authenticated request to `/api/v1/**` provisions the GitHub user in the catalog automatically.
+> [!WARNING]
+> Don't map an untrusted identity claim to `is_admin`. Only an authorized administrator or a trusted ingestion webhook
+> should change it.
----
+## Authorization
-## Adding a Custom Authentication Method
+The JWT, mock, and OAuth2 login chains apply the authorization policy after provisioning. Webhook ingestion uses its
+own chain and the security configured on each connector.
-This section explains how to add a new authentication mechanism to IDP-Core while respecting the existing architecture.
+### Global mode
-### Why Custom Authentication?
+`GLOBAL` is the only available mode. The `RBAC` and `ABAC` modes fail closed until their policies exist.
-You might need custom authentication for:
+| Principal | Read access | Create, update, delete |
+| ---------------------------------------------------- | --------------------------------------------------------------------------- | ----------------------- |
+| Global identifier in `global-principal-identifiers` | All supported resources | All supported resources |
+| Catalog admin (`is_admin: true`) | All supported resources, including audit | All supported resources |
+| Service account | Entities, entity search, entity templates, `/api/v1/entities/principals/me` | Denied |
+| Human with gate disabled or required property `true` | Same as service account | Denied |
+| Human with required property missing or `false` | Denied | Denied |
-- Cloud provider authentication (AWS IAM, Google Cloud)
-- Enterprise SSO protocols (SAML, OpenID Connect with custom flows)
-- Mutual TLS (mTLS) for service-to-service authentication
-- Legacy authentication systems that must coexist with OAuth2
-- Custom corporate authentication mechanisms
+The policy classifies `GET`, `HEAD`, and `OPTIONS` as reads. It also treats `POST /api/v1/entities/search` and
+`POST /api/v1/entity_dynamic_mappings/dry-run` as reads. Resource rules still decide access, so non-admins can search
+entities but can't call the dry-run endpoint. Audit history, dynamic-mapping management, and inbound webhook
+configuration are admin-only. Unsupported HTTP methods are denied.
-### Step 1: Define Configuration Properties
+### Break-glass identifiers
-Add your mechanism toggle to `application.yml` under `app.security.authentication`:
+Configure root identifiers that bypass catalog and human-property checks:
```yaml
app:
security:
- authentication:
- custom-auth:
- enabled: false
- # Custom mechanism-specific properties
- some-setting: "value"
+ authorization:
+ mode: GLOBAL
+ global-principal-identifiers: ${IDP_SUPER_ADMIN_IDENTIFIER:},${IDP_PLATFORM_ADMIN_IDENTIFIER:}
+ required-principal-property: ${IDP_REQUIRED_PRINCIPAL_PROPERTY:}
```
-Update `AuthenticationProperties.java` to include your configuration:
+Values must match the resulting principal identifier exactly, and the allow-list doesn't scope entries by issuer. Use
+an immutable, globally unique identifier. In `LINK_ONLY` mode, IDP-Core creates a missing principal for a global
+identifier with `is_admin: true`. It never changes an existing principal. In `JIT` mode, the principal is created as
+non-admin, but the identifier still bypasses authorization. See
+[Provisioning modes](#provisioning-modes).
-```java
-public record AuthenticationProperties(
- // ... existing fields ...
+### Require a human property
- /// Your custom authentication mechanism configuration
- CustomAuthConfig customAuth
-) {
-}
+Set `required-principal-property` (for example, `IDP_REQUIRED_PRINCIPAL_PROPERTY=is_idp_user`) to require that a human
+principal has the property set to `true` for any non-admin access, including reads. An empty value disables the gate.
+Service accounts, catalog admins, and global identifiers skip it.
-public record CustomAuthConfig(
- boolean enabled,
- String someSetting
-) {
-}
-```
-
-### Step 2: Create the Filter Chain Configuration
+Add the property as an optional Boolean on the `principal` template before you enable the gate. A trusted ingestion
+webhook can then populate it. JIT never derives it from token claims. Restrict webhook mappings to authoritative
+sources.
-Create a new configuration class in `infrastructure/adapters/api/configuration/security/chains/`:
+### What comes next
-```java
-package com.decathlon.idp_core.infrastructure.adapters.api.configuration.security.chains;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.web.SecurityFilterChain;
-import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
-
-import static org.springframework.security.config.Customizer.withDefaults;
-
-import com.decathlon.idp_core.infrastructure.adapters.api.auth.JitProvisioningFilter;
-
-/**
- * Security filter chain for custom authentication mechanism.
- *
- * This chain handles authentication for all requests matching the specified paths.
- * Custom authentication credentials are extracted from request headers/body and
- * validated before creating an Authentication object in the security context.
- *
- * The JitProvisioningFilter is appended to ensure authenticated principals are
- * automatically provisioned in the database (if not already present).
- *
- * @see CustomAuthenticationFilter
- * @see JitProvisioningFilter
- */
-@Configuration
-@ConditionalOnProperty(prefix = "app.security.authentication.custom-auth", name = "enabled", havingValue = "true")
-public class CustomAuthFilterChainConfig {
-
- private final JitProvisioningFilter jitProvisioningFilter;
- private final CustomAuthenticationFilter customAuthFilter;
-
- public CustomAuthFilterChainConfig(
- JitProvisioningFilter jitProvisioningFilter,
- CustomAuthenticationFilter customAuthFilter) {
- this.jitProvisioningFilter = jitProvisioningFilter;
- this.customAuthFilter = customAuthFilter;
- }
-
- /**
- * Security filter chain for custom authentication.
- *
- * Order: 4 (after JWT at 2, API Key at 3, and Mock at the last position)
- *
- * Specifies:
- * 1. Which paths this chain protects (via securityMatcher)
- * 2. Authorization rules (authenticated or specific roles)
- * 3. Custom authentication filter to extract credentials
- * 4. JIT provisioning filter for automatic principal creation
- */
- @Bean
- @Order(4)
- public SecurityFilterChain customAuthSecurityFilterChain(HttpSecurity http) throws Exception {
- http
- // Optional: Specify which paths this chain handles
- // Omit to protect all remaining paths not handled by other chains
- .securityMatcher("/api/v1/custom/**")
-
- // Require authentication for all matched paths
- .authorizeHttpRequests(auth -> auth.anyRequest().authenticated())
-
- // Enable CORS with default settings
- .cors(withDefaults())
-
- // Disable CSRF (stateless API, tokens provide their own protection)
- .csrf(csrf -> csrf.disable());
-
- // Add your custom authentication filter
- // Place it before AbstractPreAuthenticatedProcessingFilter
- http.addFilterBefore(customAuthFilter, AbstractPreAuthenticatedProcessingFilter.class);
-
- // Add JIT provisioning filter to create principals in database
- http.addFilterAfter(jitProvisioningFilter, AbstractPreAuthenticatedProcessingFilter.class);
-
- return http.build();
- }
-}
-```
+The authorization request already identifies the principal, action, and resource. A later stage can add configurable
+access profiles and resource/action permissions without changing that shape. JWT authorities don't grant platform
+permissions.
-### Step 3: Create the Custom Authentication Filter
-
-Create your filter in `infrastructure/adapters/api/auth/`:
-
-```java
-package com.decathlon.idp_core.infrastructure.adapters.api.auth;
-
-import java.io.IOException;
-
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-/**
- * Extracts custom authentication credentials from the request and creates
- * an Authentication object in the Spring Security context.
- *
- * This filter is invoked before the principal extractor and JIT provisioning.
- * It must:
- * 1. Extract credentials from request (header, cookie, body, etc.)
- * 2. Validate credentials against your custom mechanism
- * 3. Create an Authentication object representing the validated identity
- * 4. Store it in SecurityContextHolder for downstream filters
- *
- * If credentials are missing or invalid, leave the SecurityContext empty
- * and let the request proceed to the next filter (may be rejected at the
- * authorization step or fallback to another authentication method).
- */
-@Component
-@Slf4j
-public class CustomAuthenticationFilter extends OncePerRequestFilter {
-
- @Override
- protected void doFilterInternal(
- HttpServletRequest request,
- HttpServletResponse response,
- FilterChain filterChain) throws ServletException, IOException {
-
- try {
- // 1. Extract credentials from request
- String credentials = extractCredentials(request);
-
- if (credentials != null) {
- // 2. Validate credentials (your custom logic)
- CustomAuthenticationToken token = validateAndCreateToken(credentials);
-
- // 3. Store authentication in Spring Security context
- SecurityContextHolder.getContext().setAuthentication(token);
-
- log.debug("Custom authentication successful");
- }
- } catch (Exception e) {
- log.debug("Custom authentication failed: {}", e.getMessage());
- // Leave SecurityContext empty; authorization filter will reject if needed
- }
-
- // Continue filter chain
- filterChain.doFilter(request, response);
- }
-
- private String extractCredentials(HttpServletRequest request) {
- // Extract from X-Custom-Auth header (example)
- return request.getHeader("X-Custom-Auth");
- }
-
- private CustomAuthenticationToken validateAndCreateToken(String credentials) {
- // Validate credentials and extract principal info
- // Return authenticated token with principal details
- return new CustomAuthenticationToken(credentials, true);
- }
-}
-```
-
-### Step 4: Create a Custom Authentication Token Class
-
-Create your token class representing the authenticated principal:
-
-```java
-package com.decathlon.idp_core.infrastructure.adapters.api.auth;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-
-import com.decathlon.idp_core.infrastructure.adapters.api.principal.PrincipalExtractor;
-
-/**
- * Authentication token for custom authentication mechanism.
- *
- * This class represents an authenticated principal from your custom mechanism.
- * Spring Security uses this to track the currently authenticated user.
- *
- * The PrincipalExtractor will recognize this token type and extract the principal
- * information into a domain PrincipalInfo object.
- *
- * @see PrincipalExtractor
- */
-public class CustomAuthenticationToken extends AbstractAuthenticationToken {
-
- private final String credentials;
- private final String principal; // identifier/username
-
- public CustomAuthenticationToken(String credentials, boolean authenticated) {
- // Pass authorities to the superclass
- super(List.of(new SimpleGrantedAuthority("ROLE_USER")));
- this.credentials = credentials;
- this.principal = extractPrincipal(credentials);
- // Let AbstractAuthenticationToken handle the authenticated state securely
- super.setAuthenticated(authenticated);
- }
-
- private String extractPrincipal(String credentials) {
- return credentials.split(":")[1];
- }
-
- @Override
- public Object getCredentials() {
- return credentials;
- }
-
- @Override
- public Object getPrincipal() {
- return principal;
- }
-}
-```
-
-### Step 5: Update the Principal Extractor
-
-The `PrincipalExtractor` must recognize your custom authentication token and convert it to a `PrincipalInfo` domain
-object.
-
-You should create a new Spring `@Component` that implements `PrincipalExtractionStrategy`. Spring will automatically
-inject it into `PrincipalExtractor`.
-
-```java
-package com.decathlon.idp_core.infrastructure.adapters.api.principal;
-
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Component;
-
-import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
-import com.decathlon.idp_core.domain.model.principal.PrincipalKind;
-import com.decathlon.idp_core.infrastructure.adapters.api.auth.CustomAuthenticationToken;
-
-@Component
-public class CustomAuthenticationExtractionStrategy implements PrincipalExtractionStrategy {
-
- @Override
- public boolean supports(Authentication authentication) {
- return authentication instanceof CustomAuthenticationToken;
- }
-
- @Override
- public PrincipalInfo extract(Authentication authentication) {
- CustomAuthenticationToken token = (CustomAuthenticationToken) authentication;
- String principal = token.getName();
-
- return new PrincipalInfo(
- principal, // identifier
- PrincipalKind.HUMAN, // kind (or SERVICE_ACCOUNT)
- principal, // name
- Map.of(), // attributes
- List.of() // roles/groups
- );
- }
-}
-```
-
-### Step 6: Verification Checklist
-
-After implementing your custom authentication method:
-
-- [ ] Configuration toggle in `application.yml` under `app.security.authentication.custom-auth.enabled`
-- [ ] `AuthenticationProperties.java` updated with your configuration record
-- [ ] Filter chain configuration class created with `@Order(5)` or next available
-- [ ] Filter chain uses `@ConditionalOnProperty` to load only when enabled
-- [ ] Custom authentication filter extracts and validates credentials
-- [ ] Custom authentication filter stores `Authentication` in security context
-- [ ] Custom authentication token class implements Spring `Authentication`
-- [ ] `PrincipalExtractor` recognizes your token type
-- [ ] `PrincipalExtractor` extracts required fields: `identifier`, `sub`, `name`, `email`, `groups`, `type`
-- [ ] `JitProvisioningFilter` is appended to the chain
-- [ ] No overlapping `securityMatcher` paths with existing chains
-- [ ] Request paths are not in the JIT provisioning excluded paths list (unless they should be public)
-- [ ] Tests verify authentication flow end-to-end
-- [ ] Documentation in `application.yml` explains the new mechanism
-
-### Step 7: Testing Your Implementation
-
-Create an integration test to verify the end-to-end flow:
+---
-```java
+## Next Steps
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-class CustomAuthenticationIntegrationTest {
-
- @Autowired
- private TestRestTemplate restTemplate;
-
- @Test
- void testCustomAuthenticationSuccess() {
- // Create a request with your custom credentials
- HttpHeaders headers = new HttpHeaders();
- headers.set("X-Custom-Auth", "your:test:credentials");
-
- HttpEntity request = new HttpEntity<>(headers);
-
- // Execute request
- ResponseEntity response = restTemplate.exchange(
- "/api/v1/entities",
- HttpMethod.GET,
- request,
- String.class
- );
-
- // Verify successful authentication
- assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
- }
-
- @Test
- void testCustomAuthenticationFailure() {
- // Test with missing/invalid credentials
- ResponseEntity response = restTemplate.getForEntity(
- "/api/v1/entities",
- String.class
- );
-
- // Should fail (401 or 403 depending on your config)
- assertThat(response.getStatusCode()).isIn(
- HttpStatus.UNAUTHORIZED,
- HttpStatus.FORBIDDEN
- );
- }
-}
-```
-
----
+- **[Webhook Security](../features/data-integration.md##Security)** - Connector-level security for inbound webhooks
diff --git a/docs/src/concepts/entities.md b/docs/src/concepts/entities.md
index 1eb4f429..0106f5db 100644
--- a/docs/src/concepts/entities.md
+++ b/docs/src/concepts/entities.md
@@ -274,6 +274,8 @@ Retrieve a paginated list of entities for a given template:
GET /api/v1/entities/{templateIdentifier}?page=0&size=20&sort=identifier,asc
```
+`size` must be between 1 and the configured maximum (default 500, set with `MAX_PAGE_SIZE`), values outside this range return `400 Bad Request`.
+
### Get Entity by Identifier
Retrieve a specific entity using its template and entity identifiers:
@@ -282,6 +284,28 @@ Retrieve a specific entity using its template and entity identifiers:
GET /api/v1/entities/{templateIdentifier}/{entityIdentifier}
```
+By default, relation objects include only the related entity's identifier, name, and template identifier. Add
+`include_relations_properties=true` to include each related entity's typed properties. The root entity's properties are
+returned as usual, and omitting the flag keeps the existing relation response shape.
+
+```text
+GET /api/v1/entities/{templateIdentifier}/{entityIdentifier}?include_relations_properties=true
+```
+
+With the flag enabled, a relation object also includes a `properties` map:
+
+```json
+{
+ "identifier": "web-api-1",
+ "name": "Web API 1",
+ "template_identifier": "web-service",
+ "properties": {
+ "port": 8080,
+ "is_public": true
+ }
+}
+```
+
---
## Updating an Entity
diff --git a/docs/src/concepts/entity-filtering.md b/docs/src/concepts/entity-filtering.md
index c0987c46..e434ad3f 100644
--- a/docs/src/concepts/entity-filtering.md
+++ b/docs/src/concepts/entity-filtering.md
@@ -174,7 +174,7 @@ Request shape (`EntitySearchRequestDtoIn`):
},
"page": 0,
"size": 20,
- "sort": "identifier:asc"
+ "sort": "identifier,asc"
}
```
@@ -183,7 +183,7 @@ Request shape (`EntitySearchRequestDtoIn`):
- `filter` is a tree of group nodes and criterion nodes. A group node has `connector` (one of `AND`,`OR`) and a non-empty `criteria` array. A criterion node must include `field`, `operation` and `value`.
- Supported `operation` values: `EQ`, `NEQ`, `CONTAINS`, `NOT_CONTAINS`, `STARTS_WITH`, `ENDS_WITH`, `GT`, `GTE`, `LT`, `LTE`.
- Free-text `query` (optional) performs a case-insensitive contains search across identifier, name, template identifier and all property values.
-- Pagination: `page` is zero-based, `size` defaults to 20. Maximum allowed `size` is 500.
+- Pagination: `page` is zero-based, `size` defaults to 20. Maximum allowed `size` is 500 by default (configurable with `MAX_PAGE_SIZE`).
### What it does
@@ -202,7 +202,7 @@ curl -sS -X POST "http://localhost:8084/api/v1/entities/search" \
- `query` (optional): free-text string (max 255 chars) searched case-insensitively in `identifier`, `name`, `templateIdentifier`, and property values.
- `filter` (optional): nested `FilterNodeDtoIn` JSON structure. Use a `template` criterion to scope results to a specific template when needed.
-- `page` / `size`: pagination (zero-based `page`). `size` defaults to 20 and the server enforces a maximum of 500.
+- `page` / `size`: pagination (zero-based `page`). `size` defaults to 20 and the server enforces a maximum of 500 by default (configurable with `MAX_PAGE_SIZE`).
- `sort`: `field:asc|desc`. Allowed sort fields: `identifier`, `name`, `templateIdentifier`.
### Operator semantics
@@ -221,7 +221,7 @@ curl -sS -X POST "http://localhost:8084/api/v1/entities/search" \
- Maximum filter nesting depth: 5 levels. Requests exceeding this fail with `400 Bad Request` and a descriptive error message.
- Maximum total criterion count across the tree: 50. Requests exceeding this fail with `400 Bad Request`.
- Maximum `query` length: 255 characters.
-- Maximum `size` (page size): 500.
+- Maximum `size` (page size): 500 by default, configurable with `MAX_PAGE_SIZE`.
## Next Steps
diff --git a/docs/src/concepts/entity-templates.md b/docs/src/concepts/entity-templates.md
index 77db63d4..fa7cdeff 100644
--- a/docs/src/concepts/entity-templates.md
+++ b/docs/src/concepts/entity-templates.md
@@ -13,6 +13,9 @@ An Entity Template defines:
- **Properties** - Data fields with types and validation rules
- **Relations** - Connections to other entity templates
+The `principal` template is protected because its entities determine access to IDP-Core. Only catalog administrators can
+create it.
+
```mermaid
classDiagram
class EntityTemplate {
diff --git a/docs/src/concepts/relations.md b/docs/src/concepts/relations.md
index 37d36690..e9e7e770 100644
--- a/docs/src/concepts/relations.md
+++ b/docs/src/concepts/relations.md
@@ -112,6 +112,14 @@ Each entity can link to **multiple** target entities.
---
+## Unresolved identifiers for relations
+
+The platform validates relation targets on every entity create, update, and patch, whether you use the REST API or webhook ingestion. Set `APP_RELATIONS_TARGET_VALIDATION_MODE` to choose how it handles unresolved targets. The default, `STRICT`, rejects any non-blank target identifier that does not resolve to an entity. In `TOLERANT` mode, the platform filters unresolved identifiers from optional relations, keeps resolved targets, and omits the relation if none resolve.
+
+Both modes enforce required relations, target-template compatibility for resolved targets, and the existing `required` and `to_many` cardinality constraints. Tolerant mode checks cardinality after filtering unresolved optional targets. REST entity writes return `400 Bad Request` for validation failures, while webhook ingestion returns `422 Unprocessable Content`.
+
+---
+
## Example: Complete Data Model
Here's a complete example with multiple templates and relations:
diff --git a/docs/src/contributing/code/code-conventions.md b/docs/src/contributing/code/code-conventions.md
index faade886..f683a859 100644
--- a/docs/src/contributing/code/code-conventions.md
+++ b/docs/src/contributing/code/code-conventions.md
@@ -122,18 +122,25 @@ public class InvalidIdentifierException extends DomainException {
public class GlobalExceptionHandler {
@ExceptionHandler(EntityNotFoundException.class)
- public ResponseEntity handleNotFound(EntityNotFoundException ex) {
- return ResponseEntity.status(HttpStatus.NOT_FOUND)
- .body(new ErrorResponse(ex.getCode(), ex.getMessage()));
+ public ProblemDetail handleNotFound(EntityNotFoundException ex) {
+ return buildProblemDetail(HttpStatus.NOT_FOUND, ex.getMessage());
}
@ExceptionHandler(MethodArgumentNotValidException.class)
- public ResponseEntity handleValidation(MethodArgumentNotValidException ex) {
+ public ProblemDetail handleValidation(MethodArgumentNotValidException ex) {
var errors = ex.getBindingResult().getFieldErrors().stream()
.map(e -> e.getField() + ": " + e.getDefaultMessage())
.toList();
- return ResponseEntity.badRequest()
- .body(new ErrorResponse("VALIDATION_ERROR", String.join(", ", errors)));
+ return buildProblemDetail(HttpStatus.BAD_REQUEST, String.join(", ", errors));
+ }
+
+ private ProblemDetail buildProblemDetail(HttpStatus status, String detail) {
+ var problem = ProblemDetail.forStatusAndDetail(status, detail);
+ problem.setTitle(status.getReasonPhrase());
+ problem.setProperty("error", status.name());
+ problem.setProperty("error_description", detail);
+ problem.setProperty("timestamp", Instant.now());
+ return problem;
}
}
```
diff --git a/docs/src/contributing/code/domain-infrastructure.md b/docs/src/contributing/code/domain-infrastructure.md
index ad1dbf92..38570d34 100644
--- a/docs/src/contributing/code/domain-infrastructure.md
+++ b/docs/src/contributing/code/domain-infrastructure.md
@@ -185,9 +185,13 @@ sequenceDiagram
sequenceDiagram
participant DomainService
participant ApiExceptionHandler
+ participant CamelRoute
+ participant WebhookExceptionHandlerHelper
participant Client
DomainService->>ApiExceptionHandler: Throw domain exception
- ApiExceptionHandler->>Client: Map to HTTP status + ErrorResponse DTO
+ ApiExceptionHandler->>Client: Return RFC 7807 ProblemDetail + legacy extensions
+ CamelRoute->>WebhookExceptionHandlerHelper: Map ingestion exception
+ WebhookExceptionHandlerHelper->>Client: Return RFC 7807 ProblemDetail + legacy extensions
```
---
diff --git a/docs/src/contributing/code/exception-handling.md b/docs/src/contributing/code/exception-handling.md
index 72a9aae2..c9f89612 100644
--- a/docs/src/contributing/code/exception-handling.md
+++ b/docs/src/contributing/code/exception-handling.md
@@ -6,28 +6,52 @@ description: Global exception handling strategy and error response formats for I
## Strategy
1. **Domain**: Throw specific business exceptions, for example `EntityTemplateNotFoundException`.
-2. **Infrastructure**: Catch exceptions in `ApiExceptionHandler` with `@ControllerAdvice` annotation.
-3. **API**: Return consistent JSON error responses.
+2. **Infrastructure**: Catch exceptions in `ApiExceptionHandler` with `@RestControllerAdvice`.
+3. **API**: Return RFC 7807 `ProblemDetail` responses with legacy extension fields.
## Exception Mapping
-| Exception Type | HTTP Status | Description |
-| -------------------------------------- | ------------------ | -------------------- |
-| `EntityTemplateNotFoundException` | 404 Not Found | Entity not found |
-| `EntityTemplateAlreadyExistsException` | 409 Conflict | Duplicate identifier |
-| `ConstraintViolationException` | 400 Bad Request | Validation failed |
-| `MethodArgumentNotValidException` | 400 Bad Request | Invalid request body |
-| `HttpMessageNotReadableException` | 400 Bad Request | JSON parsing error |
-| `Exception` | 500 Internal Error | Unexpected error |
+| Exception Type | HTTP Status | Description |
+| -------------------------------------- | ------------------ | ---------------------------- |
+| `EntityTemplateNotFoundException` | 404 Not Found | Entity not found |
+| `EntityTemplateAlreadyExistsException` | 409 Conflict | Duplicate identifier |
+| `ConstraintViolationException` | 400 Bad Request | Validation failed |
+| `MethodArgumentNotValidException` | 400 Bad Request | Invalid request body |
+| `HttpMessageNotReadableException` | 400 Bad Request | Framework JSON parsing error |
+| `Exception` | 500 Internal Error | Unexpected error |
## Error Response Format
-At API level, always follow the same error response structure:
+Spring MVC endpoints and the Camel `/webhooks/{webhookIdentifier}` ingestion route return
+`application/problem+json` responses. Standard RFC 7807 fields appear alongside legacy
+compatibility fields:
```json
{
+ "type": "about:blank",
+ "title": "Not Found",
+ "status": 404,
+ "detail": "Template with ID 'invalid-id' not found",
+ "instance": "/api/v1/entity-templates/invalid-id",
"error": "NOT_FOUND",
- "error_description": "Template with ID 'invalid-id' not found",
- "timestamp": "2025-11-28T10:30:00Z"
+ "error_description": "Template with ID 'invalid-id' not found"
}
```
+
+The `error` and `error_description` fields preserve the legacy contract for existing
+clients. `timestamp` is included as an `Instant` for traceability.
+
+> [!WARNING]
+> Strict clients may reject the new media type or the extra extension fields. They should
+> be updated to parse `application/problem+json` and tolerate RFC 7807 extensions.
+
+### Intentional differences
+
+- Spring MVC validation and JSON parsing errors now use the framework's native problem detail handling.
+- The manual JSON parsing logic was removed, so some malformed payload messages may differ from the previous custom wording.
+
+### Migration note
+
+Communicate the response shape change to API consumers before they depend on the new contract.
+Keep compatibility tests in place while clients migrate, and verify both the standard
+ProblemDetail fields and the legacy extension properties.
diff --git a/docs/src/deployment/configuration.md b/docs/src/deployment/configuration.md
index 276b89b6..bd769394 100644
--- a/docs/src/deployment/configuration.md
+++ b/docs/src/deployment/configuration.md
@@ -190,21 +190,47 @@ spring:
```yaml
management:
tracing:
- enabled: true
sampling:
- probability: 1.0
-
-otel:
- exporter:
- otlp:
- endpoint: http://otel-collector:4317
- service:
- name: idp-core
- resource:
- attributes:
- deployment.environment: production
+ probability: ${OTEL_TRACES_SAMPLER_ARG:0.1}
+ export:
+ enabled: ${OTEL_TRACING_ENABLED:false}
+
+ otlp:
+ metrics:
+ export:
+ url: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:${OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4318}/v1/metrics}
+ enabled: ${OTEL_METRICS_EXPORT_ENABLED:false}
+ transport: ${OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:${OTEL_EXPORTER_OTLP_PROTOCOL:http/protobuf}}
+
+ opentelemetry:
+ tracing:
+ export:
+ otlp:
+ endpoint: ${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:${OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4318}/v1/traces}
+ transport: ${OTEL_EXPORTER_OTLP_TRACES_TRANSPORT:${OTEL_EXPORTER_OTLP_PROTOCOL:http}}
+ resource-attributes:
+ deployment.environment: ${OTEL_ENV:local}
+ service.namespace: ${OTEL_SERVICE_NAMESPACE:idp-core}
+ service.name: ${OTEL_SERVICE_NAME:internal-developer-platform}
```
+The signal-specific OpenTelemetry variables win over the generic fallback, so you can set the standard OpenTelemetry environment variables without hard-coding vendor-specific values.
+
+### Common environment variables
+
+| Variable | Description |
+| --- | --- |
+| `OTEL_TRACING_ENABLED` | Enables tracing export |
+| `OTEL_METRICS_EXPORT_ENABLED` | Enables OTLP metrics export |
+| `OTEL_TRACES_SAMPLER_ARG` | Trace sampling ratio |
+| `OTEL_EXPORTER_OTLP_ENDPOINT` | Base OTLP endpoint |
+| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Full traces URL |
+| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Full metrics URL |
+| `OTEL_EXPORTER_OTLP_PROTOCOL` | Generic OTLP protocol fallback |
+| `OTEL_EXPORTER_OTLP_TRACES_TRANSPORT` | Trace transport override |
+| `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` | Metrics transport override |
+| `OTEL_RESOURCE_ATTRIBUTES` | Resource metadata for the service |
+
---
### OAuth 2.0
diff --git a/docs/src/deployment/docker.md b/docs/src/deployment/docker.md
index e6254a3c..64e5b69b 100644
--- a/docs/src/deployment/docker.md
+++ b/docs/src/deployment/docker.md
@@ -224,77 +224,43 @@ ENTRYPOINT ["java", "-jar", "app.jar"]
### Observability
-| Variable | Description | Default |
-| ----------------------------- | -------------- | ---------- |
-| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP endpoint | - |
-| `OTEL_SERVICE_NAME` | Service name | `idp-core` |
-| `LOG_LEVEL` | Root log level | `INFO` |
-
----
-
-## Docker Compose Commands
-
-### Start Services
-
-```bash
-# Start all
-docker compose up -d
-
-# Start specific service
-docker compose up -d idp-core
-
-# View logs
-docker compose logs -f idp-core
-```
-
-### Stop Services
-
-```bash
-# Stop all
-docker compose down
-
-# Stop and remove volumes
-docker compose down -v
-```
-
-### Update
-
-```bash
-# Pull latest images
-docker compose pull
-
-# Recreate containers
-docker compose up -d --force-recreate
-```
-
-### Scale
-
-```bash
-# Run 3 instances
-docker compose up -d --scale idp-core=3
-```
-
----
-
-## Database Management
-
-### Initialize Database
-
-The database schema is managed by Flyway and applies automatically on startup.
-
-### Backup
-
-```bash
-docker exec postgres pg_dump -U idp idp > backup.sql
-```
-
-### Restore
-
-```bash
-cat backup.sql | docker exec -i postgres psql -U idp idp
-```
-
----
+IDP-Core follows the standard OpenTelemetry environment variables. Tracing and metrics export are opt-in, and the application keeps the usual OpenTelemetry fallbacks so you can set the standard variables without hard-coding a vendor-specific configuration.
+
+The effective precedence is:
+
+- `OTEL_EXPORTER_OTLP_TRACES_TRANSPORT` > `OTEL_EXPORTER_OTLP_PROTOCOL` > `http`
+- `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` > `OTEL_EXPORTER_OTLP_PROTOCOL` > `http/protobuf`
+
+This means the application can work in local Docker, in Kubernetes, or in a managed platform while still honoring the standard OpenTelemetry variables set by the operator or deployment pipeline.
+
+| Variable | Description | Default |
+|---------------------------------------|----------------------------------------------------------|------------------------------------------------|
+| `OTEL_TRACING_ENABLED` | Enables OpenTelemetry tracing (opt-in) | `false` |
+| `OTEL_EXPORTER_OTLP_ENDPOINT` | Base OTLP endpoint for all signals | `http://localhost:4318` |
+| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Full traces URL. It wins over the base endpoint | `/v1/traces` |
+| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Full metrics URL. It wins over the base endpoint | `/v1/metrics` |
+| `OTEL_EXPORTER_OTLP_PROTOCOL` | OTLP protocol used as the generic fallback | `http/protobuf` for metrics, `http` for traces |
+| `OTEL_EXPORTER_OTLP_TRACES_TRANSPORT` | Transport for traces. It wins over the generic protocol | `OTEL_EXPORTER_OTLP_PROTOCOL` or `http` |
+| `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` | Transport for metrics. It wins over the generic protocol | `OTEL_EXPORTER_OTLP_PROTOCOL` |
+| `OTEL_METRICS_EXPORT_ENABLED` | Enables OTLP metrics export (opt-in) | `false` |
+| `OTEL_TRACES_SAMPLER_ARG` | Fraction of traces kept, from `0.0` to `1.0` | `0.1` |
+| `OTEL_SERVICE_NAME` | Service name | `internal-developer-platform` |
+| `OTEL_SERVICE_NAMESPACE` | Service namespace | `idp-core` |
+| `OTEL_ENV` | Value of the `deployment.environment` attribute | `local` |
+| `OTEL_RESOURCE_ATTRIBUTES` | Extra resource attributes (`key=value,key=value`) | - |
+| `LOG_LEVEL` | Root log level | `INFO` |
+
+The signal-specific variable wins over the generic one, so the image works in the common deployments:
+
+- **Docker Compose or a simple container:** set `OTEL_EXPORTER_OTLP_ENDPOINT`
+- **Kubernetes with the OpenTelemetry Operator:** the platform injects `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`
+- **Datadog or another OTLP collector:** set the standard OpenTelemetry endpoint and resource attributes
+- **Local development:** leave the variables unset and use the built-in `localhost:4318` fallback
+
+> Note: Lower `OTEL_TRACES_SAMPLER_ARG` in high-throughput production. Capturing 100% of the traces increases CPU overhead
+> and vendor costs. For example, `0.1` keeps 10% of the traces.
+
+`OTEL_RESOURCE_ATTRIBUTES` is the right place to pass Datadog tags such as `env`, `service`, and `version`. The application does not need hard-coded Datadog values; it just emits the standard OpenTelemetry resource metadata.
## Troubleshooting
diff --git a/docs/src/deployment/observability.md b/docs/src/deployment/observability.md
index ccbea54a..e0d179e4 100644
--- a/docs/src/deployment/observability.md
+++ b/docs/src/deployment/observability.md
@@ -3,336 +3,124 @@ title: Observability
description: Monitoring, logging, and tracing for the Internal Developer Platform
---
-The Internal Developer Platform provides comprehensive observability through metrics, logs, and distributed tracing using OpenTelemetry.
-
-## Overview
+The Internal Developer Platform emits metrics, logs, and traces through Spring Boot and OpenTelemetry, with Camel instrumentation enabled for the webhook ingestion flow.
```mermaid
flowchart LR
- subgraph "Internal Developer Platform"
- M[Metrics]
- L[Logs]
- T[Traces]
+ subgraph "Application"
+ APP[IDP-Core]
+ CAMEL[Camel route]
+ OTEL[OpenTelemetry]
end
- subgraph "Collection"
- OTEL[OpenTelemetry Collector]
+ subgraph "Backends"
+ DD[Datadog / OTLP collector]
PROM[Prometheus]
end
- subgraph "Visualization"
- GRAF[Grafana]
- LOKI[Loki]
- TEMPO[Tempo / Jaeger]
- DATADOG[Datadog]
- end
-
- M --> PROM --> GRAF
- L --> OTEL --> LOKI --> GRAF
- T --> OTEL --> TEMPO --> GRAF
- OTEL --> DATADOG
- PROM --> DATADOG
+ APP --> CAMEL
+ CAMEL --> OTEL
+ OTEL --> DD
+ OTEL --> PROM
```
----
+The app exposes health endpoints and uses OTLP export for traces and metrics when enabled. The standard OpenTelemetry variables remain the integration point for the environment, not vendor-specific configuration.
## Metrics
-### Prometheus Endpoint
-
-The Internal Developer Platform exposes metrics at `/actuator/prometheus`:
-
-```bash
-curl http://localhost:8080/actuator/prometheus
-```
-
-### Key Metrics
-
-#### Application Metrics
-
-| Metric | Description |
-| -------- | ------------- |
-| `idp_entities_total` | Total entities by template |
-| `idp_entity_operations_total` | CRUD operations count |
-| `idp_webhook_invocations_total` | Webhook calls |
-| `idp_action_executions_total` | Self-service action runs |
-
-#### HTTP Metrics
-
-| Metric | Description |
-| -------- | ------------- |
-| `http_server_requests_seconds` | Request latency |
-| `http_server_requests_active` | Active requests |
-
-#### JVM Metrics
-
-| Metric | Description |
-| -------- | ------------- |
-| `jvm_memory_used_bytes` | Memory usage |
-| `jvm_gc_pause_seconds` | GC pause time |
-| `jvm_threads_live` | Thread count |
+### Metrics exported by Spring Boot and Micrometer
-#### Database Metrics
-
-| Metric | Description |
-| -------- | ------------- |
-| `hikaricp_connections_active` | Active DB connections |
-| `hikaricp_connections_pending` | Waiting connections |
-
-### Metrics Configuration
+The application exposes the standard Micrometer metrics and OTLP export can be enabled through environment variables.
```yaml
management:
- endpoints:
- web:
- exposure:
- include: health,info,metrics,prometheus
- metrics:
+ tracing:
+ sampling:
+ probability: ${OTEL_TRACES_SAMPLER_ARG:0.1}
export:
- prometheus:
- enabled: true
- distribution:
- percentiles-histogram:
- http.server.requests: true
- percentiles:
- http.server.requests: 0.5,0.95,0.99
- tags:
- application: idp-core
- environment: ${ENVIRONMENT:dev}
-```
-
-### Prometheus scrape configuration
-
-```yaml title="prometheus.yml"
-scrape_configs:
- - job_name: 'idp-core'
- metrics_path: '/actuator/prometheus'
- static_configs:
- - targets: ['idp-core:8080']
- scrape_interval: 15s
-```
-
-### Kubernetes ServiceMonitor
-
-```yaml title="servicemonitor.yaml"
-apiVersion: monitoring.coreos.com/v1
-kind: ServiceMonitor
-metadata:
- name: idp-core
- namespace: idp
-spec:
- selector:
- matchLabels:
- app: idp-core
- endpoints:
- - port: http
- path: /actuator/prometheus
- interval: 30s
-```
-
----
-
-## Logging
+ enabled: ${OTEL_TRACING_ENABLED:false}
-### Log Format
-
-#### Development (Human-readable)
-
-```text
-2024-01-15 10:30:45.123 INFO [http-nio-8080-exec-1] c.d.i.a.EntityController - Creating entity: payment-service
-```
-
-#### Production (JSON)
-
-```json
-{
- "timestamp": "2024-01-15T10:30:45.123Z",
- "level": "INFO",
- "logger": "c.d.i.a.EntityController",
- "message": "Creating entity: payment-service",
- "thread": "http-nio-8080-exec-1",
- "traceId": "abc123def456",
- "spanId": "789xyz"
-}
-```
-
-### Logging Configuration
-
-```yaml
-logging:
- level:
- root: INFO
- com.decathlon.idp_core: INFO
- org.springframework.web: WARN
- org.hibernate: WARN
-
- pattern:
- # JSON for production
- console: '{"timestamp":"%d{ISO8601}","level":"%level","logger":"%logger{36}","message":"%msg","thread":"%thread","traceId":"%X{traceId}","spanId":"%X{spanId}"}%n'
-```
-
-### Loki Integration
-
-Send logs to Loki via the OpenTelemetry Collector:
-
-```yaml title="otel-collector-config.yaml"
-receivers:
otlp:
- protocols:
- grpc:
- endpoint: 0.0.0.0:4317
-
-exporters:
- loki:
- endpoint: http://loki:3100/loki/api/v1/push
- labels:
- attributes:
- service.name: "service_name"
- deployment.environment: "environment"
-
-service:
- pipelines:
- logs:
- receivers: [otlp]
- exporters: [loki]
+ metrics:
+ export:
+ url: ${OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:${OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4318}/v1/metrics}
+ enabled: ${OTEL_METRICS_EXPORT_ENABLED:false}
+ transport: ${OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:${OTEL_EXPORTER_OTLP_PROTOCOL:http/protobuf}}
+
+ opentelemetry:
+ tracing:
+ export:
+ otlp:
+ endpoint: ${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:${OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4318}/v1/traces}
+ transport: ${OTEL_EXPORTER_OTLP_TRACES_TRANSPORT:${OTEL_EXPORTER_OTLP_PROTOCOL:http}}
+ resource-attributes:
+ deployment.environment: ${OTEL_ENV:local}
+ service.namespace: ${OTEL_SERVICE_NAMESPACE:idp-core}
+ service.name: ${OTEL_SERVICE_NAME:internal-developer-platform}
```
-### Log Levels
+### Custom business metrics
-| Level | Usage |
-| ------- | -------------------------- |
-| `ERROR` | Errors requiring attention |
-| `WARN` | Potential issues |
-| `INFO` | Key business events |
-| `DEBUG` | Development debugging |
-| `TRACE` | Detailed tracing |
+Business-level metrics are intentionally separate from Camel route telemetry. The application adds custom counters only for functional decisions that Camel does not expose as a reusable business signal.
----
+Examples:
-## Distributed Tracing
+- `idp.webhook.security.requests.total{connector, security_type}`
+- `idp.webhook.security.result{connector, security_type, result}`
+- `idp.webhook.security.validation.errors.total{connector, security_type, reason}`
-### OpenTelemetry Setup
+These metrics reflect the real security decision made by the application and should not duplicate the standard Camel `route.*` metrics.
-```yaml
-management:
- tracing:
- enabled: true
- sampling:
- probability: 1.0 # Sample all requests (use 0.1 for 10% in prod)
-
-otel:
- exporter:
- otlp:
- endpoint: http://otel-collector:4317
- service:
- name: idp-core
- resource:
- attributes:
- deployment.environment: production
- service.version: "1.0.0"
-```
+## Logging
-### Trace Context
+Logs remain useful for debugging and operational incidents, but they are not the primary analytics signal. The main operational signals are traces and metrics.
-IDP-Core propagates trace context through:
+The application configuration keeps log filtering under `logging.level.*` and actuator health endpoints under `management.endpoint.health`.
-- HTTP headers (W3C Trace Context)
-- Kafka message headers
-- Webhook requests
+## Distributed tracing
-### Key Spans
+OpenTelemetry tracing is enabled through Spring Boot configuration. The application keeps the trace sampling rate and OTLP exporter configurable through environment variables.
-| Span | Description |
-| --------------------------- | -------------------- |
-| `HTTP GET /api/v1/entities` | Incoming API request |
-| `EntityRepository.findById` | Database query |
-| `WebhookService.invoke` | Outgoing webhook |
-| `KafkaProducer.send` | Kafka message |
+### Standard environment variables
-### Jaeger/Tempo Integration
+| Variable | Description | Default |
+| --- | --- | --- |
+| `OTEL_TRACING_ENABLED` | Enables tracing export | `false` |
+| `OTEL_METRICS_EXPORT_ENABLED` | Enables OTLP metrics export | `false` |
+| `OTEL_TRACES_SAMPLER_ARG` | Trace sampling ratio | `0.1` |
+| `OTEL_EXPORTER_OTLP_ENDPOINT` | Base OTLP endpoint | `http://localhost:4318` |
+| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Full traces endpoint | `/v1/traces` |
+| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Full metrics endpoint | `/v1/metrics` |
+| `OTEL_EXPORTER_OTLP_PROTOCOL` | Generic OTLP protocol fallback | `http/protobuf` for metrics, `http` for traces |
+| `OTEL_EXPORTER_OTLP_TRACES_TRANSPORT` | Trace-specific transport override | `OTEL_EXPORTER_OTLP_PROTOCOL` or `http` |
+| `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL` | Metrics-specific transport override | `OTEL_EXPORTER_OTLP_PROTOCOL` |
+| `OTEL_RESOURCE_ATTRIBUTES` | Resource metadata injected by the environment | - |
-```yaml title="otel-collector-config.yaml"
-receivers:
- otlp:
- protocols:
- grpc:
- endpoint: 0.0.0.0:4317
-
-exporters:
- otlp/tempo:
- endpoint: http://tempo:4317
- tls:
- insecure: true
-
-service:
- pipelines:
- traces:
- receivers: [otlp]
- exporters: [otlp/tempo]
-```
+The signal-specific variables win over the generic fallback, so local development and hosted deployments can both work without hard-coded vendor configuration.
----
+### Important trace attributes
-## Health Checks
+The application sets trace attributes for the webhook pipeline, including the connector identifier and the security decision.
-### Endpoints
+Examples:
-| Endpoint | Purpose |
-| ---------------------------- | --------------- |
-| `/actuator/health` | Overall health |
-| `/actuator/health/liveness` | Liveness probe |
-| `/actuator/health/readiness` | Readiness probe |
+- `idp.webhook.identifier`
+- `idp.webhook.security.result`
-### Health Configuration
+These attributes support trace correlation in Datadog APM and allow support teams to trace a request across route execution, security validation, and mapping.
-```yaml
-management:
- endpoint:
- health:
- show-details: when_authorized
- show-components: always
- probes:
- enabled: true
- health:
- db:
- enabled: true
- diskspace:
- enabled: true
- threshold: 100MB
-```
+## Health checks
-### Response Example
-
-```json
-{
- "status": "UP",
- "components": {
- "db": {
- "status": "UP",
- "details": {
- "database": "PostgreSQL",
- "validationQuery": "isValid()"
- }
- },
- "diskSpace": {
- "status": "UP",
- "details": {
- "total": 107374182400,
- "free": 85899345920,
- "threshold": 104857600
- }
- },
- "ping": {
- "status": "UP"
- }
- }
-}
-```
+The app exposes health endpoints used by Docker and Kubernetes.
----
+| Endpoint | Purpose |
+|------------------------------|----------------------|
+| `/actuator/health` | Overall health |
+| `/actuator/health/liveness` | Liveness probe |
+| `/actuator/health/readiness` | Readiness probe |
-## Next Steps
+## Next steps
-- **[Configuration](configuration.md)** - Observability settings
-- **[Kubernetes](kubernetes.md)** - Production monitoring
-- **[Docker](docker.md)** - Local observability setup
+- **[Configuration](configuration.md)** - Environment and Spring Boot settings
+- **[Docker](docker.md)** - Docker deployment and OTLP examples
+- **[Kubernetes](kubernetes.md)** - Production deployment patterns
diff --git a/docs/src/features/data-integration.md b/docs/src/features/data-integration.md
index 13cc888b..350e7307 100644
--- a/docs/src/features/data-integration.md
+++ b/docs/src/features/data-integration.md
@@ -213,6 +213,10 @@ sequenceDiagram
Route-->>Client: 201 Created
```
+> [!TIP]
+> If a `filter` expression returns `false`, the payload is silently
+> skipped for that mapping. Other mappings on the same connector continue to run.
+
Each step in the pipeline is isolated in its own Camel sub-route:
| Step | Route ID | Responsibility |
@@ -223,8 +227,8 @@ Each step in the pipeline is isolated in its own Camel sub-route:
| **C** | `ingest-payload` | Apply each `EntityDynamicMapping` and persist entities |
> [!TIP]
-> If a `filter` expression returns `false`, the payload is silently
-> skipped for that mapping. Other mappings on the same connector continue to run.
+> Webhook ingestion uses the same relation validation mode as REST entity writes. `STRICT` is the default and rejects unresolved target identifiers. Set `APP_RELATIONS_TARGET_VALIDATION_MODE=TOLERANT` to filter unresolved identifiers from optional relations; IDP-Core keeps resolved targets and omits the relation if none resolve.
+> Both modes enforce required relations, target-template compatibility, and cardinality. Tolerant mode checks cardinality after filtering. A webhook relation validation failure returns `422 Unprocessable Content`.
---
diff --git a/docs/src/features/entity-dynamic-mapping.md b/docs/src/features/entity-dynamic-mapping.md
index 3d16dcf2..62be57fc 100644
--- a/docs/src/features/entity-dynamic-mapping.md
+++ b/docs/src/features/entity-dynamic-mapping.md
@@ -7,6 +7,10 @@ description: Understand Dynamic mappings and JSLT expressions.
A mapping targets one Entity Template and describes how to derive entity fields from the incoming JSON payload with a JSLT filter and entity projections. It is linked to a data integration configuration (Webhook, Kafka, etc) as it describes how to transform incoming payloads.
+Only catalog administrators can create or update mappings that target the protected `principal` template. This
+restriction prevents an ingestion mapping from changing principal privileges. Webhook deliveries that use an already
+authorized mapping continue to run through the configured connector security strategy.
+
## Entity Dynamic Mapping Fields
| Field | Required | Description |
@@ -195,6 +199,17 @@ if (.is_private == true) "PRIVATE_" + .name else .name
}
```
+### JSLT Execution Limits
+
+To protect the platform against denial-of-service, JSLT processing is bounded:
+
+| Limit | Value | Exceeded behavior |
+| ------------------ | ------------------------ | --------------------------------------- |
+| Payload size | 1 MB (UTF-8 bytes) | Rejected before parsing (400) |
+| JSON nesting depth | 64 levels | Rejected before the tree is built (400) |
+| Expression length | 10,000 characters | Rejected at validation (422) |
+| Evaluation timeout | 5 seconds per evaluation | Evaluation aborted (422) |
+
> [!TIP]
> Use the **dry-run endpoint** (POST `/api/v1/entity_dynamic_mappings/dry-run`) to test
> your JSLT expressions before deploying them to production. This helps catch syntax
diff --git a/docs/src/features/webhooks.md b/docs/src/features/webhooks.md
index ff4da621..8292f5c6 100644
--- a/docs/src/features/webhooks.md
+++ b/docs/src/features/webhooks.md
@@ -80,20 +80,19 @@ This validation keeps the connector configuration aligned with the current data
Each connector declares one security type. IDP-Core validates the configuration at creation time and validates requests
again at runtime.
-| Type | Required configuration keys | Optional configuration keys |
-| -------------- | ------------------------------------------------- | ------------------------------- |
-| `HMAC_SHA256` | `header_name`, `secret_alias` | `prefix` (default is `sha256=`) |
-| `STATIC_TOKEN` | `header_name`, `secret_alias` | None |
-| `BASIC_AUTH` | `username`, `secret_alias` | None |
-| `JWT_BEARER` | `jwks_uri`, `client_id_field`, `client_id_values` | `expected_audience` |
-| `NONE` | None | None |
+| Type | Required configuration keys | Runtime behavior |
+|------------------|-----------------------------------------------------|--------------------------------------------------------------------------------------------------|
+| `HMAC_SHA256` | `header_name`, `secret_alias`, `prefix` | Computes the SHA-256 HMAC of the raw body and compares it with the request header |
+| `STATIC_TOKEN` | `header_name`, `secret_alias` | Compares a header value with a secret loaded from the environment |
+| `BASIC_AUTH` | `username`, `secret_alias` | Compares the `Authorization: Basic ...` header with the configured username and secret |
+| `JWT_BEARER` | `jwks_uri`, `client_id_field`, `client_id_values` | Validates the bearer token against a JWKS endpoint, then checks caller identity claim allow-list |
+| `NONE` | none (`config` is optional) | Skips authentication. Disabled unless `IDP_WEBHOOK_SECURITY_ALLOW_NONE=true` |
> [!IMPORTANT]
> Configuration keys accept `snake_case` and `camelCase` variants where supported. HMAC prefix uses the `prefix` key and has a default set to `sha256=`.
> [!WARNING]
-> Secret aliases reference environment variables; they do not store the raw secret value in the connector configuration.
-> Use `MY_SECRET`, `env:MY_SECRET`, or `${MY_SECRET}` as the value. You can also use `secret_alias_env` or
-> `secretAliasEnv` as the key and set its value to the environment variable name.
+> `secret_alias` must reference an environment variable alias in `UPPER_SNAKE_CASE`. It does not store the raw secret
+value in the connector configuration.
### Example Security Configurations
@@ -148,25 +147,37 @@ again at runtime.
}
```
+=== "NONE"
+
+ ```json
+ {
+ "type": "NONE"
+ }
+ ```
+
+ For `NONE`, you can omit `config`, set it to `null`, or pass `{}`. Any non-empty `config` is rejected.
+
+ `NONE` is forbidden by default for enabled connectors. Set the `IDP_WEBHOOK_SECURITY_ALLOW_NONE` environment variable to `true` to allow creating or updating enabled connectors with `NONE`. Disabled connectors can omit `security`, set it to `null` or `{}`, or use `NONE` without enabling this flag. In all cases, a `NONE` configuration must be empty. Connectors that already use `NONE` continue to ingest events.
+
+ Creating or updating a connector without mappings automatically disables it, even if you send `enabled: true`. These requests also accept `security: {}`.
+
### JWT_BEARER Configuration Reference
- `jwks_uri` (required): literal HTTPS URL used to validate JWT signatures.
-- `client_id_field` (required): claim name used to identify the caller. Allowed values are only `azp` or `email`.
+- `client_id_field` (required): name of the JWT claim that identifies the caller. Any non-empty claim name is accepted, for example `client_id`, `sub`, `azp`, `email`, or a custom claim.
- `client_id_values` (required): comma-separated allow-list of accepted claim values.
-- `expected_audience` (optional): comma-separated allow-list for the `aud` claim. If present, at least one JWT audience must match. If omitted, IDP-Core does not check the audience.
+- `expected_audience` (optional): comma-separated allow-list for the `aud` claim. If present, at least one JWT audience must match.
+- `allowed-jwks-hosts` (optional, environment-backed): comma-separated allow-list of trusted JWKS hosts under `idp.security.webhook`. Set `ALLOWED_JWKS_HOSTS` when you need to permit a specific issuer host explicitly.
+
+The caller must send the JWT in an `Authorization: Bearer ` header. If the claim named by `client_id_field` is missing from the token, the request is rejected with `401 Unauthorized`. If the claim value is not in `client_id_values`, the request is rejected with `403 Forbidden`.
> [!WARNING]
> `jwks_uri` must use a resolvable public HTTPS host. Local hosts, private networks, link-local addresses, and group-address destinations are rejected at connector creation.
+> If you configure `allowed-jwks-hosts`, the listed hosts bypass this rejection path intentionally.
+> This allow-list is configured under `idp.security.webhook.allowed-jwks-hosts`.
`jwks_uri` is stored as a literal URL in the connector configuration. Environment references are not supported for this field.
-### JWKS Host Allow-List
-
-The optional server-level property `idp.security.webhook.allowed-jwks-hosts` defaults to an empty list. Set the
-`ALLOWED_JWKS_HOSTS` environment variable to a comma-separated list of hosts to allow. When the list is non-empty,
-`jwks_uri` must use one of those hosts; allow-listed hosts bypass the private and local address rejection checks.
-The URI must still use HTTPS.
-
## Runtime Flow
The webhook runtime uses a single generic endpoint:
@@ -192,7 +203,7 @@ The request flow is:
You manage webhook connectors through the inbound webhook management API, which exposes standard CRUD methods.
| HTTP Method | Endpoint | Purpose |
-| ----------- | --------------------------------------- | ---------------- |
+|-------------|-----------------------------------------|------------------|
| `POST` | `/api/v1/inbound_webhooks` | Create connector |
| `GET` | `/api/v1/inbound_webhooks` | List connectors |
| `GET` | `/api/v1/inbound_webhooks/{identifier}` | Get connector |
diff --git a/docs/src/getting-started/configuration.md b/docs/src/getting-started/configuration.md
index a5b573e4..c251d255 100644
--- a/docs/src/getting-started/configuration.md
+++ b/docs/src/getting-started/configuration.md
@@ -75,17 +75,12 @@ Configure CORS if your frontend loads from a different origin or if no API gatew
spring:
web:
cors:
- allowed-origins:
- - http://localhost:3000
- - https://your-frontend.com
- allowed-methods:
- - GET
- - POST
- - PUT
- - DELETE
- allowed-headers: "*"
+ allowed-origins: http://localhost:3000,https://your-frontend.com
+ allowed-origin-patterns: https://*.your-domain.com
```
+Set exact origins with `spring.web.cors.allowed-origins` or the `SPRING_WEB_CORS_ALLOWED_ORIGINS` environment variable. Set wildcard origin patterns with `spring.web.cors.allowed-origin-patterns` or the `SPRING_WEB_CORS_ALLOWED_ORIGIN_PATTERNS` environment variable. Separate multiple values with commas.
+
---
## Security Configuration
@@ -153,6 +148,7 @@ All configuration can be overridden using environment variables:
| `SPRING_DATASOURCE_PASSWORD` | DB password | `secret` |
| `SERVER_PORT` | HTTP port | `8084` |
| `LOGGING_LEVEL_ROOT` | Log level | `INFO` |
+| `MAX_PAGE_SIZE` | Maximum `size` accepted by search and listing endpoints (default `500`) | `1000` |
### Naming Convention
diff --git a/docs/src/static/swagger.yaml b/docs/src/static/swagger.yaml
index 5d564f02..bd634ffa 100644
--- a/docs/src/static/swagger.yaml
+++ b/docs/src/static/swagger.yaml
@@ -1,4 +1,3 @@
----
openapi: 3.1.0
info:
title: Idp core API
@@ -14,6 +13,8 @@ tags:
description: Entity relationship graph operations
- name: Inbound Webhook Management
description: Operations for managing inbound webhook connector configurations
+- name: Principals
+ description: Principal identity and profile management
- name: Entities Management
description: Operations related to entity management
- name: Audit
@@ -28,7 +29,7 @@ tags:
- name: Entity dynamic mapping
description: Operations related to entity dynamic mapping management
paths:
- "/api/v1/inbound_webhooks/{identifier}":
+ /api/v1/inbound_webhooks/{identifier}:
get:
tags:
- Inbound Webhook Management
@@ -45,21 +46,20 @@ paths:
'200':
description: Webhook connector found
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/InboundWebhookDtoOut"
+ $ref: '#/components/schemas/InboundWebhookDtoOut'
'404':
description: Webhook connector not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
put:
tags:
- Inbound Webhook Management
summary: Update an existing webhook connector by identifier
- description: Update the details of an existing webhook connector identified
- by its unique string identifier
+ description: Update the details of an existing webhook connector identified by its unique string identifier
operationId: putWebhookConnector
parameters:
- name: identifier
@@ -71,33 +71,33 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/InboundWebhookUpdateDtoIn"
+ $ref: '#/components/schemas/InboundWebhookUpdateDtoIn'
required: true
responses:
'200':
description: Webhook connector updated successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/InboundWebhookDtoOut"
- '400':
- description: Invalid request payload
- content:
- "*/*":
- schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/InboundWebhookDtoOut'
'404':
description: Webhook connector not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
+ '400':
+ description: Invalid request payload
+ content:
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'409':
description: Webhook connector name already exists
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
delete:
tags:
- Inbound Webhook Management
@@ -116,10 +116,10 @@ paths:
'404':
description: Webhook connector not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entity_dynamic_mappings/{identifier}":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entity_dynamic_mappings/{identifier}:
get:
tags:
- Entity dynamic mapping
@@ -136,21 +136,20 @@ paths:
'200':
description: Entity dynamic mapping found
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
'404':
description: Entity dynamic mapping not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
put:
tags:
- Entity dynamic mapping
summary: Update an existing entity dynamic mapping by identifier
- description: Update the details of an existing entity dynamic mapping identified
- by its unique string identifier
+ description: Update the details of an existing entity dynamic mapping identified by its unique string identifier
operationId: updateEntityDynamicMapping
parameters:
- name: identifier
@@ -162,34 +161,33 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingUpdateDtoIn"
+ $ref: '#/components/schemas/EntityDynamicMappingUpdateDtoIn'
required: true
responses:
'200':
description: Entity dynamic mapping updated successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
- '400':
- description: Entity template identifier is mandatory or target entity template
- not found
- content:
- "*/*":
- schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
'404':
description: Entity dynamic mapping not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
+ '400':
+ description: Entity template identifier is mandatory or target entity template not found
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'409':
description: Target entity template not found or identifier already exists
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
delete:
tags:
- Entity dynamic mapping
@@ -208,10 +206,10 @@ paths:
'404':
description: Entity dynamic mapping not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entity-templates/{identifier}":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entity-templates/{identifier}:
get:
tags:
- Entities Templates Management
@@ -228,21 +226,20 @@ paths:
'200':
description: Template found
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityTemplateDtoOut"
+ $ref: '#/components/schemas/EntityTemplateDtoOut'
'404':
description: Template not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
put:
tags:
- Entities Templates Management
summary: Update an existing template by template identifier
- description: Update the details of an existing template identified by its unique
- string identifier
+ description: Update the details of an existing template identified by its unique string identifier
operationId: updateTemplate
parameters:
- name: identifier
@@ -254,21 +251,21 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityTemplateUpdateDtoIn"
+ $ref: '#/components/schemas/EntityTemplateUpdateDtoIn'
required: true
responses:
'200':
description: Template update successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityTemplateDtoOut"
+ $ref: '#/components/schemas/EntityTemplateDtoOut'
'404':
description: Template not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
delete:
tags:
- Entities Templates Management
@@ -287,24 +284,23 @@ paths:
'400':
description: 'Cannot delete template: it is a target for other relations'
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'404':
description: Template not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entities/{templateIdentifier}/{entityIdentifier}":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entities/{templateIdentifier}/{entityIdentifier}:
get:
tags:
- Entities Management
summary: Get entity by entity template and identifier
- description: Retrieve a specific entity using its string identifier and its
- template identifier with configurable relationship graph traversal. Supports
- fetching both inbound and outbound relations up to a specified depth using
- direct lineage mode.
+ description: Retrieve a specific entity using its string identifier and its template identifier with configurable relationship
+ graph traversal. Supports fetching both inbound and outbound relations up to a specified depth using direct lineage
+ mode.
operationId: getEntity
parameters:
- name: templateIdentifier
@@ -319,8 +315,7 @@ paths:
type: string
- name: relations_depth
in: query
- description: 'Maximum depth to traverse when collecting entity relations.
- Defaults to 1. Valid range: 1-6.'
+ description: 'Maximum depth to traverse when collecting entity relations. Defaults to 1. Valid range: 1-6.'
required: false
schema:
type: integer
@@ -329,26 +324,32 @@ paths:
minimum: 1
- name: relations_to_display
in: query
- description: Comma-separated list of relation names to filter the response.
- Only relations that form a connected chain from the root entity are included.
- Isolated relations (not reachable from the root) are excluded even if listed.
+ description: Comma-separated list of relation names to filter the response. Only relations that form a connected chain
+ from the root entity are included. Isolated relations (not reachable from the root) are excluded even if listed.
When omitted, all reachable relations are included.
required: false
schema:
type: array
+ - name: include_relations_properties
+ in: query
+ description: When true, include property values for related entities. Defaults to false.
+ required: false
+ schema:
+ type: boolean
+ default: false
responses:
'200':
description: Entity found
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDtoOut"
+ $ref: '#/components/schemas/EntityDtoOut'
'404':
description: Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
put:
tags:
- Entities Management
@@ -372,43 +373,52 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityUpdateDtoIn"
+ $ref: '#/components/schemas/EntityUpdateDtoIn'
required: true
responses:
'200':
description: Entity updated successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDtoOut"
+ $ref: '#/components/schemas/EntityDtoOut'
'400':
description: Invalid entity data provided
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'401':
description: Unauthorized - Missing or invalid token
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'403':
description: Insufficient rights
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'404':
description: Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'500':
description: Unexpected server-side failure
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- patch:
+ $ref: '#/components/schemas/ProblemDetail'
+ delete:
tags:
- Entities Management
- summary: Partially update an existing entity
- description: Partially update an existing entity in the system with the provided information
- operationId: patchEntity
+ summary: Delete an existing entity
+ description: Delete an entity from the system using its template and entity identifiers. This operation removes the
+ entity and automatically cleans up any relations from other entities that reference it.
+ operationId: deleteEntity
parameters:
- name: templateIdentifier
in: path
@@ -422,49 +432,51 @@ paths:
schema:
type: string
minLength: 1
- requestBody:
- content:
- application/json:
- schema:
- "$ref": "#/components/schemas/EntityPatchDtoIn"
- required: true
responses:
- '200':
- description: Entity updated successfully
- content:
- "*/*":
- schema:
- "$ref": "#/components/schemas/EntityDtoOut"
+ '204':
+ description: Entity deleted successfully
'400':
description: Invalid entity data provided
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'401':
description: Unauthorized - Missing or invalid token
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'403':
description: Insufficient rights
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'404':
description: Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
+ '409':
+ description: Target entity has required relations
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'500':
description: Unexpected server-side failure
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- delete:
+ $ref: '#/components/schemas/ProblemDetail'
+ patch:
tags:
- Entities Management
- summary: Delete an existing entity
- description: Delete an entity from the system using its template and entity
- identifiers. This operation removes the entity and automatically cleans up
- any relations from other entities that reference it.
- operationId: deleteEntity
+ summary: Partially update an existing entity
+ description: Partially update an existing entity in the system with the provided information
+ operationId: patchEntity
parameters:
- name: templateIdentifier
in: path
@@ -478,38 +490,50 @@ paths:
schema:
type: string
minLength: 1
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/EntityPatchDtoIn'
+ required: true
responses:
- '204':
- description: Entity deleted successfully
+ '200':
+ description: Entity updated successfully
+ content:
+ '*/*':
+ schema:
+ $ref: '#/components/schemas/EntityDtoOut'
'400':
description: Invalid entity data provided
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'401':
description: Unauthorized - Missing or invalid token
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'403':
description: Insufficient rights
- '404':
- description: Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- '409':
- description: Target entity has required relations
+ $ref: '#/components/schemas/ProblemDetail'
+ '404':
+ description: Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'500':
description: Unexpected server-side failure
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/webhooks/{webhookIdentifier}":
+ $ref: '#/components/schemas/ProblemDetail'
+ /webhooks/{webhookIdentifier}:
post:
tags:
- spring-boot-platform-http-consumer
@@ -517,7 +541,7 @@ paths:
responses:
'200':
description: OK
- "/api/v1/inbound_webhooks":
+ /api/v1/inbound_webhooks:
get:
tags:
- Inbound Webhook Management
@@ -529,24 +553,23 @@ paths:
in: query
description: Page number for pagination. Defaults to 0.
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '0'
- name: size
in: query
- description: Number of items per page. Defaults to 20.
+ description: Number of items per page. Defaults to 20. Must be between 1 and 500.
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '20'
- name: sort
in: query
- description: 'Sorting criteria in the format: property(,asc|desc). Defaults
- to identifier,asc.'
+ description: 'Sorting criteria in the format: property(,asc|desc). Defaults to identifier,asc.'
content:
- "*/*":
+ '*/*':
schema:
type: string
default: identifier,asc
@@ -554,78 +577,75 @@ paths:
'200':
description: Paginated webhook connector retrieved successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/WebhookConnectorPageResponse"
+ $ref: '#/components/schemas/WebhookConnectorPageResponse'
'400':
description: Invalid pagination parameters
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
post:
tags:
- Inbound Webhook Management
summary: Create a new webhook connector configuration
- description: Creates a webhook connector configuration used by the generic inbound
- webhook endpoint
+ description: Creates a webhook connector configuration used by the generic inbound webhook endpoint
operationId: createInboundWebhook
requestBody:
content:
application/json:
schema:
- "$ref": "#/components/schemas/InboundWebhookCreateDtoIn"
+ $ref: '#/components/schemas/InboundWebhookCreateDtoIn'
required: true
responses:
'201':
description: Webhook connector created
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/InboundWebhookDtoOut"
+ $ref: '#/components/schemas/InboundWebhookDtoOut'
'400':
description: Invalid webhook connector data provided
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/InboundWebhookDtoOut"
+ $ref: '#/components/schemas/InboundWebhookDtoOut'
'409':
description: Webhook connector already exists in this entityTemplateIdentifier
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/InboundWebhookDtoOut"
- "/api/v1/entity_dynamic_mappings":
+ $ref: '#/components/schemas/InboundWebhookDtoOut'
+ /api/v1/entity_dynamic_mappings:
get:
tags:
- Entity dynamic mapping
summary: Get paginated entity dynamic mappings
- description: Retrieve a paginated list of entity dynamic mappings with optional
- sorting
+ description: Retrieve a paginated list of entity dynamic mappings with optional sorting
operationId: getEntityDynamicMappingPaginated
parameters:
- name: page
in: query
description: Page number for pagination. Defaults to 0.
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '0'
- name: size
in: query
- description: Number of items per page. Defaults to 20.
+ description: Number of items per page. Defaults to 20. Must be between 1 and 500.
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '20'
- name: sort
in: query
- description: 'Sorting criteria in the format: property(,asc|desc). Defaults
- to identifier,asc.'
+ description: 'Sorting criteria in the format: property(,asc|desc). Defaults to identifier,asc.'
content:
- "*/*":
+ '*/*':
schema:
type: string
default: identifier,asc
@@ -633,88 +653,86 @@ paths:
'200':
description: Paginated entity dynamic mapping retrieved successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingPageResponse"
+ $ref: '#/components/schemas/EntityDynamicMappingPageResponse'
'400':
description: Invalid pagination parameters
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
post:
tags:
- Entity dynamic mapping
summary: Create entity dynamic mapping
- description: Creates a new entity dynamic mapping used by the generic inbound
- webhook endpoint
+ description: Creates a new entity dynamic mapping used by the generic inbound webhook endpoint
operationId: createDynamicMapping
requestBody:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingCreateDtoIn"
+ $ref: '#/components/schemas/EntityDynamicMappingCreateDtoIn'
required: true
responses:
'201':
description: Entity dynamic mapping created
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
'400':
description: Invalid entity dynamic mapping data provided
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
'409':
description: Identifier already exists
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
- "/api/v1/entity_dynamic_mappings/dry-run":
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
+ /api/v1/entity_dynamic_mappings/dry-run:
post:
tags:
- Entity dynamic mapping
summary: Validate a single entity dynamic mapping with a dry-run
- description: Validate one JSLT mapping definition against a sample payload and
- target template identifier without persisting any data
+ description: Validate one JSLT mapping definition against a sample payload and target template identifier without persisting
+ any data
operationId: executeDryRun
requestBody:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDryRunDtoIn"
+ $ref: '#/components/schemas/EntityDynamicMappingDryRunDtoIn'
required: true
responses:
'200':
description: Dry-run completed successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDynamicMappingDryRunDtoOut"
+ $ref: '#/components/schemas/EntityDynamicMappingDryRunDtoOut'
'400':
description: Invalid entity dynamic mapping data provided
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'404':
description: Entity template not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'422':
- description: Mapping validation, template validation or expression evaluation
- error
+ description: Mapping validation, template validation or expression evaluation error
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entity-templates":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entity-templates:
get:
tags:
- Entities Templates Management
@@ -726,24 +744,23 @@ paths:
in: query
description: Page number for pagination. Defaults to 0.
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '0'
- name: size
in: query
- description: Number of items per page. Defaults to 20.
+ description: Number of items per page. Defaults to 20. Must be between 1 and 500.
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '20'
- name: sort
in: query
- description: 'Sorting criteria in the format: property(,asc|desc). Defaults
- to identifier,asc.'
+ description: 'Sorting criteria in the format: property(,asc|desc). Defaults to identifier,asc.'
content:
- "*/*":
+ '*/*':
schema:
type: string
default: identifier,asc
@@ -751,15 +768,15 @@ paths:
'200':
description: Paginated templates retrieved successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/TemplatePageResponse"
+ $ref: '#/components/schemas/TemplatePageResponse'
'400':
description: Invalid pagination parameters
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
post:
tags:
- Entities Templates Management
@@ -770,22 +787,22 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityTemplateCreateDtoIn"
+ $ref: '#/components/schemas/EntityTemplateCreateDtoIn'
required: true
responses:
'201':
description: Template created successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityTemplateDtoOut"
+ $ref: '#/components/schemas/EntityTemplateDtoOut'
'400':
description: Invalid template data provided
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entities/{templateIdentifier}":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entities/{templateIdentifier}:
get:
tags:
- Entities Management
@@ -798,58 +815,66 @@ paths:
description: Page number for pagination. Defaults to 0.
required: false
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '0'
- name: size
in: query
- description: Number of items per page. Defaults to 20.
+ description: Number of items per page. Defaults to 20. Must be between 1 and 500.
required: false
content:
- "*/*":
+ '*/*':
schema:
type: integer
default: '20'
+ - name: sort
+ in: query
+ description: 'Sorting criteria in the format: field[,asc|desc]'
+ required: false
+ content:
+ "*/*":
+ schema:
+ type: string
+ default: identifier,asc
- name: templateIdentifier
in: path
required: true
schema:
type: string
- - name: q
+ - name: sort
in: query
- description: 'Optional filter query using a simple expression language. See
- more details in the API documentation. Example: `name:idp` for entities
- with names containing ''idp''.
-
- '
+ description: 'Sorting criteria in the format: property(,asc|desc). Defaults to identifier,asc.'
required: false
content:
- "*/*":
+ '*/*':
schema:
type: string
- - name: sort
+ default: identifier,asc
+ - name: q
in: query
- description: 'Sorting criteria in the format: property(,asc|desc). Defaults
- to identifier,asc.'
+ description: 'Optional filter query using a simple expression language. See more details in the API documentation.
+ Example: `name:idp` for entities with names containing ''idp''.
+
+ '
+ required: false
content:
- "*/*":
+ '*/*':
schema:
type: string
- default: identifier,asc
responses:
'200':
description: Paginated entities retrieved successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityPageResponse"
+ $ref: '#/components/schemas/EntityPageResponse'
'400':
description: Invalid filter query syntax
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
post:
tags:
- Entities Management
@@ -867,79 +892,99 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntityCreateDtoIn"
+ $ref: '#/components/schemas/EntityCreateDtoIn'
required: true
responses:
'201':
description: Entity created successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityDtoOut"
+ $ref: '#/components/schemas/EntityDtoOut'
'400':
description: Invalid entity data provided
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'401':
description: Unauthorized - Missing or invalid token
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'403':
description: Insufficient rights
- '404':
- description: Template not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'409':
description: Entity already exists in this template
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
+ '404':
+ description: Template not found with the provided identifier
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'500':
description: Unexpected server-side failure
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entities/search":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entities/search:
post:
tags:
- Entities Management
summary: Search entities
- description: Search for entities across all templates using nested filter queries.
- Supports complex logical compositions (AND / OR) of filter criteria on template,
- identifier, name, properties, relations, and reverse relations.
+ description: Search for entities across all templates using nested filter queries. Supports complex logical compositions
+ (AND / OR) of filter criteria on template, identifier, name, properties, relations, and reverse relations.
operationId: searchEntities
requestBody:
content:
application/json:
schema:
- "$ref": "#/components/schemas/EntitySearchRequestDtoIn"
+ $ref: '#/components/schemas/EntitySearchRequestDtoIn'
+ examples:
+ Entity search:
+ description: Entity search
+ value:
+ query: test
+ filter:
+ connector: AND
+ criteria:
+ - field: template
+ operation: EQ
+ value: service
+ page: 0
+ size: 20
+ sort: identifier,asc
required: true
responses:
'200':
description: Entities retrieved successfully
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityPageResponse"
+ $ref: '#/components/schemas/EntityPageResponse'
'400':
description: Invalid search filter
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/entities/{templateIdentifier}/{entityIdentifier}/graph":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entities/{templateIdentifier}/{entityIdentifier}/graph:
get:
tags:
- Entity Graph
summary: Get entity relationship graph as flat nodes and edges
- description: Retrieves the entity relationship graph as a flat nodes-and-edges
- structure, suitable for frontend visualization tools such as React Flow, Vis.js,
- and Cytoscape.
+ description: Retrieves the entity relationship graph as a flat nodes-and-edges structure, suitable for frontend visualization
+ tools such as React Flow, Vis.js, and Cytoscape.
operationId: getEntityGraph
parameters:
- name: templateIdentifier
@@ -956,8 +1001,7 @@ paths:
minLength: 1
- name: depth
in: query
- description: Maximum traversal depth for relationship resolution. Clamped
- between 1 and 6.
+ description: Maximum traversal depth for relationship resolution. Clamped between 1 and 6.
required: false
schema:
type: integer
@@ -965,16 +1009,15 @@ paths:
default: 1
- name: include_data
in: query
- description: When true, each graph node includes a data object containing
- the entity's property values. Defaults to false.
+ description: When true, each graph node includes a data object containing the entity's property values. Defaults to
+ false.
required: false
schema:
type: boolean
default: false
- name: traversal_mode
in: query
- description: Specifies the traversal mode for the entity graph. Defaults to
- DIRECT_LINEAGE.
+ description: Specifies the traversal mode for the entity graph. Defaults to DIRECT_LINEAGE.
required: false
schema:
type: string
@@ -985,8 +1028,8 @@ paths:
- OUTBOUND_ONLY
- name: relations
in: query
- description: When provided, only relations whose name matches one of the listed
- values are traversed and included. Omit to include all relations.
+ description: When provided, only relations whose name matches one of the listed values are traversed and included.
+ Omit to include all relations.
required: false
schema:
type: array
@@ -994,9 +1037,8 @@ paths:
type: string
- name: properties
in: query
- description: When provided, each node's data object is restricted to the listed
- property names. Requires include_data=true to have any effect. Omit to include
- all properties.
+ description: When provided, each node's data object is restricted to the listed property names. Requires include_data=true
+ to have any effect. Omit to include all properties.
required: false
schema:
type: array
@@ -1006,22 +1048,92 @@ paths:
'200':
description: Flat entity graph successfully retrieved
content:
- "*/*":
+ '*/*':
schema:
- "$ref": "#/components/schemas/EntityGraphFlatDtoOut"
+ $ref: '#/components/schemas/EntityGraphFlatDtoOut'
+ '400':
+ description: Invalid graph query parameter value
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'404':
description: Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/api/v1/audit/entities/{templateIdentifier}/{entityIdentifier}":
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/entities/principals/me:
+ get:
+ tags:
+ - Principals
+ summary: Get current authenticated principal
+ description: 'Returns the Principal entity of the currently authenticated actor (human or service account).
+
+ The principal is automatically provisioned via JIT if this is the first authentication.
+
+
+ **Response includes:**
+
+ - Principal identifier (unique ID)
+
+ - Display name
+
+ - Principal kind (HUMAN or SERVICE_ACCOUNT)
+
+ - Attributes (email, client_id, etc.)
+
+ - Group memberships (via relations)
+
+
+ **Use cases:**
+
+ - Profile inspection: "Who am I?"
+
+ - Authorization context retrieval
+
+ - Service account validation
+
+ '
+ operationId: getCurrentPrincipal
+ responses:
+ '200':
+ description: Principal entity retrieved successfully
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/EntityDtoOut'
+ '401':
+ description: Unauthorized - Missing or invalid token
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
+ '403':
+ description: Insufficient rights
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
+ '404':
+ description: Principal not found in catalog (JIT provisioning may have failed)
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
+ '500':
+ description: Unexpected server-side failure
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
+ /api/v1/audit/entities/{templateIdentifier}/{entityIdentifier}:
get:
tags:
- Audit
summary: Get entity audit history
- description: Retrieve the complete audit history for a specific entity, including
- all revisions with timestamps and modification types
+ description: Retrieve the complete audit history for a specific entity, including all revisions with timestamps and
+ modification types
operationId: getEntityAuditHistory
parameters:
- name: templateIdentifier
@@ -1040,35 +1152,42 @@ paths:
'200':
description: Successfully retrieved entity audit history
content:
- "*/*":
+ '*/*':
schema:
type: array
items:
- "$ref": "#/components/schemas/EntityAuditDtoOut"
+ $ref: '#/components/schemas/EntityAuditDtoOut'
'400':
description: Invalid template or entity identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'401':
description: Unauthorized - Missing or invalid token
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'403':
description: Insufficient rights
+ content:
+ application/problem+json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetail'
'404':
- description: Template not found with the provided identifier or Entity not
- found with the provided identifier
+ description: Template not found with the provided identifier or Entity not found with the provided identifier
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
+ $ref: '#/components/schemas/ProblemDetail'
'500':
description: Unexpected server-side failure
content:
- "*/*":
+ application/problem+json:
schema:
- "$ref": "#/components/schemas/ErrorResponse"
- "/actuator":
+ $ref: '#/components/schemas/ProblemDetail'
+ /actuator:
get:
tags:
- Actuator
@@ -1084,22 +1203,22 @@ paths:
additionalProperties:
type: object
additionalProperties:
- "$ref": "#/components/schemas/Link"
+ $ref: '#/components/schemas/Link'
application/vnd.spring-boot.actuator.v2+json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
- "$ref": "#/components/schemas/Link"
+ $ref: '#/components/schemas/Link'
application/json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
- "$ref": "#/components/schemas/Link"
- "/actuator/health":
+ $ref: '#/components/schemas/Link'
+ /actuator/health:
get:
tags:
- Actuator
@@ -1125,14 +1244,10 @@ components:
properties:
type:
type: string
- minLength: 1
config:
type: object
additionalProperties:
type: string
- required:
- - config
- - type
InboundWebhookUpdateDtoIn:
type: object
properties:
@@ -1149,7 +1264,7 @@ components:
items:
type: string
security:
- "$ref": "#/components/schemas/InboundWebhookSecurityContractDtoIn"
+ $ref: '#/components/schemas/InboundWebhookSecurityContractDtoIn'
required:
- name
EntityDynamicMappingDtoOut:
@@ -1173,7 +1288,7 @@ components:
description:
type: string
entity:
- "$ref": "#/components/schemas/InboundWebhookEntityMappingDtoOut"
+ $ref: '#/components/schemas/InboundWebhookEntityMappingDtoOut'
InboundWebhookDtoOut:
type: object
properties:
@@ -1188,9 +1303,9 @@ components:
mappings:
type: array
items:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
security:
- "$ref": "#/components/schemas/InboundWebhookSecurityDtoOut"
+ $ref: '#/components/schemas/InboundWebhookSecurityDtoOut'
InboundWebhookEntityMappingDtoOut:
type: object
properties:
@@ -1205,7 +1320,7 @@ components:
relations:
type: array
items:
- "$ref": "#/components/schemas/RelationMappingDtoOut"
+ $ref: '#/components/schemas/RelationMappingDtoOut'
InboundWebhookSecurityDtoOut:
type: object
properties:
@@ -1224,13 +1339,32 @@ components:
type: array
items:
type: string
- ErrorResponse:
+ ProblemDetail:
type: object
properties:
+ type:
+ type: string
+ format: uri
+ title:
+ type: string
+ status:
+ type: integer
+ format: int32
+ detail:
+ type: string
+ instance:
+ type: string
+ format: uri
error:
type: string
+ description: HTTP status name, e.g. NOT_FOUND
error_description:
type: string
+ description: Human-readable description of the error
+ timestamp:
+ type: string
+ format: date-time
+ description: Instant at which the error occurred
EntityDynamicMappingRelationDtoIn:
type: object
properties:
@@ -1268,7 +1402,7 @@ components:
description:
type: string
entity:
- "$ref": "#/components/schemas/EntityMappingDtoIn"
+ $ref: '#/components/schemas/EntityMappingDtoIn'
required:
- action
- entity
@@ -1291,7 +1425,7 @@ components:
relations:
type: array
items:
- "$ref": "#/components/schemas/EntityDynamicMappingRelationDtoIn"
+ $ref: '#/components/schemas/EntityDynamicMappingRelationDtoIn'
required:
- identifier
- name
@@ -1305,7 +1439,7 @@ components:
example: Service
maxLength: 255
minLength: 0
- pattern: "^[a-zA-Z0-9 _-]+$"
+ pattern: ^[a-zA-Z0-9 _-]+$
description:
type: string
description: Entity Template description
@@ -1314,12 +1448,12 @@ components:
type: array
description: List of property definitions for this template
items:
- "$ref": "#/components/schemas/PropertyDefinitionDtoIn"
+ $ref: '#/components/schemas/PropertyDefinitionDtoIn'
relations_definitions:
type: array
description: List of relation definitions for this template
items:
- "$ref": "#/components/schemas/RelationDefinitionDtoIn"
+ $ref: '#/components/schemas/RelationDefinitionDtoIn'
required:
- name
PropertyDefinitionDtoIn:
@@ -1350,7 +1484,7 @@ components:
description: Whether this property is required
example: true
rules:
- "$ref": "#/components/schemas/PropertyRulesDtoIn"
+ $ref: '#/components/schemas/PropertyRulesDtoIn'
description: Property validation rules
required:
- description
@@ -1378,7 +1512,7 @@ components:
regex:
type: string
description: Regular expression pattern for validation
- example: "^[a-zA-Z0-9]+$"
+ example: ^[a-zA-Z0-9]+$
max_length:
type: integer
format: int32
@@ -1446,12 +1580,12 @@ components:
type: array
description: List of property definitions for this template
items:
- "$ref": "#/components/schemas/PropertyDefinitionDtoOut"
+ $ref: '#/components/schemas/PropertyDefinitionDtoOut'
relations_definitions:
type: array
description: List of relation definitions for this template
items:
- "$ref": "#/components/schemas/RelationDefinitionDtoOut"
+ $ref: '#/components/schemas/RelationDefinitionDtoOut'
PropertyDefinitionDtoOut:
type: object
description: Output DTO for property definition
@@ -1477,7 +1611,7 @@ components:
description: Whether this property is required
example: true
rules:
- "$ref": "#/components/schemas/PropertyRulesDtoOut"
+ $ref: '#/components/schemas/PropertyRulesDtoOut'
description: Property validation rules
example: Property validation rules
PropertyRulesDtoOut:
@@ -1502,7 +1636,7 @@ components:
regex:
type: string
description: Regular expression for property validation
- example: "^[A-Za-z0-9]+$"
+ example: ^[A-Za-z0-9]+$
max_length:
type: integer
format: int32
@@ -1564,27 +1698,9 @@ components:
type: array
description: List of relations for this entity
items:
- "$ref": "#/components/schemas/RelationDtoIn"
+ $ref: '#/components/schemas/RelationDtoIn'
required:
- name
- EntityPatchDtoIn:
- type: object
- description: Input DTO for partially updating an entity. Omitted fields remain unchanged.
- properties:
- name:
- type: string
- description: Name of the entity
- example: my-web-service-updated
- properties:
- type: object
- additionalProperties:
- type: string
- description: Properties to merge with the existing entity properties
- relations:
- type: array
- description: Relations to merge with the existing entity relations
- items:
- "$ref": "#/components/schemas/RelationDtoIn"
RelationDtoIn:
type: object
description: Input DTO for an entity relation instance
@@ -1622,7 +1738,7 @@ components:
additionalProperties:
type: array
items:
- "$ref": "#/components/schemas/EntitySummaryDto"
+ $ref: '#/components/schemas/EntitySummaryDto'
EntitySummaryDto:
type: object
properties:
@@ -1632,6 +1748,10 @@ components:
type: string
template_identifier:
type: string
+ properties:
+ type: object
+ additionalProperties: {}
+ description: Property values for the related entity; included only when include_relations_properties=true
InboundWebhookCreateDtoIn:
type: object
properties:
@@ -1652,7 +1772,7 @@ components:
items:
type: string
security:
- "$ref": "#/components/schemas/InboundWebhookSecurityContractDtoIn"
+ $ref: '#/components/schemas/InboundWebhookSecurityContractDtoIn'
required:
- identifier
- name
@@ -1681,7 +1801,7 @@ components:
description:
type: string
entity:
- "$ref": "#/components/schemas/EntityMappingDtoIn"
+ $ref: '#/components/schemas/EntityMappingDtoIn'
required:
- action
- entity
@@ -1694,7 +1814,7 @@ components:
description: Request payload for a single entity dynamic mapping dry-run validation
properties:
mapping:
- "$ref": "#/components/schemas/EntityDynamicMappingCreateDtoIn"
+ $ref: '#/components/schemas/EntityDynamicMappingCreateDtoIn'
payload:
description: Sample JSON payload to test against the webhook mapping configuration
required:
@@ -1721,7 +1841,7 @@ components:
type: array
description: Extracted relations
items:
- "$ref": "#/components/schemas/DryRunRelationDto"
+ $ref: '#/components/schemas/DryRunRelationDto'
DryRunEntityResultDto:
type: object
properties:
@@ -1732,10 +1852,10 @@ components:
type: boolean
description: Whether the mapping was successful
entity:
- "$ref": "#/components/schemas/DryRunEntityDto"
+ $ref: '#/components/schemas/DryRunEntityDto'
description: Mapped entity data
error:
- "$ref": "#/components/schemas/DryRunErrorDto"
+ $ref: '#/components/schemas/DryRunErrorDto'
description: Error details
DryRunErrorDto:
type: object
@@ -1765,7 +1885,7 @@ components:
type: array
description: List of entity mapping results
items:
- "$ref": "#/components/schemas/DryRunEntityResultDto"
+ $ref: '#/components/schemas/DryRunEntityResultDto'
EntityTemplateCreateDtoIn:
type: object
description: Input DTO for creating an entity template
@@ -1781,7 +1901,7 @@ components:
example: Service
maxLength: 255
minLength: 0
- pattern: "^[a-zA-Z0-9 _-]+$"
+ pattern: ^[a-zA-Z0-9 _-]+$
description:
type: string
description: Entity Template description
@@ -1790,12 +1910,12 @@ components:
type: array
description: List of property definitions for this template
items:
- "$ref": "#/components/schemas/PropertyDefinitionDtoIn"
+ $ref: '#/components/schemas/PropertyDefinitionDtoIn'
relations_definitions:
type: array
description: List of relation definitions for this template
items:
- "$ref": "#/components/schemas/RelationDefinitionDtoIn"
+ $ref: '#/components/schemas/RelationDefinitionDtoIn'
required:
- identifier
- name
@@ -1825,7 +1945,7 @@ components:
type: array
description: List of relations for this entity
items:
- "$ref": "#/components/schemas/RelationDtoIn"
+ $ref: '#/components/schemas/RelationDtoIn'
required:
- identifier
- name
@@ -1835,14 +1955,12 @@ components:
properties:
query:
type: string
- description: Free-text search string. When present, returns entities whose
- identifier, name, templateIdentifier, or any property value contains this
- string (case-insensitive). Can be combined with filter.
+ description: Free-text search string. When present, returns entities whose identifier, name, templateIdentifier,
+ or any property value contains this string (case-insensitive). Can be combined with filter.
example: checkout
filter:
- "$ref": "#/components/schemas/FilterNodeDtoIn"
- description: Root node of the search filter tree. May be omitted or null
- to return all entities.
+ $ref: '#/components/schemas/FilterNodeDtoIn'
+ description: Root node of the search filter tree. May be omitted or null to return all entities.
page:
type: integer
format: int32
@@ -1853,45 +1971,39 @@ components:
type: integer
format: int32
default: 20
- description: Number of items per page. Defaults to 20.
+ description: Number of items per page. Defaults to 20. Must be between 1 and 500.
example: 20
sort:
type: string
- description: 'Sorting criteria in the format: property(,asc|desc). Defaults
- to identifier,asc.'
- example: identifier:asc
+ description: 'Sorting criteria in the format: property(,asc|desc). Defaults to identifier,asc.'
+ example: identifier,asc
FilterNodeDtoIn:
type: object
- description: A node in the search filter tree. Either a logical group (connector
- + criteria) or a leaf criterion (field + operation + value).
+ description: A node in the search filter tree. Either a logical group (connector + criteria) or a leaf criterion (field
+ + operation + value).
properties:
connector:
type: string
- description: 'Logical connector for a group node. One of: AND, OR. Required
- for group nodes.'
+ description: 'Logical connector for a group node. One of: AND, OR. Required for group nodes.'
example: AND
criteria:
type: array
- description: Child filter nodes for a group node. Required for group nodes
- (must be non-empty).
+ description: Child filter nodes for a group node. Required for group nodes (must be non-empty).
items:
- "$ref": "#/components/schemas/FilterNodeDtoIn"
+ $ref: '#/components/schemas/FilterNodeDtoIn'
field:
type: string
- description: 'Field to filter on for a criterion node. Required for leaf
- nodes. Examples: template, identifier, name, relation, property.language,
- relation.api-link, relation.api-link.identifier, relations_as_target.api-link.name'
+ description: 'Field to filter on for a criterion node. Required for leaf nodes. Examples: template, identifier,
+ name, relation, property.language, relation.api-link, relation.api-link.identifier, relations_as_target.api-link.name'
example: template
operation:
type: string
- description: 'Filter operation for a criterion node. One of: EQ, NEQ, CONTAINS,
- NOT_CONTAINS, STARTS_WITH, ENDS_WITH, GT, GTE, LT, LTE. Required for leaf
- nodes.'
+ description: 'Filter operation for a criterion node. One of: EQ, NEQ, CONTAINS, NOT_CONTAINS, STARTS_WITH, ENDS_WITH,
+ GT, GTE, LT, LTE. Required for leaf nodes.'
example: EQ
value:
type: string
- description: Value to compare against for a criterion node. Required for
- leaf nodes.
+ description: Value to compare against for a criterion node. Required for leaf nodes.
example: microservice
EntityPageResponse:
type: object
@@ -1900,24 +2012,24 @@ components:
content:
type: array
items:
- "$ref": "#/components/schemas/EntityDtoOut"
+ $ref: '#/components/schemas/EntityDtoOut'
pageable:
- "$ref": "#/components/schemas/PageableObject"
+ $ref: '#/components/schemas/PageableObject'
+ last:
+ type: boolean
totalElements:
type: integer
format: int64
totalPages:
type: integer
format: int32
- last:
- type: boolean
- sort:
- "$ref": "#/components/schemas/SortObject"
first:
type: boolean
numberOfElements:
type: integer
format: int32
+ sort:
+ $ref: '#/components/schemas/SortObject'
size:
type: integer
format: int32
@@ -1929,6 +2041,9 @@ components:
PageableObject:
type: object
properties:
+ offset:
+ type: integer
+ format: int64
paged:
type: boolean
pageNumber:
@@ -1938,21 +2053,38 @@ components:
type: integer
format: int32
sort:
- "$ref": "#/components/schemas/SortObject"
+ $ref: '#/components/schemas/SortObject'
unpaged:
type: boolean
- offset:
- type: integer
- format: int64
SortObject:
type: object
properties:
+ empty:
+ type: boolean
sorted:
type: boolean
unsorted:
type: boolean
- empty:
- type: boolean
+ EntityPatchDtoIn:
+ type: object
+ description: Input DTO for partially updating an entity
+ properties:
+ name:
+ type: string
+ description: Name of the entity
+ example: my-web-service-updated
+ properties:
+ type: object
+ additionalProperties:
+ type: string
+ description: Map of property name to value for this entity
+ example:
+ port: '8080'
+ relations:
+ type: array
+ description: List of relations for this entity
+ items:
+ $ref: '#/components/schemas/RelationDtoIn'
WebhookConnectorPageResponse:
type: object
description: Paginated response containing Inbound Webhook Connector objects
@@ -1960,24 +2092,24 @@ components:
content:
type: array
items:
- "$ref": "#/components/schemas/InboundWebhookDtoOut"
+ $ref: '#/components/schemas/InboundWebhookDtoOut'
pageable:
- "$ref": "#/components/schemas/PageableObject"
+ $ref: '#/components/schemas/PageableObject'
+ last:
+ type: boolean
totalElements:
type: integer
format: int64
totalPages:
type: integer
format: int32
- last:
- type: boolean
- sort:
- "$ref": "#/components/schemas/SortObject"
first:
type: boolean
numberOfElements:
type: integer
format: int32
+ sort:
+ $ref: '#/components/schemas/SortObject'
size:
type: integer
format: int32
@@ -1993,24 +2125,24 @@ components:
content:
type: array
items:
- "$ref": "#/components/schemas/EntityDynamicMappingDtoOut"
+ $ref: '#/components/schemas/EntityDynamicMappingDtoOut'
pageable:
- "$ref": "#/components/schemas/PageableObject"
+ $ref: '#/components/schemas/PageableObject'
+ last:
+ type: boolean
totalElements:
type: integer
format: int64
totalPages:
type: integer
format: int32
- last:
- type: boolean
- sort:
- "$ref": "#/components/schemas/SortObject"
first:
type: boolean
numberOfElements:
type: integer
format: int32
+ sort:
+ $ref: '#/components/schemas/SortObject'
size:
type: integer
format: int32
@@ -2026,24 +2158,24 @@ components:
content:
type: array
items:
- "$ref": "#/components/schemas/EntityTemplateDtoOut"
+ $ref: '#/components/schemas/EntityTemplateDtoOut'
pageable:
- "$ref": "#/components/schemas/PageableObject"
+ $ref: '#/components/schemas/PageableObject'
+ last:
+ type: boolean
totalElements:
type: integer
format: int64
totalPages:
type: integer
format: int32
- last:
- type: boolean
- sort:
- "$ref": "#/components/schemas/SortObject"
first:
type: boolean
numberOfElements:
type: integer
format: int32
+ sort:
+ $ref: '#/components/schemas/SortObject'
size:
type: integer
format: int32
@@ -2074,12 +2206,12 @@ components:
type: array
description: All entity nodes in the graph
items:
- "$ref": "#/components/schemas/EntityGraphNodeFlatDtoOut"
+ $ref: '#/components/schemas/EntityGraphNodeFlatDtoOut'
edges:
type: array
description: All directed relation edges in the graph
items:
- "$ref": "#/components/schemas/EntityGraphEdgeDtoOut"
+ $ref: '#/components/schemas/EntityGraphEdgeDtoOut'
EntityGraphNodeFlatDtoOut:
type: object
properties:
@@ -2098,8 +2230,7 @@ components:
data:
type: object
additionalProperties: {}
- description: Entity property values keyed by property name; present only
- when include_data=true is requested
+ description: Entity property values keyed by property name; present only when include_data=true is requested
EntityAuditDtoOut:
type: object
description: Audit information for an entity revision
@@ -2122,7 +2253,7 @@ components:
description: Identifier of the user who performed the modification
example: user@example.com
snapshot:
- "$ref": "#/components/schemas/EntitySnapshotDtoOut"
+ $ref: '#/components/schemas/EntitySnapshotDtoOut'
description: Snapshot of the entity state at this revision
EntitySnapshotDtoOut:
type: object
@@ -2144,12 +2275,12 @@ components:
type: array
description: Properties of the entity at this revision
items:
- "$ref": "#/components/schemas/PropertySnapshotDtoOut"
+ $ref: '#/components/schemas/PropertySnapshotDtoOut'
relations:
type: array
description: Relations of the entity at this revision
items:
- "$ref": "#/components/schemas/RelationSnapshotDtoOut"
+ $ref: '#/components/schemas/RelationSnapshotDtoOut'
PropertySnapshotDtoOut:
type: object
description: Snapshot of a property at a specific audit revision
diff --git a/docs/uv.lock b/docs/uv.lock
index 709fc259..005f2aa9 100644
--- a/docs/uv.lock
+++ b/docs/uv.lock
@@ -1,5 +1,5 @@
version = 1
-revision = 3
+revision = 5
requires-python = ">=3.14"
[[package]]
@@ -227,7 +227,7 @@ wheels = [
[[package]]
name = "zensical"
-version = "0.0.67"
+version = "0.0.73"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "click" },
@@ -240,15 +240,14 @@ dependencies = [
{ name = "pyyaml" },
{ name = "tomli" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/fc/11/d655563a922eb96bc930543132a6cb404971d980b36dcf7aa90751f4af8f/zensical-0.0.67.tar.gz", hash = "sha256:6691e79d1fec9e6235ded01a7d98c19342bfff144fceae7d043c4d3830890038", size = 4300450, upload-time = "2026-09-30T09:26:24.153Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/75/88/15bf6b4eef8895c37e96d6beb1c57fedcdcaa51527ba728869b81db0341d/zensical-0.0.67-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:2fbb86fb0773d32aab2ce5bb40be64a6962871ef049c925d633996a6f54d7130", size = 18057715, upload-time = "2026-09-30T09:26:01.536Z" },
- { url = "https://files.pythonhosted.org/packages/00/c0/bb8dd996633ba4ad2a0d73bd0b09381fff309cdccec965b0978746e22189/zensical-0.0.67-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:679a513ffb0013b6db3bd5aacbc73484f6a734df702e5ba41baf049753d38995", size = 17588275, upload-time = "2026-09-30T09:26:04.495Z" },
- { url = "https://files.pythonhosted.org/packages/c6/6b/f3aa259b9ee24a26de148d0d49a239683a43ecd985dd35b30cf0c3f5dead/zensical-0.0.67-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:100b21a42eb6f48c5f3fb89c7a4b3e3b12dcf6f7e2bd7da65b344842b1da30ad", size = 18039684, upload-time = "2026-09-30T09:26:06.963Z" },
- { url = "https://files.pythonhosted.org/packages/94/9c/f850af0905eb7319201f823a9fdedf32d0a479845dd3186e4a80f845f181/zensical-0.0.67-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:610c577a3d1200e21c443590e12334b46cb38ce0ef2dad12110afe19925160e2", size = 17988405, upload-time = "2026-09-30T09:26:09.578Z" },
- { url = "https://files.pythonhosted.org/packages/4b/ac/9a9210bb96cbeb848df301462ac2d557e67548366014f4fa33dac10385d8/zensical-0.0.67-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c9ee6369a253c9ff18f3c221bb48ac8c82eda22cb46f03650b937be8786b00b9", size = 18508864, upload-time = "2026-09-30T09:26:11.917Z" },
- { url = "https://files.pythonhosted.org/packages/f5/5d/7180698732ca5cf566f88300fa9ec487d81e852392be98d84d7cbc7cca80/zensical-0.0.67-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:7f9baff27363551dcdb4970936a126a714f7ac84fd646bb673e2676ff2ab526d", size = 18204439, upload-time = "2026-09-30T09:26:14.152Z" },
- { url = "https://files.pythonhosted.org/packages/9b/89/04d8768895a39bb0ea65c1275fca0af0b1e1e5f3722a075fbd77476c199a/zensical-0.0.67-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:3e1a7b7d5edf58394df235ade589b187da8f97107b11056ca989dbd6d7e646cc", size = 18769301, upload-time = "2026-09-30T09:26:16.585Z" },
- { url = "https://files.pythonhosted.org/packages/79/63/45108c9b220d73af5dc3577edf48c63f4336d7d80295fa2abc8c6ee3a4fe/zensical-0.0.67-cp310-abi3-win_amd64.whl", hash = "sha256:df5cc21899b4a5f3956d959e403dc754d7abcdcc2704c40dc43cff84e257b037", size = 18700647, upload-time = "2026-09-30T09:26:19.028Z" },
- { url = "https://files.pythonhosted.org/packages/93/43/09836dcb02085b7da0339d753b2b153352205209bfe14a3e16ec56740a0d/zensical-0.0.67-cp310-abi3-win_arm64.whl", hash = "sha256:20fb40bd0b8d05be92a793887e312de5b522fbda8fbdf80267395fd97baefc7b", size = 18120901, upload-time = "2026-09-30T09:26:21.683Z" },
+sdist = { url = "https://files.pythonhosted.org/packages/e8/49/1dada916f2537c065da395e0188fdc83d66a983af9926cf188e7150ce0cc/zensical-0.0.73.tar.gz", hash = "sha256:ddeca0695e1015a4fbd09b9a9e50e77a2bb43753bf7479dfb23255f35fd14450", size = 4350383, upload-time = "2026-10-26T13:04:05.768Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/2c/94/bc67421deb1e2c06776545d2450ec8142b132f587240ec87d33d3f196fe5/zensical-0.0.73-cp311-abi3-macosx_10_12_x86_64.whl", hash = "sha256:7bf70ebdb80628e17b5597d5da5669514df37b9e983b2c40e814b65c0f1bd9e1", size = 18278864, upload-time = "2026-10-26T12:05:47.987Z" },
+ { url = "https://files.pythonhosted.org/packages/e2/bf/6fda434e479e86fbc9c32d14a1641ac7a75d4ed07c840420e13049bd2f41/zensical-0.0.73-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:8411c5c16cefd04e139dedbdc38ae59cf503e4cc83b03613a790bbab64e2aace", size = 17799234, upload-time = "2026-10-26T12:05:51.043Z" },
+ { url = "https://files.pythonhosted.org/packages/24/ec/82c3964ae15db6659150f01217ac858355e6cd10f0ac65f8d9be9fa609d3/zensical-0.0.73-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9e27878c515ef1695b3587b762c2738c93dee1a0412c4c9b240583a968535e45", size = 18300892, upload-time = "2026-10-26T12:05:53.953Z" },
+ { url = "https://files.pythonhosted.org/packages/e1/a5/0a6ac4434cbaa7764ecf7d41a54b8ea81ae08c24fd2f5414cb61a60b0598/zensical-0.0.73-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b45462e8925f8eb1d45aeed09dea1450c57d2533bfc28214af4a4a9e910e9e", size = 18798355, upload-time = "2026-10-26T12:05:58.838Z" },
+ { url = "https://files.pythonhosted.org/packages/ff/0a/6d9b7a36b6f950e124b1711de16588da1d4e436097c94afede8d8de4d8d9/zensical-0.0.73-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:5c79302dec347e1d2c7b3e0961ac56c97134f59c6f5cff786b81accf50b3bbb2", size = 18476606, upload-time = "2026-10-26T12:06:01.184Z" },
+ { url = "https://files.pythonhosted.org/packages/08/d6/1e9b02225ceb6905c50d320e8e9edd3d541de4243b785d6c4313e605ec36/zensical-0.0.73-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:02a20d9cce5a5b976671d02550a8e65fcea49230a12978bf3c13b497f542ea16", size = 19057264, upload-time = "2026-10-26T12:06:03.485Z" },
+ { url = "https://files.pythonhosted.org/packages/35/b8/6f894a0efe07863f0b16afc7c0aa524fd33efb3565c338b89a8c3a9b0c04/zensical-0.0.73-cp311-abi3-win_amd64.whl", hash = "sha256:d8f7b9e03a6280f67f55afd1a9a17937778d77ba7490124b11393bb79220a60d", size = 19005486, upload-time = "2026-10-26T13:04:00.768Z" },
+ { url = "https://files.pythonhosted.org/packages/3c/18/1b25f5d450fbc3145d595f9d3a414ae993da6db002b476f68eb8f9c17bd0/zensical-0.0.73-cp311-abi3-win_arm64.whl", hash = "sha256:a68b0d23b9de360a1f1867c56c786d77947616eca42195c4cc1f18a1e1686bbf", size = 18408634, upload-time = "2026-10-26T13:04:03.376Z" },
]
diff --git a/flyway-migration-order-report.md b/flyway-migration-order-report.md
deleted file mode 100644
index e69de29b..00000000
diff --git a/mvnw b/mvnw
index df1a80ac..1ddd97b9 100755
--- a/mvnw
+++ b/mvnw
@@ -19,7 +19,7 @@
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# Apache Maven Wrapper startup batch script, version @@project.version@@
+# Apache Maven Wrapper startup batch script, version 3.3.4
#
# Required ENV vars:
# ------------------
@@ -220,9 +220,9 @@ else
log "Couldn't find $wrapperJarPath, downloading it ..."
if [ -n "$MVNW_REPOURL" ]; then
- wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar"
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
else
- wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar"
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
fi
while IFS="=" read -r key value; do
case "$key" in wrapperUrl)
@@ -290,7 +290,7 @@ done <"$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
if [ -n "$wrapperSha256Sum" ]; then
wrapperSha256Result=false
if command -v sha256sum >/dev/null; then
- if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c --strict - >/dev/null 2>&1; then
+ if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c - >/dev/null 2>&1; then
wrapperSha256Result=true
fi
elif command -v shasum >/dev/null; then
diff --git a/mvnw.cmd b/mvnw.cmd
index 97fff177..c453424c 100644
--- a/mvnw.cmd
+++ b/mvnw.cmd
@@ -1,206 +1,206 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Apache Maven Wrapper startup batch script, version @@project.version@@
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
-if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo. >&2
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo. >&2
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo. >&2
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo. >&2
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar"
-
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
-) else (
- if not "%MVNW_REPOURL%" == "" (
- SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/@@project.version@@/maven-wrapper-@@project.version@@.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %WRAPPER_URL%
- )
-
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
-)
-@REM End of extension
-
-@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
-SET WRAPPER_SHA_256_SUM=""
-FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
-)
-IF NOT %WRAPPER_SHA_256_SUM%=="" (
- powershell -Command "&{"^
- "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^
- "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
- "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
- " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
- " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
- " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
- " exit 1;"^
- "}"^
- "}"
- if ERRORLEVEL 1 goto error
-)
-
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% ^
- %JVM_CONFIG_MAVEN_PROPS% ^
- %MAVEN_OPTS% ^
- %MAVEN_DEBUG_OPTS% ^
- -classpath %WRAPPER_JAR% ^
- "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
- %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
-if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%"=="on" pause
-
-if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
-
-cmd /C exit /B %ERROR_CODE%
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.3.4
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo. >&2
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo. >&2
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo. >&2
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo. >&2
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %WRAPPER_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
+SET WRAPPER_SHA_256_SUM=""
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
+)
+IF NOT %WRAPPER_SHA_256_SUM%=="" (
+ powershell -Command "&{"^
+ "Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash;"^
+ "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
+ "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
+ " Write-Error 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
+ " Write-Error 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
+ " Write-Error 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
+ " exit 1;"^
+ "}"^
+ "}"
+ if ERRORLEVEL 1 goto error
+)
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/pom.xml b/pom.xml
index 456b4c59..031dcc4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.springframework.bootspring-boot-starter-parent
- 4.1.0
+ 4.1.2
@@ -18,19 +18,16 @@
25
- 2.2.52
- 1.18.46
- 7.4.0
+ 2.2.55
+ 1.18.48
+ 9.2.01.21.4
- 3.15.0
- 0.8.15
- 1.2.1
+ 3.16.0
+ 0.8.16
+ 1.2.21.6.3
- 1.4.2
- 4.2.16.Final
- 7.1.0
- 7.0.8
- 42.7.12
+ 1.5.1
+ 4.2.20.Final10.9.1security
@@ -73,15 +70,10 @@
org.apache.tomcat.embedtomcat-embed-el
-
- tools.jackson.core
- jackson-databind
- 3.1.5
- org.apache.camel.springbootcamel-spring-boot-bom
- 4.21.0
+ 4.23.0pomimport
@@ -103,7 +95,7 @@
org.apache.httpcomponents.client5httpclient5
- 5.6.3
+ 5.6.5
@@ -244,14 +236,14 @@
org.springdocspringdoc-openapi-starter-webmvc-ui
- 3.0.3
+ 3.2.0io.swagger.parser.v3swagger-parser
- 2.1.45
+ 2.1.48test
@@ -268,16 +260,16 @@
org.apache.commonscommons-lang3
- 3.20.0
+ 3.21.0
+ execution -->
com.schibsted.spt.datajslt
- 0.1.14
+ 0.1.15
@@ -337,6 +329,21 @@
camel-rest-starter
+
+ org.springframework.boot
+ spring-boot-starter-opentelemetry
+
+
+
+ org.apache.camel.springboot
+ camel-opentelemetry2-starter
+
+
+
+ org.apache.camel.springboot
+ camel-micrometer-starter
+
+
@@ -361,13 +368,13 @@
org.sonarsource.scanner.mavensonar-maven-plugin
- 5.7.0.6970
+ 5.8.0.7211org.flywaydbflyway-maven-plugin
- 13.0.0
+ 13.12.1
@@ -491,7 +498,7 @@
com.github.spotbugsspotbugs-maven-plugin
- 4.10.3.0
+ 4.10.5.0true${project.build.directory}
@@ -510,7 +517,7 @@
com.github.codemonsturmaven-check-license
- 1.2.0
+ 1.5.0truepassOnMatch
@@ -545,6 +552,7 @@
org.hibernate.orm:hibernate-core:6.6.29.Finalch.qos.logback:logback-classic:1.5.34ch.qos.logback:logback-core:1.5.34
+ org.codehaus.mojo:animal-sniffer-annotations:1.26
@@ -561,7 +569,7 @@
com.diffplug.spotlessspotless-maven-plugin
- 3.8.0
+ 3.11.0
diff --git a/src/main/java/com/decathlon/idp_core/domain/constant/JsltConstraints.java b/src/main/java/com/decathlon/idp_core/domain/constant/JsltConstraints.java
new file mode 100644
index 00000000..2a0e4d67
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/constant/JsltConstraints.java
@@ -0,0 +1,21 @@
+package com.decathlon.idp_core.domain.constant;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+/// Domain constants for JSLT mapping safety limits (DoS prevention).
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class JsltConstraints {
+
+ /// Maximum size (in UTF-8 bytes) of a raw payload accepted for mapping.
+ public static final int MAX_PAYLOAD_BYTES = 1024 * 1024;
+
+ /// Maximum JSON nesting depth of a raw payload accepted for mapping.
+ public static final int MAX_JSON_DEPTH = 64;
+
+ /// Maximum length (in characters) of a JSLT expression.
+ public static final int MAX_EXPRESSION_LENGTH = 10_000;
+
+ /// Maximum wall-clock time (in milliseconds) allowed for one JSLT evaluation.
+ public static final long EVALUATION_TIMEOUT_MS = 5_000L;
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/constant/SearchConstraints.java b/src/main/java/com/decathlon/idp_core/domain/constant/SearchConstraints.java
index 08723413..e2964a76 100644
--- a/src/main/java/com/decathlon/idp_core/domain/constant/SearchConstraints.java
+++ b/src/main/java/com/decathlon/idp_core/domain/constant/SearchConstraints.java
@@ -11,8 +11,14 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SearchConstraints {
- /// Maximum number of entities returned per page in a search request.
- public static final int MAX_PAGE_SIZE = 500;
+ /// Page size applied when a request omits `size`. Capped at the configured
+ /// maximum.
+ public static final int DEFAULT_PAGE_SIZE = 20;
+
+ /// Default maximum number of entities returned per page in a search request.
+ /// The effective limit is configurable via `app.max-page-size` (env
+ /// `MAX_PAGE_SIZE`).
+ public static final int DEFAULT_MAX_PAGE_SIZE = 500;
/// Maximum length (in characters) of the free-text `query` parameter.
public static final int MAX_QUERY_LENGTH = 255;
diff --git a/src/main/java/com/decathlon/idp_core/domain/constant/ValidationMessages.java b/src/main/java/com/decathlon/idp_core/domain/constant/ValidationMessages.java
index b230f849..dc3149fe 100644
--- a/src/main/java/com/decathlon/idp_core/domain/constant/ValidationMessages.java
+++ b/src/main/java/com/decathlon/idp_core/domain/constant/ValidationMessages.java
@@ -84,6 +84,9 @@ public class ValidationMessages {
// Principal provisioning validation messages
public static final String PRINCIPAL_CREATION_FAILED = "Failed to create principal with identifier '%s'. The principal provider is currently unavailable. The system will automatically retry provisioning on the next request.";
+ // Authorization validation messages
+ public static final String AUTHORIZATION_VALUE_MUST_NOT_BE_NULL = "%s must not be null";
+
// Helper method to construct rules incompatibility message
public static String rulesAreIncompatible(String rule1, String rule2) {
return PROPERTY_RULES_MUTUALLY_EXCLUSIVE.replace("{rule1}", rule1).replace("{rule2}", rule2);
@@ -100,6 +103,14 @@ public static String minMaxConstraintViolated(String constraint) {
return PROPERTY_RULES_MIN_MAX_CONSTRAINT_VIOLATED.replace("{constraint}", constraint);
}
+ public static String authorizationValueMustNotBeNull(String fieldName) {
+ return AUTHORIZATION_VALUE_MUST_NOT_BE_NULL.formatted(fieldName);
+ }
+ // Pagination validation messages
+ public static final String PAGE_SIZE_TOO_LARGE = "Page size must not exceed %d";
+ public static final String PAGE_SIZE_NOT_INTEGER = "Page size must be an integer";
+ public static final String PAGE_INDEX_NOT_INTEGER = "Page index must be an integer";
+
// Filter query validation messages
public static final String FILTER_TOO_MANY_CRITERIA = "Filter query exceeds maximum of %d criteria";
public static final String FILTER_VALUE_TOO_LONG = "Filter value must not exceed %d characters in criterion '%s'";
@@ -123,8 +134,7 @@ public static String minMaxConstraintViolated(String constraint) {
public static final String SEARCH_QUERY_TOO_LONG = "Search query must not exceed %d characters";
public static final String SEARCH_NUMERIC_OPERATOR_REQUIRES_PROPERTY = "Operator '%s' is only valid for property.{name} fields";
public static final String SEARCH_INVALID_SORT_FIELD = "Invalid sort field '%s'. Supported fields: identifier, name, templateIdentifier";
- public static final String SEARCH_INVALID_SORT_FORMAT = "Invalid sort expression '%s'. Expected format: field or field:asc|desc";
- public static final String SEARCH_PAGE_SIZE_TOO_LARGE = "Page size must not exceed %d";
+ public static final String SEARCH_INVALID_SORT_FORMAT = "Invalid sort expression '%s'. Expected format: field[,asc|desc] or field alone";
public static final String SEARCH_PAGE_INVALID = "Page index must be 0 or greater";
public static final String SEARCH_SIZE_INVALID = "Page size must be greater than 0";
public static final String SEARCH_NUMERIC_OPERATOR_INVALID_VALUE = "Value '%s' is not a valid number for operator '%s'";
diff --git a/src/main/java/com/decathlon/idp_core/domain/exception/authorization/PrincipalNotAuthorizedException.java b/src/main/java/com/decathlon/idp_core/domain/exception/authorization/PrincipalNotAuthorizedException.java
new file mode 100644
index 00000000..011f1427
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/exception/authorization/PrincipalNotAuthorizedException.java
@@ -0,0 +1,22 @@
+package com.decathlon.idp_core.domain.exception.authorization;
+
+/// Indicates that a principal is not permitted to perform the requested operation.
+public class PrincipalNotAuthorizedException extends RuntimeException {
+
+ private final String identifier;
+
+ /// Creates an authorization failure for the specified principal.
+ ///
+ /// @param identifier the identifier of the principal denied access
+ public PrincipalNotAuthorizedException(String identifier) {
+ super("Principal '" + identifier + "' is not authorized to perform this operation");
+ this.identifier = identifier;
+ }
+
+ /// Returns the identifier of the principal denied access.
+ ///
+ /// @return the principal identifier
+ public String getIdentifier() {
+ return identifier;
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationAction.java b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationAction.java
new file mode 100644
index 00000000..0dd04367
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationAction.java
@@ -0,0 +1,6 @@
+package com.decathlon.idp_core.domain.model.authorization;
+
+/// CRUD operation requested against a platform resource.
+public enum AuthorizationAction {
+ CREATE, READ, UPDATE, DELETE, UNSUPPORTED
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationMode.java b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationMode.java
new file mode 100644
index 00000000..747769c8
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationMode.java
@@ -0,0 +1,6 @@
+package com.decathlon.idp_core.domain.model.authorization;
+
+/// Authorization strategies supported by the platform.
+public enum AuthorizationMode {
+ GLOBAL, RBAC, ABAC
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationPolicy.java b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationPolicy.java
new file mode 100644
index 00000000..2466c18f
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationPolicy.java
@@ -0,0 +1,23 @@
+package com.decathlon.idp_core.domain.model.authorization;
+
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+
+import com.decathlon.idp_core.domain.constant.ValidationMessages;
+
+/// Immutable authorization configuration used by domain authorization services.
+public record AuthorizationPolicy(AuthorizationMode mode, Set globalPrincipalIdentifiers,
+ Optional requiredPrincipalProperty) {
+
+ public AuthorizationPolicy {
+ Objects.requireNonNull(mode, ValidationMessages.authorizationValueMustNotBeNull("mode"));
+ globalPrincipalIdentifiers = globalPrincipalIdentifiers != null
+ ? Set.copyOf(globalPrincipalIdentifiers)
+ : Set.of();
+ Objects.requireNonNull(requiredPrincipalProperty,
+ ValidationMessages.authorizationValueMustNotBeNull("requiredPrincipalProperty"));
+ requiredPrincipalProperty = requiredPrincipalProperty.map(String::trim)
+ .filter(propertyName -> !propertyName.isBlank());
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationRequest.java b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationRequest.java
new file mode 100644
index 00000000..6322f6dd
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationRequest.java
@@ -0,0 +1,26 @@
+package com.decathlon.idp_core.domain.model.authorization;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import jakarta.validation.constraints.NotNull;
+
+import com.decathlon.idp_core.domain.constant.ValidationMessages;
+import com.decathlon.idp_core.domain.model.entity.Entity;
+import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
+
+/// Domain input describing a principal's request without infrastructure types.
+public record AuthorizationRequest(@NotNull PrincipalInfo principal,
+ @NotNull Optional principalEntity, @NotNull AuthorizationAction action,
+ @NotNull AuthorizationResource resource) {
+
+ public AuthorizationRequest {
+ Objects.requireNonNull(principal,
+ ValidationMessages.authorizationValueMustNotBeNull("principal"));
+ Objects.requireNonNull(principalEntity,
+ ValidationMessages.authorizationValueMustNotBeNull("principalEntity"));
+ Objects.requireNonNull(action, ValidationMessages.authorizationValueMustNotBeNull("action"));
+ Objects.requireNonNull(resource,
+ ValidationMessages.authorizationValueMustNotBeNull("resource"));
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationResource.java b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationResource.java
new file mode 100644
index 00000000..842129bf
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/authorization/AuthorizationResource.java
@@ -0,0 +1,28 @@
+package com.decathlon.idp_core.domain.model.authorization;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+
+import com.decathlon.idp_core.domain.constant.ValidationMessages;
+
+/// Identifies the resource and optional parent context for an authorization request.
+public record AuthorizationResource(@NotBlank String type, @NotNull Optional identifier,
+ @NotNull Optional parentIdentifier) {
+
+ public static final String INBOUND_WEBHOOK_CONFIGURATION = "inbound_webhook_configuration";
+ public static final String ENTITY_DYNAMIC_MAPPING = "entity_dynamic_mapping";
+ public static final String ENTITY_TEMPLATE = "entity_template";
+ public static final String PRINCIPAL_TEMPLATE_IDENTIFIER = "principal";
+ public static final String PRINCIPAL_SELF = "principal_self";
+
+ public AuthorizationResource {
+ Objects.requireNonNull(type, ValidationMessages.authorizationValueMustNotBeNull("type"));
+ Objects.requireNonNull(identifier,
+ ValidationMessages.authorizationValueMustNotBeNull("identifier"));
+ Objects.requireNonNull(parentIdentifier,
+ ValidationMessages.authorizationValueMustNotBeNull("parentIdentifier"));
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/enums/RelationTargetValidationMode.java b/src/main/java/com/decathlon/idp_core/domain/model/enums/RelationTargetValidationMode.java
new file mode 100644
index 00000000..62489dfa
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/enums/RelationTargetValidationMode.java
@@ -0,0 +1,10 @@
+package com.decathlon.idp_core.domain.model.enums;
+
+/// Controls how relation target identifiers are checked during entity writes.
+public enum RelationTargetValidationMode {
+ /// Requires every non-blank relation target identifier to resolve to an entity.
+ STRICT,
+
+ /// Filters unresolved identifiers from optional relations.
+ TOLERANT
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurity.java b/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurity.java
index 9aba1e97..afbda12c 100644
--- a/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurity.java
+++ b/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurity.java
@@ -14,9 +14,10 @@ public record WebhookSecurity(WebhookSecurityType type, Map conf
if (type == null) {
throw new WebhookSecurityConfigurationException(WEBHOOK_CONNECTOR_SECURITY_TYPE_MANDATORY);
}
- if (config == null) {
+ // NONE needs no config: a missing config is normalized to an empty map
+ if (config == null && type != WebhookSecurityType.NONE) {
throw new WebhookSecurityConfigurationException(WEBHOOK_CONNECTOR_SECURITY_CONFIG_MANDATORY);
}
- config = Map.copyOf(config);
+ config = config == null ? Map.of() : Map.copyOf(config);
}
}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurityValidationPolicy.java b/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurityValidationPolicy.java
new file mode 100644
index 00000000..b19b5a8f
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/inbound_connectors/webhook/WebhookSecurityValidationPolicy.java
@@ -0,0 +1,7 @@
+package com.decathlon.idp_core.domain.model.inbound_connectors.webhook;
+
+/// Domain policy controlling which webhook security configurations are allowed.
+///
+/// @param allowNone whether connectors may be created without webhook authentication
+public record WebhookSecurityValidationPolicy(boolean allowNone) {
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/search/PaginationCriteria.java b/src/main/java/com/decathlon/idp_core/domain/model/search/PaginationCriteria.java
index 9c425a5a..dd283c61 100644
--- a/src/main/java/com/decathlon/idp_core/domain/model/search/PaginationCriteria.java
+++ b/src/main/java/com/decathlon/idp_core/domain/model/search/PaginationCriteria.java
@@ -1,4 +1,32 @@
package com.decathlon.idp_core.domain.model.search;
+import com.decathlon.idp_core.domain.constant.ValidationMessages;
+import com.decathlon.idp_core.domain.exception.search.InvalidSearchQueryException;
+
public record PaginationCriteria(int page, int size, String sort) {
+
+ /// Checks that page is non-negative and size is at least 1, without an upper
+ /// bound.
+ ///
+ /// @throws InvalidSearchQueryException when page or size is out of range
+ public void validateRange() {
+ if (page < 0) {
+ throw new InvalidSearchQueryException(ValidationMessages.SEARCH_PAGE_INVALID);
+ }
+ if (size <= 0) {
+ throw new InvalidSearchQueryException(ValidationMessages.SEARCH_SIZE_INVALID);
+ }
+ }
+
+ /// Checks that page is non-negative and size is between 1 and `maxPageSize`.
+ ///
+ /// @param maxPageSize configured maximum number of items per page
+ /// @throws InvalidSearchQueryException when page or size is out of bounds
+ public void validateBounds(int maxPageSize) {
+ validateRange();
+ if (size > maxPageSize) {
+ throw new InvalidSearchQueryException(
+ ValidationMessages.PAGE_SIZE_TOO_LARGE.formatted(maxPageSize));
+ }
+ }
}
diff --git a/src/main/java/com/decathlon/idp_core/domain/model/search/SortCriteria.java b/src/main/java/com/decathlon/idp_core/domain/model/search/SortCriteria.java
new file mode 100644
index 00000000..16b66634
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/model/search/SortCriteria.java
@@ -0,0 +1,9 @@
+package com.decathlon.idp_core.domain.model.search;
+
+/// A validated entity sort field and direction.
+public record SortCriteria(String field, Direction direction) {
+
+ public enum Direction {
+ ASC, DESC
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/port/audit/AuditIdentityProviderPort.java b/src/main/java/com/decathlon/idp_core/domain/port/audit/AuditIdentityProviderPort.java
new file mode 100644
index 00000000..56f6f7cb
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/port/audit/AuditIdentityProviderPort.java
@@ -0,0 +1,15 @@
+package com.decathlon.idp_core.domain.port.audit;
+
+/// Provides the authenticated identity associated with an audit revision.
+public interface AuditIdentityProviderPort {
+
+ /// Returns the identifier recorded for the authenticated user.
+ ///
+ /// @return authenticated user identifier
+ String getAuthId();
+
+ /// Returns the name associated with the authenticated user.
+ ///
+ /// @return authenticated user name
+ String getName();
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/authorization/GlobalAuthorizationService.java b/src/main/java/com/decathlon/idp_core/domain/service/authorization/GlobalAuthorizationService.java
new file mode 100644
index 00000000..998d2d74
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/service/authorization/GlobalAuthorizationService.java
@@ -0,0 +1,84 @@
+package com.decathlon.idp_core.domain.service.authorization;
+
+import org.springframework.stereotype.Service;
+
+import com.decathlon.idp_core.domain.exception.authorization.PrincipalNotAuthorizedException;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationAction;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationMode;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationPolicy;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationRequest;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationResource;
+import com.decathlon.idp_core.domain.model.entity.Entity;
+import com.decathlon.idp_core.domain.model.principal.PrincipalKind;
+
+/// Applies the global authorization policy to a principal request.
+@Service
+public class GlobalAuthorizationService {
+
+ private static final String IS_ADMIN_PROPERTY = "is_admin";
+ private static final String PRINCIPAL_TEMPLATE_IDENTIFIER = AuthorizationResource.PRINCIPAL_TEMPLATE_IDENTIFIER;
+ private static final String ENTITY_RESOURCE = "entity";
+ private static final String ENTITY_SEARCH_RESOURCE = "entity_search";
+ private static final String ENTITY_TEMPLATE_RESOURCE = AuthorizationResource.ENTITY_TEMPLATE;
+ private static final String PRINCIPAL_SELF_RESOURCE = AuthorizationResource.PRINCIPAL_SELF;
+
+ /// Applies the global authorization matrix, including the break-glass bypass.
+ ///
+ /// @param request the principal and operation being authorized
+ /// @param policy the configured global authorization policy
+ /// @throws PrincipalNotAuthorizedException when the request is not permitted
+ public void authorize(AuthorizationRequest request, AuthorizationPolicy policy) {
+ String identifier = request.principal().identifier();
+ if (policy.mode() != AuthorizationMode.GLOBAL
+ || request.action() == AuthorizationAction.UNSUPPORTED) {
+ throw new PrincipalNotAuthorizedException(identifier);
+ }
+
+ if (policy.globalPrincipalIdentifiers().contains(identifier)) {
+ return;
+ }
+
+ boolean catalogAdministrator = request.principalEntity().filter(this::isCatalogAdministrator)
+ .isPresent();
+ if (catalogAdministrator) {
+ return;
+ }
+
+ boolean missingConfiguredAccessProperty = request.principal().kind() == PrincipalKind.HUMAN
+ && policy.requiredPrincipalProperty()
+ .map(propertyName -> request.principalEntity()
+ .filter(entity -> hasRequiredPrincipalProperty(entity, propertyName)).isEmpty())
+ .orElse(false);
+ if (missingConfiguredAccessProperty) {
+ throw new PrincipalNotAuthorizedException(identifier);
+ }
+
+ if (PRINCIPAL_SELF_RESOURCE.equals(request.resource().type())
+ && request.action() == AuthorizationAction.READ) {
+ return;
+ }
+
+ boolean readOnlyResource = ENTITY_RESOURCE.equals(request.resource().type())
+ || ENTITY_SEARCH_RESOURCE.equals(request.resource().type())
+ || ENTITY_TEMPLATE_RESOURCE.equals(request.resource().type());
+ if (readOnlyResource && request.action() == AuthorizationAction.READ) {
+ return;
+ }
+
+ throw new PrincipalNotAuthorizedException(identifier);
+ }
+
+ private boolean isCatalogAdministrator(Entity principalEntity) {
+ return PRINCIPAL_TEMPLATE_IDENTIFIER.equals(principalEntity.templateIdentifier())
+ && principalEntity.properties().stream()
+ .anyMatch(property -> IS_ADMIN_PROPERTY.equals(property.name())
+ && Boolean.parseBoolean(property.value()));
+ }
+
+ private boolean hasRequiredPrincipalProperty(Entity principalEntity, String propertyName) {
+ return PRINCIPAL_TEMPLATE_IDENTIFIER.equals(principalEntity.templateIdentifier())
+ && principalEntity.properties().stream()
+ .anyMatch(property -> propertyName.equals(property.name())
+ && Boolean.parseBoolean(property.value()));
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityAuditService.java b/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityAuditService.java
index 592e3253..5b1aaaf7 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityAuditService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityAuditService.java
@@ -7,7 +7,6 @@
import com.decathlon.idp_core.domain.model.entity.EntityAuditInfo;
import com.decathlon.idp_core.domain.port.audit.EntityAuditPort;
-import com.decathlon.idp_core.domain.service.entity_template.EntityTemplateService;
import lombok.RequiredArgsConstructor;
@@ -28,7 +27,6 @@
public class EntityAuditService {
private final EntityAuditPort entityAuditPort;
- private final EntityTemplateService entityTemplateService;
/// Retrieves the complete audit history for a specific entity.
///
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityService.java b/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityService.java
index 6a583887..809c5f8b 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityService.java
@@ -18,8 +18,6 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
-import com.decathlon.idp_core.domain.constant.SearchConstraints;
-import com.decathlon.idp_core.domain.constant.ValidationMessages;
import com.decathlon.idp_core.domain.exception.entity.EntityAlreadyExistsException;
import com.decathlon.idp_core.domain.exception.entity.EntityDeletionBlockedException;
import com.decathlon.idp_core.domain.exception.entity.EntityNotFoundException;
@@ -43,6 +41,7 @@
import com.decathlon.idp_core.domain.service.entity_template.EntityTemplateValidationService;
import com.decathlon.idp_core.domain.service.filter.EntityFilterDslParser;
import com.decathlon.idp_core.domain.service.search.SearchFilterValidationService;
+import com.decathlon.idp_core.domain.service.search.SortParameterParser;
import lombok.RequiredArgsConstructor;
@@ -162,9 +161,9 @@ public Entity createEntity(@Valid Entity entity) {
// Enrich relations with target template identifiers from template definition
Entity enrichedEntity = enrichRelationsWithTargetTemplates(entity, template);
- entityValidationService.validateForCreation(enrichedEntity, template);
+ Entity validatedEntity = entityValidationService.validateForCreation(enrichedEntity, template);
- return entityRepository.save(enrichedEntity);
+ return entityRepository.save(validatedEntity);
}
/// Updates an existing entity identified by template and entity identifiers.
@@ -194,11 +193,11 @@ public Entity updateEntity(String templateIdentifier, String entityIdentifier,
// Enrich relations with target template identifiers from template definition
Entity enrichedEntity = enrichRelationsWithTargetTemplates(entityToSave, template);
- entityValidationService.validateForUpdate(enrichedEntity, template);
+ Entity validatedEntity = entityValidationService.validateForUpdate(enrichedEntity, template);
// Only save if there are actual changes to avoid unnecessary audit records
- if (hasEntityChanged(existingEntity, enrichedEntity)) {
- return entityRepository.save(enrichedEntity);
+ if (hasEntityChanged(existingEntity, validatedEntity)) {
+ return entityRepository.save(validatedEntity);
}
return existingEntity;
@@ -247,10 +246,10 @@ public Entity patchEntity(String templateIdentifier, String entityIdentifier,
new ArrayList<>(mergedProperties.values()), new ArrayList<>(mergedRelations.values()));
Entity updatedEntity = enrichRelationsWithTargetTemplates(entityToSave, template);
- entityValidationService.validateForUpdate(updatedEntity, template);
+ Entity validatedEntity = entityValidationService.validateForUpdate(updatedEntity, template);
- if (hasEntityChanged(existingEntity, updatedEntity)) {
- return entityRepository.save(updatedEntity);
+ if (hasEntityChanged(existingEntity, validatedEntity)) {
+ return entityRepository.save(validatedEntity);
}
return existingEntity;
@@ -631,14 +630,14 @@ private Entity retrieveEntity(final String templateIdentifier, final String enti
/// and all property values; null means no text restriction
/// @param paginationCriteria contains page (zero-based), size (1 to
/// MAX_PAGE_SIZE),
- /// and optional sort expression (`field` or `field:asc|desc`)
+ /// and optional sort expression (`field` or `field,asc|desc`)
/// @return paginated entities matching the filter and query
/// @throws InvalidSearchQueryException when pagination parameters are invalid
@Transactional(readOnly = true)
public PaginatedResult searchEntities(SearchFilterNode filter, String query,
- PaginationCriteria paginationCriteria) {
+ PaginationCriteria paginationCriteria, int maxPageSize) {
searchFilterValidationService.validate(filter, query);
- validatePaginationCriteria(paginationCriteria);
+ validatePaginationCriteria(paginationCriteria, maxPageSize);
return entityRepository.search(filter, query, paginationCriteria);
}
@@ -654,41 +653,9 @@ public boolean entityExists(String templateIdentifier, String entityIdentifier)
.findByTemplateIdentifierAndIdentifier(templateIdentifier, entityIdentifier).isPresent();
}
- private void validatePaginationCriteria(PaginationCriteria criteria) {
- if (criteria.page() < 0) {
- throw new InvalidSearchQueryException(ValidationMessages.SEARCH_PAGE_INVALID);
- }
- if (criteria.size() <= 0) {
- throw new InvalidSearchQueryException(ValidationMessages.SEARCH_SIZE_INVALID);
- }
- if (criteria.size() > SearchConstraints.MAX_PAGE_SIZE) {
- throw new InvalidSearchQueryException(
- ValidationMessages.SEARCH_PAGE_SIZE_TOO_LARGE.formatted(SearchConstraints.MAX_PAGE_SIZE));
- }
- String sort = criteria.sort();
- if (sort != null && !sort.isBlank()) {
- validateSortExpression(sort);
- }
- }
-
- private void validateSortExpression(String sortExpression) {
- String[] parts = sortExpression.split(":");
- if (parts.length > 2) {
- throw new InvalidSearchQueryException(
- ValidationMessages.SEARCH_INVALID_SORT_FORMAT.formatted(sortExpression));
- }
- String property = parts[0].trim();
- if (!SearchConstraints.ALLOWED_SORT_FIELDS.contains(property)) {
- throw new InvalidSearchQueryException(
- ValidationMessages.SEARCH_INVALID_SORT_FIELD.formatted(property));
- }
- if (parts.length == 2) {
- String direction = parts[1].trim().toLowerCase();
- if (!direction.equals("asc") && !direction.equals("desc")) {
- throw new InvalidSearchQueryException(
- ValidationMessages.SEARCH_INVALID_SORT_FORMAT.formatted(sortExpression));
- }
- }
+ private void validatePaginationCriteria(PaginationCriteria criteria, int maxPageSize) {
+ criteria.validateBounds(maxPageSize);
+ SortParameterParser.parse(criteria.sort());
}
}
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityValidationService.java b/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityValidationService.java
index acaf6ee1..367934cb 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityValidationService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/entity/EntityValidationService.java
@@ -13,6 +13,7 @@
import com.decathlon.idp_core.domain.exception.entity.EntityValidationException;
import com.decathlon.idp_core.domain.model.entity.Entity;
import com.decathlon.idp_core.domain.model.entity.Property;
+import com.decathlon.idp_core.domain.model.entity.Relation;
import com.decathlon.idp_core.domain.model.entity_template.EntityTemplate;
import com.decathlon.idp_core.domain.model.entity_template.PropertyDefinition;
import com.decathlon.idp_core.domain.port.EntityRepositoryPort;
@@ -45,13 +46,15 @@ public class EntityValidationService {
///
/// @param entity the entity to validate
/// @param template the already-resolved template the entity must conform to
+ /// @return the validated entity with unresolved optional relation targets
+ /// removed
/// @throws EntityValidationException when one or more validation rules are
/// violated
/// @throws EntityAlreadyExistsException if an entity with the same identifier
/// exists for the template
- public void validateForCreation(Entity entity, EntityTemplate template) {
+ public Entity validateForCreation(Entity entity, EntityTemplate template) {
validateUniqueness(entity);
- validateAgainstTemplate(template, entity);
+ return validateAgainstTemplate(template, entity);
}
/// Validates entity data for update operations.
@@ -62,22 +65,26 @@ public void validateForCreation(Entity entity, EntityTemplate template) {
///
/// @param entity the entity payload to validate
/// @param template the already-resolved template the entity must conform to
+ /// @return the validated entity with unresolved optional relation targets
+ /// removed
/// @throws EntityValidationException when one or more validation rules are
/// violated
- void validateForUpdate(Entity entity, EntityTemplate template) {
- validateAgainstTemplate(template, entity);
+ Entity validateForUpdate(Entity entity, EntityTemplate template) {
+ return validateAgainstTemplate(template, entity);
}
- /// Validates entity properties against the template's property definitions,
+ /// Validates entity data against template property and relation definitions,
/// enforcing required fields and value rules.
///
/// @param template the entity template whose property definitions are used for
/// validation
/// @param entity the entity being validated, containing the actual property
/// values to check
+ /// @return the validated entity with unresolved optional relation targets
+ /// removed
/// @throws EntityValidationException if any property validation rules are
/// violated, including missing required properties
- private void validateAgainstTemplate(EntityTemplate template, Entity entity) {
+ private Entity validateAgainstTemplate(EntityTemplate template, Entity entity) {
Violations violations = new Violations();
violations.addIfBlank(entity.name(), ENTITY_NAME_MANDATORY);
@@ -91,12 +98,15 @@ private void validateAgainstTemplate(EntityTemplate template, Entity entity) {
propertyValidationService.validatePropertiesAgainstTemplate(template, definitions,
propertiesByName, violations);
- relationValidationService.validateRelationsAgainstTemplate(template, entity.relations(),
- violations);
+ List normalizedRelations = relationValidationService
+ .validateAndNormalizeRelationsAgainstTemplate(template, entity.relations(), violations);
if (!violations.isEmpty()) {
throw new EntityValidationException(violations.asList());
}
+
+ return new Entity(entity.id(), entity.templateIdentifier(), entity.name(), entity.identifier(),
+ entity.properties(), normalizedRelations);
}
/// Checks for existing entity with same template and identifier to prevent
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/entity_graph/EntityGraphService.java b/src/main/java/com/decathlon/idp_core/domain/service/entity_graph/EntityGraphService.java
index 1143d495..fc683bab 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/entity_graph/EntityGraphService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/entity_graph/EntityGraphService.java
@@ -7,12 +7,15 @@
import java.util.UUID;
import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.decathlon.idp_core.domain.exception.entity.EntityNotFoundException;
import com.decathlon.idp_core.domain.exception.entity_template.EntityTemplateNotFoundException;
+import com.decathlon.idp_core.domain.exception.search.InvalidSearchQueryException;
import com.decathlon.idp_core.domain.model.entity.Entity;
import com.decathlon.idp_core.domain.model.entity.EntityCompositeKey;
import com.decathlon.idp_core.domain.model.entity.EntityFilter;
@@ -20,9 +23,12 @@
import com.decathlon.idp_core.domain.model.entity_graph.EntityGraphNode;
import com.decathlon.idp_core.domain.model.entity_graph.EntityGraphQueryOptions;
import com.decathlon.idp_core.domain.model.entity_graph.EntityGraphTraversalMode;
+import com.decathlon.idp_core.domain.model.search.PaginationCriteria;
+import com.decathlon.idp_core.domain.model.search.SortCriteria;
import com.decathlon.idp_core.domain.port.EntityGraphRepositoryPort;
import com.decathlon.idp_core.domain.port.EntityRepositoryPort;
import com.decathlon.idp_core.domain.service.entity.EntityService;
+import com.decathlon.idp_core.domain.service.search.SortParameterParser;
import lombok.RequiredArgsConstructor;
@@ -120,17 +126,26 @@ public EntityGraphNode getEntityGraph(String templateIdentifier, String entityId
/// produce
/// unified `relations` DTOs without any further DB calls.
///
- /// @param pageable pagination and sorting configuration
+ /// @param paginationCriteria zero-based page, page size, and optional sort
+ /// expression, validated against `maxPageSize`
/// @param templateIdentifier template to scope the entity list
/// @param entityFilter optional filter criteria; `null` means no filtering
/// @param depth the maximum relationship depth used for each page entity's
/// graph traversal
/// @return paginated graph nodes with outbound and inbound relations resolved
+ /// @param maxPageSize the largest page size accepted
/// @throws EntityTemplateNotFoundException when the template does not exist
+ /// @throws InvalidSearchQueryException when page or size is out of bounds
@SuppressWarnings("null")
@Transactional(readOnly = true)
- public Page getEntityGraphPageByTemplate(Pageable pageable,
- String templateIdentifier, EntityFilter entityFilter, int depth) {
+ public Page getEntityGraphPageByTemplate(PaginationCriteria paginationCriteria,
+ String templateIdentifier, EntityFilter entityFilter, int depth, int maxPageSize) {
+
+ paginationCriteria.validateBounds(maxPageSize);
+ Pageable pageable = SortParameterParser.parse(paginationCriteria.sort())
+ .map(sortCriteria -> PageRequest.of(paginationCriteria.page(), paginationCriteria.size(),
+ toSpringSort(sortCriteria)))
+ .orElseGet(() -> PageRequest.of(paginationCriteria.page(), paginationCriteria.size()));
// Fetch paginated entities — template existence is validated inside this call
Page entityPage = entityService.getEntitiesByTemplateIdentifier(pageable,
@@ -161,4 +176,11 @@ public Page getEntityGraphPageByTemplate(Pageable pageable,
entity.properties(), List.of(), List.of())));
}
+ private Sort toSpringSort(SortCriteria criteria) {
+ Sort.Direction direction = criteria.direction() == SortCriteria.Direction.ASC
+ ? Sort.Direction.ASC
+ : Sort.Direction.DESC;
+ return Sort.by(direction, criteria.field());
+ }
+
}
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/principal/PrincipalProvisioningService.java b/src/main/java/com/decathlon/idp_core/domain/service/principal/PrincipalProvisioningService.java
index 3d9e9521..de4bfaa7 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/principal/PrincipalProvisioningService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/principal/PrincipalProvisioningService.java
@@ -13,6 +13,7 @@
import com.decathlon.idp_core.domain.model.entity.Property;
import com.decathlon.idp_core.domain.model.entity.Relation;
import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
+import com.decathlon.idp_core.domain.model.principal.PrincipalKind;
import com.decathlon.idp_core.domain.port.EntityRepositoryPort;
import lombok.RequiredArgsConstructor;
@@ -36,6 +37,8 @@
public class PrincipalProvisioningService {
private static final String PRINCIPAL_TEMPLATE_IDENTIFIER = "principal";
+ private static final String KIND_PROPERTY = "kind";
+ private static final String IS_ADMIN_PROPERTY = "is_admin";
private final EntityRepositoryPort entityRepository;
@@ -57,6 +60,20 @@ public class PrincipalProvisioningService {
/// @return the provisioned Principal entity
@Transactional
public Entity provisionPrincipal(PrincipalInfo principalInfo) {
+ return provisionPrincipal(principalInfo, false);
+ }
+
+ /// Provisions a globally configured administrator principal.
+ ///
+ /// @param principalInfo extracted authentication information for an
+ /// allow-listed principal
+ /// @return the provisioned Principal entity
+ @Transactional
+ public Entity provisionGlobalAdministrator(PrincipalInfo principalInfo) {
+ return provisionPrincipal(principalInfo, true);
+ }
+
+ private Entity provisionPrincipal(PrincipalInfo principalInfo, boolean isAdmin) {
Optional existingPrincipal = entityRepository.findByTemplateIdentifierAndIdentifier(
PRINCIPAL_TEMPLATE_IDENTIFIER, principalInfo.identifier());
@@ -64,7 +81,7 @@ public Entity provisionPrincipal(PrincipalInfo principalInfo) {
return existingPrincipal.get();
}
- return createNewPrincipal(principalInfo);
+ return createNewPrincipal(principalInfo, isAdmin);
}
/// Retrieves a Principal entity by its identifier.
@@ -74,11 +91,30 @@ public Entity provisionPrincipal(PrincipalInfo principalInfo) {
/// @param identifier unique principal identifier
/// @return optional containing the principal entity
@Transactional(readOnly = true)
- public Optional getPrincipal(String identifier) {
+ public Optional findPrincipal(String identifier) {
return entityRepository.findByTemplateIdentifierAndIdentifier(PRINCIPAL_TEMPLATE_IDENTIFIER,
identifier);
}
+ /// Retrieves a principal only when its stored kind matches the authenticated
+ /// actor.
+ ///
+ /// @param principalInfo authenticated principal identity
+ /// @return matching principal entity, or empty when missing or of a different
+ /// kind
+ @Transactional(readOnly = true)
+ public Optional findPrincipalWithSameKind(PrincipalInfo principalInfo) {
+ return entityRepository
+ .findByTemplateIdentifierAndIdentifier(PRINCIPAL_TEMPLATE_IDENTIFIER,
+ principalInfo.identifier())
+ .filter(entity -> hasMatchingKind(entity, principalInfo.kind()));
+ }
+
+ private boolean hasMatchingKind(Entity entity, PrincipalKind kind) {
+ return entity.properties().stream().anyMatch(
+ property -> KIND_PROPERTY.equals(property.name()) && kind.name().equals(property.value()));
+ }
+
/// Creates a new Principal entity in the catalog.
///
/// **Business logic:** Maps PrincipalInfo to entity properties and relations.
@@ -87,9 +123,10 @@ public Optional getPrincipal(String identifier) {
///
/// @param principalInfo extracted authentication information
/// @return the newly created or existing Principal entity
- private Entity createNewPrincipal(PrincipalInfo principalInfo) {
+ private Entity createNewPrincipal(PrincipalInfo principalInfo, boolean isAdmin) {
Entity newPrincipal = new Entity(null, PRINCIPAL_TEMPLATE_IDENTIFIER, principalInfo.name(),
- principalInfo.identifier(), buildProperties(principalInfo), buildRelations(principalInfo));
+ principalInfo.identifier(), buildProperties(principalInfo, isAdmin),
+ buildRelations(principalInfo));
try {
return entityRepository.save(newPrincipal);
} catch (EntityAlreadyExistsException _) {
@@ -110,12 +147,14 @@ private Entity createNewPrincipal(PrincipalInfo principalInfo) {
///
/// @param principalInfo the principal information containing attributes
/// @return list of properties for the principal entity
- private List buildProperties(PrincipalInfo principalInfo) {
+ private List buildProperties(PrincipalInfo principalInfo, boolean isAdmin) {
List properties = new ArrayList<>();
- properties.add(new Property(null, "kind", principalInfo.kind().name()));
+ properties.add(new Property(null, KIND_PROPERTY, principalInfo.kind().name()));
+ properties.add(new Property(null, IS_ADMIN_PROPERTY, Boolean.toString(isAdmin)));
principalInfo.attributes().forEach((key, value) -> {
- if (value != null && !value.isBlank()) {
+ if (!KIND_PROPERTY.equalsIgnoreCase(key) && !IS_ADMIN_PROPERTY.equalsIgnoreCase(key)
+ && value != null && !value.isBlank()) {
properties.add(new Property(null, key, value));
}
});
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/relation/RelationValidationService.java b/src/main/java/com/decathlon/idp_core/domain/service/relation/RelationValidationService.java
index 04b90bc7..8f96958c 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/relation/RelationValidationService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/relation/RelationValidationService.java
@@ -1,14 +1,18 @@
package com.decathlon.idp_core.domain.service.relation;
import static com.decathlon.idp_core.domain.constant.ValidationMessages.ENTITY_DYNAMIC_MAPPING_ENTITY_RELATIONS_MISSING;
+import static com.decathlon.idp_core.domain.constant.ValidationMessages.RELATION_NAME_ALREADY_EXISTS;
import static com.decathlon.idp_core.domain.constant.ValidationMessages.RELATION_NOT_DEFINED_IN_TEMPLATE;
import static com.decathlon.idp_core.domain.constant.ValidationMessages.RELATION_REQUIRED_MISSING;
import static com.decathlon.idp_core.domain.constant.ValidationMessages.RELATION_TARGET_ENTITY_NOT_FOUND;
import static com.decathlon.idp_core.domain.constant.ValidationMessages.RELATION_TARGET_TEMPLATE_MISMATCH;
import static com.decathlon.idp_core.domain.constant.ValidationMessages.RELATION_TOO_MANY_TARGETS;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -20,6 +24,7 @@
import com.decathlon.idp_core.domain.model.entity.Relation;
import com.decathlon.idp_core.domain.model.entity_template.EntityTemplate;
import com.decathlon.idp_core.domain.model.entity_template.RelationDefinition;
+import com.decathlon.idp_core.domain.model.enums.RelationTargetValidationMode;
import com.decathlon.idp_core.domain.port.EntityRepositoryPort;
import com.decathlon.idp_core.domain.service.entity.Violations;
@@ -31,13 +36,25 @@
/// 1. **Mapping validation** ([#validateMappingRelationsAgainstTemplate]): validates that
/// relation names exist in the template and required relations are mapped.
/// Used by dynamic mapping validation.
-/// 2. **Full relation validation** ([#validateRelationsAgainstTemplate]): validates complete
-/// [Relation] objects including cardinality and target existence. Used by entity validation.
+/// 2. **Full relation validation**
+/// ([#validateAndNormalizeRelationsAgainstTemplate]): filters target identifiers
+/// not found in the repository from optional relations, omits relations left
+/// without targets, and validates required relations, cardinality, and target
+/// templates. Used by entity write validation.
@Service
@RequiredArgsConstructor
public class RelationValidationService {
+ private record RelationValidationOptions(boolean skipDatabaseChecks,
+ boolean omitMissingOptionalTargets) {
+ }
+
+ private record RelationNormalization(Optional relation,
+ List targetIdentifiers) {
+ }
+
private final EntityRepositoryPort entityRepository;
+ private final RelationTargetValidationMode targetValidationMode;
/// Validates mapping relation names against the template's relation
/// definitions.
@@ -74,7 +91,8 @@ private void validateNamesExistInTemplate(EntityTemplate template, List
return;
}
- Set definedRelationNames = getDefinedRelationNames(template);
+ Set definedRelationNames = template.relationsDefinitions().stream()
+ .map(RelationDefinition::name).collect(Collectors.toSet());
relationNames.stream().filter(name -> !definedRelationNames.contains(name)).findFirst()
.ifPresent(name -> {
@@ -102,14 +120,6 @@ private void validateRequiredRelationsAreMapped(EntityTemplate template,
}
}
- private Set getDefinedRelationNames(EntityTemplate template) {
- if (template.relationsDefinitions().isEmpty()) {
- return Set.of();
- }
- return template.relationsDefinitions().stream().map(RelationDefinition::name)
- .collect(Collectors.toSet());
- }
-
/// Validates entity relations against the template's relation definitions,
/// enforcing required relations and cardinality constraints.
/// @param template the entity template whose relation definitions are used for
@@ -120,16 +130,40 @@ private Set getDefinedRelationNames(EntityTemplate template) {
/// the process
public void validateRelationsAgainstTemplate(EntityTemplate template,
List providedRelations, Violations violations) {
- validateRelationsAgainstTemplate(template, providedRelations, violations, false);
+ validateRelationsAgainstTemplate(template, providedRelations, violations, false, false);
+ }
+
+ /// Validates relations and filters out target identifiers that do not resolve
+ /// to entities in the repository from optional relations. Omits an optional
+ /// relation if no targets remain.
+ ///
+ /// Missing targets on required relations and existing targets with an
+ /// incompatible template remain validation errors. The returned relations
+ /// retain all resolved targets.
+ ///
+ /// @param template the entity template whose relation definitions are used
+ /// @param providedRelations the relations and target identifiers to validate
+ /// @param violations the accumulator for validation violations
+ /// @return relations with repository-missing target identifiers filtered out
+ /// and optional relations with no targets omitted
+ public List validateAndNormalizeRelationsAgainstTemplate(EntityTemplate template,
+ List providedRelations, Violations violations) {
+ boolean omitMissingOptionalTargets = targetValidationMode == RelationTargetValidationMode.TOLERANT;
+ return validateRelationsAgainstTemplate(template, providedRelations, violations, false,
+ omitMissingOptionalTargets);
}
- /// Internal unified relation validation used by both normal and dry-run
- /// workflows.
+ /// Validates unique relation names, target entities, required relations, and
+ /// cardinality for normal and dry-run workflows.
///
- /// @param skipDatabaseChecks when true, skips target-entity existence checks
- /// in repository-backed validation
- private void validateRelationsAgainstTemplate(EntityTemplate template,
- List providedRelations, Violations violations, boolean skipDatabaseChecks) {
+ /// @param skipDatabaseChecks when true, skips repository lookups for target
+ /// existence and target-template compatibility
+ /// @param omitMissingOptionalTargets when true, filters repository-missing
+ /// identifiers from optional relations and omits relations left empty
+ /// @return relations with tolerated missing optional targets filtered out
+ private List validateRelationsAgainstTemplate(EntityTemplate template,
+ List providedRelations, Violations violations, boolean skipDatabaseChecks,
+ boolean omitMissingOptionalTargets) {
List definitions = template.relationsDefinitions() != null
? template.relationsDefinitions()
@@ -140,36 +174,175 @@ private void validateRelationsAgainstTemplate(EntityTemplate template,
.filter(def -> def.name() != null).collect(Collectors.toMap(RelationDefinition::name,
def -> def, (existing, replacement) -> existing));
- Map relationsByName = relations.stream().filter(rel -> rel.name() != null)
- .collect(Collectors.toMap(Relation::name, rel -> rel, (existing, replacement) -> existing));
+ Map relationsByName = new HashMap<>();
+ for (Relation relation : relations) {
+ if (relation.name() != null
+ && relationsByName.putIfAbsent(relation.name(), relation) != null) {
+ violations.add(RELATION_NAME_ALREADY_EXISTS, relation.name());
+ }
+ }
+
+ Map> targetIdentifiersByName = new HashMap<>();
+ RelationValidationOptions options = new RelationValidationOptions(skipDatabaseChecks,
+ omitMissingOptionalTargets);
+ List normalizedRelations = normalizeRelations(template.identifier(), relations,
+ definitionsByName, targetIdentifiersByName, violations, options);
+
+ validateRelationDefinitions(template.identifier(), definitions, relationsByName,
+ targetIdentifiersByName, violations);
+ return normalizedRelations;
+ }
+
+ /// Filters repository-missing identifiers from optional relations when enabled
+ /// and records the remaining identifiers for required and cardinality checks.
+ ///
+ /// @param templateIdentifier the identifier of the source entity template
+ /// @param relations the relations and their target identifiers to validate
+ /// @param definitionsByName the template relation definitions indexed by name
+ /// @param targetIdentifiersByName receives the identifiers remaining after
+ /// filtering
+ /// @param violations the accumulator for validation violations
+ /// @param options the relation validation options
+ /// @return relations with tolerated missing optional targets filtered out
+ private List normalizeRelations(String templateIdentifier, List relations,
+ Map definitionsByName,
+ Map> targetIdentifiersByName, Violations violations,
+ RelationValidationOptions options) {
+ List normalizedRelations = new ArrayList<>();
for (Relation relation : relations) {
- if (relation.name() != null && !definitionsByName.containsKey(relation.name())) {
- violations.add(RELATION_NOT_DEFINED_IN_TEMPLATE, relation.name(), template.identifier());
- } else if (!skipDatabaseChecks) {
- validateRelationTargetEntityExistence(relation, violations);
+ RelationNormalization normalization = normalizeRelation(templateIdentifier, relation,
+ definitionsByName, violations, options);
+ if (relation.name() != null && definitionsByName.containsKey(relation.name())) {
+ targetIdentifiersByName.putIfAbsent(relation.name(), normalization.targetIdentifiers());
}
+ normalization.relation().ifPresent(normalizedRelations::add);
+ }
+
+ return normalizedRelations;
+ }
+
+ /// Validates one relation and filters repository-missing target identifiers
+ /// from optional relations when enabled. Omits the relation if no targets
+ /// remain, but retains undefined relations so their name violations are
+ /// reported.
+ ///
+ /// @param templateIdentifier the identifier of the source entity template
+ /// @param relation the relation and target identifiers to validate
+ /// @param definitionsByName the template relation definitions indexed by name
+ /// @param violations the accumulator for validation violations
+ /// @param options the relation validation options
+ /// @return the filtered relation, if any, and its remaining target identifiers
+ private RelationNormalization normalizeRelation(String templateIdentifier, Relation relation,
+ Map definitionsByName, Violations violations,
+ RelationValidationOptions options) {
+ if (relation.name() != null && !definitionsByName.containsKey(relation.name())) {
+ violations.add(RELATION_NOT_DEFINED_IN_TEMPLATE, relation.name(), templateIdentifier);
+ return new RelationNormalization(Optional.of(relation),
+ extractValidTargetIdentifiers(relation));
+ }
+
+ RelationDefinition definition = definitionsByName.get(relation.name());
+ List targetIdentifiers = extractValidTargetIdentifiers(relation);
+ boolean omitUnresolvedTargets = options.omitMissingOptionalTargets() && definition != null
+ && !definition.required();
+ List normalizedTargetIdentifiers = normalizeTargetIdentifiers(relation,
+ targetIdentifiers, violations, options.skipDatabaseChecks(), omitUnresolvedTargets);
+
+ if (omitUnresolvedTargets && normalizedTargetIdentifiers.isEmpty()) {
+ return new RelationNormalization(Optional.empty(), normalizedTargetIdentifiers);
+ }
+
+ Relation normalizedRelation = new Relation(relation.id(), relation.name(),
+ relation.targetTemplateIdentifier(), normalizedTargetIdentifiers);
+ return new RelationNormalization(Optional.of(normalizedRelation), normalizedTargetIdentifiers);
+ }
+
+ /// Looks up target identifiers, reports missing targets unless optional
+ /// filtering is enabled, and checks the templates of found entities. In
+ /// optional filtering mode, removes identifiers that have no repository match.
+ ///
+ /// @param relation the relation whose targets are checked
+ /// @param targetIdentifiers the non-blank target identifiers to validate
+ /// @param violations the accumulator for validation violations
+ /// @param skipDatabaseChecks whether to skip the repository lookup and target
+ /// template checks
+ /// @param omitUnresolvedTargets whether repository-missing identifiers should
+ /// be filtered without adding missing-target violations
+ /// @return target identifiers remaining after optional filtering
+ private List normalizeTargetIdentifiers(Relation relation, List targetIdentifiers,
+ Violations violations, boolean skipDatabaseChecks, boolean omitUnresolvedTargets) {
+ if (skipDatabaseChecks || targetIdentifiers.isEmpty()) {
+ return targetIdentifiers;
}
+ List existingEntities = entityRepository.findByIdentifierIn(targetIdentifiers);
+ Set existingIdentifiers = existingEntities.stream().map(EntitySummary::identifier)
+ .collect(Collectors.toSet());
+
+ validateTargetExistence(relation, targetIdentifiers, existingIdentifiers, violations,
+ omitUnresolvedTargets);
+ validateRelationTargetTemplates(relation, existingEntities, violations);
+
+ if (omitUnresolvedTargets) {
+ return targetIdentifiers.stream().filter(existingIdentifiers::contains).toList();
+ }
+
+ return targetIdentifiers;
+ }
+
+ /// Adds a missing-target violation for each identifier absent from the
+ /// repository unless optional filtering is enabled.
+ ///
+ /// @param relation the relation being validated
+ /// @param targetIdentifiers the non-blank target identifiers to check
+ /// @param existingIdentifiers the identifiers found in the repository
+ /// @param violations the accumulator for validation violations
+ /// @param omitUnresolvedTargets whether repository-missing identifiers should
+ /// be tolerated without a violation
+ private void validateTargetExistence(Relation relation, List targetIdentifiers,
+ Set existingIdentifiers, Violations violations, boolean omitUnresolvedTargets) {
+ for (String identifier : targetIdentifiers) {
+ if (!existingIdentifiers.contains(identifier) && !omitUnresolvedTargets) {
+ violations.add(RELATION_TARGET_ENTITY_NOT_FOUND, relation.name(), identifier);
+ }
+ }
+ }
+
+ /// Reports missing required relations and multiple targets on single-target
+ /// relations using identifiers remaining after optional filtering.
+ ///
+ /// @param templateIdentifier the identifier of the source entity template
+ /// @param definitions the relation definitions to validate
+ /// @param relationsByName the provided relations indexed by name
+ /// @param targetIdentifiersByName the target identifiers remaining after
+ /// optional filtering, indexed by relation name
+ /// @param violations the accumulator for validation violations
+ private void validateRelationDefinitions(String templateIdentifier,
+ List definitions, Map relationsByName,
+ Map> targetIdentifiersByName, Violations violations) {
for (RelationDefinition definition : definitions) {
Relation relation = relationsByName.get(definition.name());
- List validTargets = extractValidTargetIdentifiers(relation);
+ List validTargets = relation == null
+ ? List.of()
+ : targetIdentifiersByName.getOrDefault(relation.name(),
+ extractValidTargetIdentifiers(relation));
if (definition.required() && validTargets.isEmpty()) {
- violations.add(RELATION_REQUIRED_MISSING, definition.name(), template.identifier());
+ violations.add(RELATION_REQUIRED_MISSING, definition.name(), templateIdentifier);
}
if (relation != null && !definition.toMany() && validTargets.size() > 1) {
- violations.add(RELATION_TOO_MANY_TARGETS, definition.name(), template.identifier());
+ violations.add(RELATION_TOO_MANY_TARGETS, definition.name(), templateIdentifier);
}
}
}
/// Validates entity relations for dry-run executions.
///
- /// Keeps structural validation (relation names, required relations,
- /// cardinality)
- /// and skips database existence checks for target entity identifiers.
+ /// Keeps structural validation (relation names, required relations, and
+ /// cardinality) while skipping repository-backed target existence and template
+ /// compatibility checks.
///
/// This method is intentionally additive and does not change the behavior of
/// [#validateRelationsAgainstTemplate].
@@ -181,35 +354,7 @@ private void validateRelationsAgainstTemplate(EntityTemplate template,
/// the process
public void validateRelationsAgainstTemplateForDryRun(EntityTemplate template,
List providedRelations, Violations violations) {
- validateRelationsAgainstTemplate(template, providedRelations, violations, true);
- }
-
- /// Validates that all target entity identifiers in the relation actually exist
- /// in the database and match the expected target template.
- ///
- /// @param relation the relation whose target entity identifiers are to be
- /// validated
- /// @param violations the accumulator for any validation violations found during
- /// the process
- private void validateRelationTargetEntityExistence(Relation relation, Violations violations) {
- List targetIdentifiers = extractValidTargetIdentifiers(relation);
-
- if (targetIdentifiers.isEmpty()) {
- return;
- }
-
- var existingEntities = entityRepository.findByIdentifierIn(targetIdentifiers);
- Set existingIdentifiers = existingEntities.stream().map(EntitySummary::identifier)
- .collect(Collectors.toSet());
-
- for (String identifier : targetIdentifiers) {
- if (!existingIdentifiers.contains(identifier)) {
- violations.add(RELATION_TARGET_ENTITY_NOT_FOUND, relation.name(), identifier);
- }
- }
-
- // Validate that target entities match the expected target template
- validateRelationTargetTemplates(relation, existingEntities, violations);
+ validateRelationsAgainstTemplate(template, providedRelations, violations, true, false);
}
/// Validates that all target entities have the expected target template
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/search/SortParameterParser.java b/src/main/java/com/decathlon/idp_core/domain/service/search/SortParameterParser.java
new file mode 100644
index 00000000..7d1fd982
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/domain/service/search/SortParameterParser.java
@@ -0,0 +1,58 @@
+package com.decathlon.idp_core.domain.service.search;
+
+import java.util.Locale;
+import java.util.Optional;
+
+import com.decathlon.idp_core.domain.constant.SearchConstraints;
+import com.decathlon.idp_core.domain.constant.ValidationMessages;
+import com.decathlon.idp_core.domain.exception.search.InvalidSearchQueryException;
+import com.decathlon.idp_core.domain.model.search.SortCriteria;
+import com.decathlon.idp_core.domain.model.search.SortCriteria.Direction;
+
+/// Parses and validates entity sort parameters shared by search and listing APIs.
+public final class SortParameterParser {
+
+ private SortParameterParser() {
+ }
+
+ /// Parses a sort expression in the canonical `field,direction` form.
+ /// A field without a direction defaults to ascending; null or blank input means
+ /// no sort was requested.
+ ///
+ /// @param expression caller-provided sort expression
+ /// @return validated sort criteria, or empty when no sort was requested
+ /// @throws InvalidSearchQueryException when the expression or field is invalid
+ public static Optional parse(String expression) {
+ if (expression == null || expression.isBlank()) {
+ return Optional.empty();
+ }
+
+ String[] parts = expression.trim().split(",", -1);
+ if (expression.contains(":") || parts.length > 2 || parts[0].isBlank()
+ || parts.length == 2 && parts[1].isBlank()) {
+ throw invalidFormat(expression);
+ }
+
+ String field = parts[0].trim();
+ if (!SearchConstraints.ALLOWED_SORT_FIELDS.contains(field)) {
+ throw new InvalidSearchQueryException(
+ ValidationMessages.SEARCH_INVALID_SORT_FIELD.formatted(field));
+ }
+
+ Direction direction = Direction.ASC;
+ if (parts.length == 2) {
+ direction = switch (parts[1].trim().toLowerCase(Locale.ROOT)) {
+ case "asc" -> Direction.ASC;
+ case "desc" -> Direction.DESC;
+ default -> throw invalidFormat(expression);
+ };
+ }
+
+ return Optional.of(new SortCriteria(field, direction));
+ }
+
+ private static InvalidSearchQueryException invalidFormat(String expression) {
+ return new InvalidSearchQueryException(
+ ValidationMessages.SEARCH_INVALID_SORT_FORMAT.formatted(expression));
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorService.java b/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorService.java
index adf6a2db..0871b076 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorService.java
@@ -47,11 +47,10 @@ public WebhookConnector getWebhookConnector(String identifier) {
@Transactional
public WebhookConnector createWebhookConnector(WebhookConnector connector) {
- webhookConnectorValidationService.validateWebhookConnectorForCreation(connector);
-
WebhookConnector connectorToSave = connector.mappings().isEmpty() && connector.enabled()
? connector.withEnabled(false)
: connector;
+ webhookConnectorValidationService.validateWebhookConnectorForCreation(connectorToSave);
return webhookConnectorRepositoryPort.save(connectorToSave);
}
@@ -60,12 +59,15 @@ public WebhookConnector createWebhookConnector(WebhookConnector connector) {
public WebhookConnector updateWebhookConnector(String identifier,
@Valid WebhookConnector connectorToUpdate) {
WebhookConnector webhookConnectorInDb = getWebhookConnector(identifier);
- webhookConnectorValidationService.validateWebhookConnectorForUpdate(connectorToUpdate);
boolean enabledValue = !connectorToUpdate.mappings().isEmpty() && connectorToUpdate.enabled();
+ WebhookConnector connectorToValidate = connectorToUpdate.enabled() == enabledValue
+ ? connectorToUpdate
+ : connectorToUpdate.withEnabled(enabledValue);
+ webhookConnectorValidationService.validateWebhookConnectorForUpdate(connectorToValidate);
WebhookConnector mergedConnector = new WebhookConnector(webhookConnectorInDb.id(),
- webhookConnectorInDb.identifier(), connectorToUpdate.name(),
- connectorToUpdate.description(), enabledValue, connectorToUpdate.mappings(),
- connectorToUpdate.security());
+ webhookConnectorInDb.identifier(), connectorToValidate.name(),
+ connectorToValidate.description(), connectorToValidate.enabled(),
+ connectorToValidate.mappings(), connectorToValidate.security());
return webhookConnectorRepositoryPort.save(mergedConnector);
}
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorValidationService.java b/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorValidationService.java
index fac62077..933d7ebd 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorValidationService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/webhook/WebhookConnectorValidationService.java
@@ -26,13 +26,15 @@ public class WebhookConnectorValidationService {
public void validateWebhookConnectorForCreation(WebhookConnector webhookConnector) {
validateIdentifierUniqueness(webhookConnector.identifier());
- webhookSecurityValidationService.validateForCreation(webhookConnector.security());
+ webhookSecurityValidationService.validateForCreation(webhookConnector.security(),
+ webhookConnector.enabled());
}
public void validateWebhookConnectorForUpdate(WebhookConnector webhookConnectorToUpdate) {
validateMappingsIfPresent(webhookConnectorToUpdate);
- webhookSecurityValidationService.validateForCreation(webhookConnectorToUpdate.security());
+ webhookSecurityValidationService.validateForCreation(webhookConnectorToUpdate.security(),
+ webhookConnectorToUpdate.enabled());
}
private void validateMappingsIfPresent(WebhookConnector webhookConnector) {
diff --git a/src/main/java/com/decathlon/idp_core/domain/service/webhook/security/WebhookSecurityValidationService.java b/src/main/java/com/decathlon/idp_core/domain/service/webhook/security/WebhookSecurityValidationService.java
index 97f95b33..fc4a9ef8 100644
--- a/src/main/java/com/decathlon/idp_core/domain/service/webhook/security/WebhookSecurityValidationService.java
+++ b/src/main/java/com/decathlon/idp_core/domain/service/webhook/security/WebhookSecurityValidationService.java
@@ -8,27 +8,34 @@
import com.decathlon.idp_core.domain.exception.webhook.WebhookSecurityConfigurationException;
import com.decathlon.idp_core.domain.model.enums.WebhookSecurityType;
import com.decathlon.idp_core.domain.model.inbound_connectors.webhook.WebhookSecurity;
+import com.decathlon.idp_core.domain.model.inbound_connectors.webhook.WebhookSecurityValidationPolicy;
import com.decathlon.idp_core.domain.port.WebhookSecurityStrategy;
/// Domain service for validating webhook security configuration at creation/update time.
///
/// This service ensures that the security configuration provided when creating or updating
-/// a webhook connector is valid before storing it in the database.
+/// a webhook connector is valid before storing it in the database. The `NONE` security type
+/// (unauthenticated webhooks) is rejected for enabled connectors unless
+/// `IDP_WEBHOOK_SECURITY_ALLOW_NONE` is enabled.
@Service
public class WebhookSecurityValidationService {
private final List strategies;
+ private final WebhookSecurityValidationPolicy policy;
- public WebhookSecurityValidationService(List strategies) {
+ public WebhookSecurityValidationService(List strategies,
+ WebhookSecurityValidationPolicy policy) {
this.strategies = List.copyOf(strategies);
+ this.policy = policy;
}
/// Validates webhook security configuration for creation or update.
///
/// @param security the security configuration to validate
+ /// @param enabled whether the webhook connector is enabled
/// @throws WebhookSecurityConfigurationException if the configuration is
/// invalid
- public void validateForCreation(WebhookSecurity security) {
+ public void validateForCreation(WebhookSecurity security, boolean enabled) {
if (security == null) {
throw new WebhookSecurityConfigurationException("Webhook security section is mandatory");
}
@@ -37,6 +44,10 @@ public void validateForCreation(WebhookSecurity security) {
if (security.type() == WebhookSecurityType.NONE) {
validateNoSecurityConfig(config);
+ if (enabled && !policy.allowNone()) {
+ throw new WebhookSecurityConfigurationException(
+ "Webhook security type NONE is disabled. Set IDP_WEBHOOK_SECURITY_ALLOW_NONE=true to allow it");
+ }
return;
}
@@ -48,7 +59,7 @@ public void validateForCreation(WebhookSecurity security) {
}
private void validateNoSecurityConfig(Map config) {
- if (!config.isEmpty()) {
+ if (config != null && !config.isEmpty()) {
throw new WebhookSecurityConfigurationException(
"Webhook security config must be empty when type is NONE");
}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizationRequestFactory.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizationRequestFactory.java
new file mode 100644
index 00000000..12fe8a3c
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizationRequestFactory.java
@@ -0,0 +1,114 @@
+package com.decathlon.idp_core.infrastructure.adapters.api.auth;
+
+import java.util.Map;
+import java.util.Optional;
+
+import jakarta.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.core.annotation.AnnotatedElementUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.HandlerExecutionChain;
+import org.springframework.web.servlet.HandlerMapping;
+
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationAction;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationRequest;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationResource;
+import com.decathlon.idp_core.domain.model.entity.Entity;
+import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
+
+import lombok.extern.slf4j.Slf4j;
+
+/// Maps servlet requests to the framework-independent authorization context.
+///
+/// The resource is read from [AuthorizedResource] on the handler resolved by Spring MVC and
+/// its identifiers from the matched URI template variables, so no URL is parsed manually.
+@Slf4j
+@Component
+public class AuthorizationRequestFactory {
+
+ private static final String UNKNOWN_RESOURCE = "unknown";
+ private static final String TEMPLATE_IDENTIFIER = "templateIdentifier";
+ private static final String ENTITY_IDENTIFIER = "entityIdentifier";
+ private static final String IDENTIFIER = "identifier";
+
+ private final HandlerMapping handlerMapping;
+
+ /// Creates a factory backed by the MVC handler mapping.
+ ///
+ /// @param handlerMapping the mapping used to resolve the controller method of a
+ /// request
+ public AuthorizationRequestFactory(
+ @Lazy @Qualifier("requestMappingHandlerMapping") HandlerMapping handlerMapping) {
+ this.handlerMapping = handlerMapping;
+ }
+
+ /// Creates an authorization request from the principal and HTTP request.
+ public AuthorizationRequest create(HttpServletRequest request, PrincipalInfo principal,
+ Optional principalEntity) {
+ Optional handler = resolveHandler(request);
+ boolean readOnly = handler.map(this::isReadOnly).orElse(false);
+ return new AuthorizationRequest(principal, principalEntity,
+ resolveAction(request.getMethod(), readOnly), resolveResource(request, handler));
+ }
+
+ private Optional resolveHandler(HttpServletRequest request) {
+ try {
+ return Optional.ofNullable(handlerMapping.getHandler(request))
+ .map(HandlerExecutionChain::getHandler).filter(HandlerMethod.class::isInstance)
+ .map(HandlerMethod.class::cast);
+ } catch (Exception exception) {
+ log.warn("Unable to resolve handler for {} {}", request.getMethod(), request.getRequestURI(),
+ exception);
+ return Optional.empty();
+ }
+ }
+
+ private boolean isReadOnly(HandlerMethod handler) {
+ AuthorizedResource annotation = handler.getMethodAnnotation(AuthorizedResource.class);
+ return annotation != null && annotation.readOnly();
+ }
+
+ private AuthorizationAction resolveAction(String method, boolean readOnly) {
+ if ("POST".equals(method) && readOnly) {
+ return AuthorizationAction.READ;
+ }
+
+ return switch (method) {
+ case "GET", "HEAD", "OPTIONS" -> AuthorizationAction.READ;
+ case "POST" -> AuthorizationAction.CREATE;
+ case "PUT", "PATCH" -> AuthorizationAction.UPDATE;
+ case "DELETE" -> AuthorizationAction.DELETE;
+ default -> AuthorizationAction.UNSUPPORTED;
+ };
+ }
+
+ private AuthorizationResource resolveResource(HttpServletRequest request,
+ Optional handler) {
+ String type = handler.flatMap(this::resourceType).orElse(UNKNOWN_RESOURCE);
+ Map variables = pathVariables(request);
+ Optional identifier = Optional.ofNullable(variables.get(ENTITY_IDENTIFIER))
+ .or(() -> Optional.ofNullable(variables.get(IDENTIFIER)));
+ return new AuthorizationResource(type, identifier,
+ Optional.ofNullable(variables.get(TEMPLATE_IDENTIFIER)));
+ }
+
+ private Optional resourceType(HandlerMethod handler) {
+ AuthorizedResource onMethod = handler.getMethodAnnotation(AuthorizedResource.class);
+ if (onMethod != null && !onMethod.value().isBlank()) {
+ return Optional.of(onMethod.value());
+ }
+ return Optional
+ .ofNullable(AnnotatedElementUtils.findMergedAnnotation(handler.getBeanType(),
+ AuthorizedResource.class))
+ .map(AuthorizedResource::value).filter(value -> !value.isBlank());
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map pathVariables(HttpServletRequest request) {
+ Object variables = request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
+ return variables instanceof Map, ?> map ? (Map) map : Map.of();
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizedResource.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizedResource.java
new file mode 100644
index 00000000..3ed985d5
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/AuthorizedResource.java
@@ -0,0 +1,25 @@
+package com.decathlon.idp_core.infrastructure.adapters.api.auth;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/// Declares the authorization resource exposed by a controller or endpoint.
+///
+/// A class-level declaration provides the default resource type; a method-level
+/// declaration overrides it and may flag a non-safe HTTP method as read-only.
+/// Path variables named `templateIdentifier`, `entityIdentifier` and `identifier`
+/// are used to populate the resource context.
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+public @interface AuthorizedResource {
+
+ /// Resource type; blank on a method means "inherit from the controller".
+ String value() default "";
+
+ /// Marks an endpoint that uses POST but only reads data (search, dry-run).
+ boolean readOnly() default false;
+}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/GlobalAuthorizationFilter.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/GlobalAuthorizationFilter.java
new file mode 100644
index 00000000..9191811d
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/GlobalAuthorizationFilter.java
@@ -0,0 +1,130 @@
+package com.decathlon.idp_core.infrastructure.adapters.api.auth;
+
+import java.io.IOException;
+import java.util.Optional;
+
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import org.jspecify.annotations.NonNull;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import com.decathlon.idp_core.domain.exception.authorization.PrincipalNotAuthorizedException;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationPolicy;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationRequest;
+import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
+import com.decathlon.idp_core.domain.service.authorization.GlobalAuthorizationService;
+import com.decathlon.idp_core.domain.service.principal.PrincipalProvisioningService;
+import com.decathlon.idp_core.infrastructure.adapters.api.exception.MissingPrincipalIdentifierException;
+import com.decathlon.idp_core.infrastructure.adapters.api.handler.ApiErrorResponseWriter;
+import com.decathlon.idp_core.infrastructure.adapters.api.principal.PrincipalExtractor;
+
+import lombok.extern.slf4j.Slf4j;
+
+/// Enforces the global authorization policy for authenticated API requests.
+@Slf4j
+@Component
+public class GlobalAuthorizationFilter extends OncePerRequestFilter {
+
+ private final PrincipalExtractor principalExtractor;
+ private final PrincipalProvisioningService provisioningService;
+ private final GlobalAuthorizationService authorizationService;
+ private final AuthorizationPolicy authorizationPolicy;
+ private final AuthorizationRequestFactory authorizationRequestFactory;
+ private final ApiErrorResponseWriter errorResponseWriter;
+
+ /// Creates a filter backed by the domain authorization service and configured
+ /// policy.
+ ///
+ /// @param principalExtractor converts Spring authentication into a domain
+ /// principal
+ /// @param provisioningService retrieves the principal's catalog entity
+ /// @param authorizationService evaluates the authorization policy
+ /// @param authorizationPolicy configured policy for authenticated requests
+ /// @param authorizationRequestFactory maps HTTP input to domain authorization
+ /// context
+ /// @param errorResponseWriter writes standard ProblemDetail errors at the
+ /// filter
+ /// boundary
+ public GlobalAuthorizationFilter(PrincipalExtractor principalExtractor,
+ PrincipalProvisioningService provisioningService,
+ GlobalAuthorizationService authorizationService, AuthorizationPolicy authorizationPolicy,
+ AuthorizationRequestFactory authorizationRequestFactory,
+ ApiErrorResponseWriter errorResponseWriter) {
+ this.principalExtractor = principalExtractor;
+ this.provisioningService = provisioningService;
+ this.authorizationService = authorizationService;
+ this.authorizationPolicy = authorizationPolicy;
+ this.authorizationRequestFactory = authorizationRequestFactory;
+ this.errorResponseWriter = errorResponseWriter;
+ }
+
+ @Override
+ protected void doFilterInternal(@NonNull HttpServletRequest request,
+ @NonNull HttpServletResponse response, @NonNull FilterChain filterChain)
+ throws ServletException, IOException {
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ if (authentication == null || !authentication.isAuthenticated()
+ || authentication instanceof AnonymousAuthenticationToken) {
+ filterChain.doFilter(request, response);
+ return;
+ }
+
+ var context = request.getAttribute(ProvisionedPrincipalContext.REQUEST_ATTRIBUTE);
+ var principalContext = context instanceof ProvisionedPrincipalContext provisionedContext
+ ? provisionedContext
+ : null;
+ Optional principalInfo = principalContext != null
+ ? Optional.of(principalContext.principal())
+ : extractPrincipal(authentication, request, response);
+ if (principalInfo.isEmpty()) {
+ return;
+ }
+ PrincipalInfo principal = principalInfo.orElseThrow();
+ var principalEntity = principalContext != null
+ ? principalContext.principalEntity()
+ : provisioningService.findPrincipalWithSameKind(principal);
+ AuthorizationRequest authorizationRequest = authorizationRequestFactory.create(request,
+ principal, principalEntity);
+
+ try {
+ authorizationService.authorize(authorizationRequest, authorizationPolicy);
+ } catch (PrincipalNotAuthorizedException _) {
+ log.debug(
+ "Authorization evaluation: result=DENIED, principal={}, kind={}, action={}, "
+ + "resource={}, method={}, path={}",
+ principal.identifier(), principal.kind(), authorizationRequest.action(),
+ authorizationRequest.resource().type(), request.getMethod(), request.getRequestURI());
+ log.warn("Authorization denied for principal {} on {} {}", principal.identifier(),
+ request.getMethod(), request.getRequestURI());
+ errorResponseWriter.write(request, response, HttpStatus.FORBIDDEN,
+ "Principal is not authorized to perform this operation");
+ return;
+ }
+
+ log.debug(
+ "Authorization evaluation: result=GRANTED, principal={}, kind={}, action={}, "
+ + "resource={}, method={}, path={}",
+ principal.identifier(), principal.kind(), authorizationRequest.action(),
+ authorizationRequest.resource().type(), request.getMethod(), request.getRequestURI());
+ filterChain.doFilter(request, response);
+ }
+
+ private Optional extractPrincipal(Authentication authentication,
+ HttpServletRequest request, HttpServletResponse response) throws IOException {
+ try {
+ return Optional.of(principalExtractor.extractPrincipalInfo(authentication));
+ } catch (MissingPrincipalIdentifierException exception) {
+ log.warn("Authentication rejected: {}", exception.getMessage());
+ errorResponseWriter.write(request, response, HttpStatus.UNAUTHORIZED, exception.getMessage());
+ return Optional.empty();
+ }
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/JitProvisioningFilter.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/JitProvisioningFilter.java
index 5a8a48f4..16e92ec4 100644
--- a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/JitProvisioningFilter.java
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/JitProvisioningFilter.java
@@ -1,24 +1,33 @@
package com.decathlon.idp_core.infrastructure.adapters.api.auth;
import java.io.IOException;
+import java.util.Optional;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
+import org.jspecify.annotations.NonNull;
+import org.springframework.http.HttpStatus;
import org.springframework.http.server.PathContainer;
-import org.springframework.lang.NonNull;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.pattern.PathPatternParser;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationMode;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationPolicy;
+import com.decathlon.idp_core.domain.model.entity.Entity;
import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
import com.decathlon.idp_core.domain.service.principal.PrincipalProvisioningService;
import com.decathlon.idp_core.infrastructure.adapters.api.configuration.AuthenticationProperties;
+import com.decathlon.idp_core.infrastructure.adapters.api.configuration.PrincipalProvisioningMode;
+import com.decathlon.idp_core.infrastructure.adapters.api.configuration.PrincipalProvisioningProperties;
import com.decathlon.idp_core.infrastructure.adapters.api.configuration.SecurityConfiguration;
+import com.decathlon.idp_core.infrastructure.adapters.api.exception.MissingPrincipalIdentifierException;
+import com.decathlon.idp_core.infrastructure.adapters.api.handler.ApiErrorResponseWriter;
import com.decathlon.idp_core.infrastructure.adapters.api.principal.PrincipalExtractor;
import lombok.RequiredArgsConstructor;
@@ -34,7 +43,8 @@
///
/// **Design rationale:** Positioned after Spring Security authentication but before
/// controllers, ensuring JIT provisioning happens transparently for all API endpoints.
-/// Failures are logged but don't block the request (fail-open for availability).
+/// Provisioning failures reject the request so authorization cannot proceed without a
+/// verified principal link.
///
/// **Excluded Paths:** Public endpoints (health checks, documentation, etc.) are excluded
/// from JIT provisioning to avoid unnecessary database queries and log pollution.
@@ -49,11 +59,28 @@
@RequiredArgsConstructor
public class JitProvisioningFilter extends OncePerRequestFilter {
+ private static final PathPatternParser PATTERN_PARSER = new PathPatternParser();
+
private final PrincipalExtractor principalExtractor;
private final PrincipalProvisioningService provisioningService;
private final AuthenticationProperties authProperties;
- private final PathPatternParser patternParser = new PathPatternParser();
+ private final PrincipalProvisioningProperties provisioningProperties;
+ private final AuthorizationPolicy authorizationPolicy;
+ private final ApiErrorResponseWriter errorResponseWriter;
+ /// Verifies an authenticated principal before allowing the request to continue.
+ ///
+ /// Unauthenticated and anonymous requests pass through for the configured
+ /// security
+ /// chain to handle. Authenticated requests stop here if extraction or
+ /// provisioning
+ /// fails, or if the principal cannot be linked.
+ ///
+ /// @param request current HTTP request
+ /// @param response current HTTP response
+ /// @param filterChain remaining filters and request handler
+ /// @throws ServletException if a downstream filter fails
+ /// @throws IOException if request processing fails
@Override
protected void doFilterInternal(@NonNull HttpServletRequest request,
@NonNull HttpServletResponse response, @NonNull FilterChain filterChain)
@@ -61,36 +88,115 @@ protected void doFilterInternal(@NonNull HttpServletRequest request,
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- if (authentication != null && authentication.isAuthenticated()
- && !isAnonymous(authentication)) {
- provisionPrincipalSafely(authentication);
+ if (authentication != null && authentication.isAuthenticated() && !isAnonymous(authentication)
+ && !provisionPrincipalSafely(request, response, authentication)) {
+ return;
}
filterChain.doFilter(request, response);
}
- private void provisionPrincipalSafely(Authentication authentication) {
+ /// Extracts the authenticated identity and applies the configured
+ /// principal-linking mode.
+ ///
+ /// On success, stores the verified principal context on the request for
+ /// authorization.
+ /// Missing links are rejected, while unexpected provisioning failures return a
+ /// service
+ /// unavailable response and prevent the request from continuing.
+ ///
+ /// @param request current HTTP request
+ /// @param response current HTTP response
+ /// @param authentication Spring Security authentication
+ /// @return `true` when principal verification succeeds; otherwise `false`
+ /// @throws IOException if writing an error response fails
+ private boolean provisionPrincipalSafely(HttpServletRequest request, HttpServletResponse response,
+ Authentication authentication) throws IOException {
+ PrincipalInfo principalInfo;
try {
- PrincipalInfo principalInfo = principalExtractor.extractPrincipalInfo(authentication);
+ principalInfo = principalExtractor.extractPrincipalInfo(authentication);
+ } catch (MissingPrincipalIdentifierException exception) {
+ log.warn("Authentication rejected: {}", exception.getMessage());
+ errorResponseWriter.write(request, response, HttpStatus.UNAUTHORIZED, exception.getMessage());
+ return false;
+ }
+
+ try {
+ if (provisioningProperties != null
+ && provisioningProperties.mode() == PrincipalProvisioningMode.LINK_ONLY) {
+ Optional linkedPrincipal = provisioningService
+ .findPrincipalWithSameKind(principalInfo);
+ if (linkedPrincipal.isEmpty()) {
+ if (authorizationPolicy.mode() == AuthorizationMode.GLOBAL && authorizationPolicy
+ .globalPrincipalIdentifiers().contains(principalInfo.identifier())) {
+ Entity globalPrincipal = provisioningService
+ .provisionGlobalAdministrator(principalInfo);
+ log.debug(
+ "Principal evaluation accepted: mode={}, principal={}, kind={}, linked=true, "
+ + "global=true",
+ PrincipalProvisioningMode.LINK_ONLY, principalInfo.identifier(),
+ principalInfo.kind());
+ request.setAttribute(ProvisionedPrincipalContext.REQUEST_ATTRIBUTE,
+ new ProvisionedPrincipalContext(principalInfo, Optional.of(globalPrincipal)));
+ return true;
+ }
+ log.debug("Principal evaluation rejected: mode={}, principal={}, kind={}, linked=false",
+ PrincipalProvisioningMode.LINK_ONLY, principalInfo.identifier(),
+ principalInfo.kind());
+ errorResponseWriter.write(request, response, HttpStatus.UNAUTHORIZED,
+ "No linked principal matches the authenticated identity");
+ return false;
+ }
+ log.debug("Principal evaluation accepted: mode={}, principal={}, kind={}, linked=true",
+ PrincipalProvisioningMode.LINK_ONLY, principalInfo.identifier(), principalInfo.kind());
+ request.setAttribute(ProvisionedPrincipalContext.REQUEST_ATTRIBUTE,
+ new ProvisionedPrincipalContext(principalInfo, linkedPrincipal));
+ return true;
+ }
+
provisioningService.provisionPrincipal(principalInfo);
+ Optional matchingPrincipal = provisioningService
+ .findPrincipalWithSameKind(principalInfo);
+ if (matchingPrincipal.isEmpty()) {
+ log.debug("Principal evaluation rejected: mode={}, principal={}, kind={}, linked=false",
+ PrincipalProvisioningMode.JIT, principalInfo.identifier(), principalInfo.kind());
+ errorResponseWriter.write(request, response, HttpStatus.UNAUTHORIZED,
+ "No linked principal matches the authenticated identity");
+ return false;
+ }
+ log.debug("Principal evaluation accepted: mode={}, principal={}, kind={}, linked=true",
+ PrincipalProvisioningMode.JIT, principalInfo.identifier(), principalInfo.kind());
+ request.setAttribute(ProvisionedPrincipalContext.REQUEST_ATTRIBUTE,
+ new ProvisionedPrincipalContext(principalInfo, matchingPrincipal));
log.debug("JIT provisioning successful for principal: {} (kind: {})",
principalInfo.identifier(), principalInfo.kind());
+ return true;
} catch (Exception e) {
- // Log error but don't block the request - fail-open for availability
- // The principal may not have a catalog entry, but can still authenticate
log.warn("JIT provisioning failed for authenticated principal: {}", e.getMessage(), e);
+ errorResponseWriter.write(request, response, HttpStatus.SERVICE_UNAVAILABLE,
+ "Unable to verify your access at this time. Please try again later.");
+ return false;
}
}
+ /// Checks whether the supplied authentication represents an anonymous user.
+ ///
+ /// @param authentication Spring Security authentication to inspect
+ /// @return `true` when the authentication is anonymous
private boolean isAnonymous(Authentication authentication) {
return authentication instanceof org.springframework.security.authentication.AnonymousAuthenticationToken;
}
+ /// Excludes configured public paths from principal provisioning.
+ ///
+ /// @param request current HTTP request
+ /// @return `true` when the request path matches a configured exclusion
+ /// pattern
@Override
protected boolean shouldNotFilter(@NonNull HttpServletRequest request) {
String path = request.getRequestURI();
return authProperties.jitProvisioningExcludedPaths().stream()
- .anyMatch(pattern -> patternParser.parse(pattern).matches(PathContainer.parsePath(path)));
+ .anyMatch(pattern -> PATTERN_PARSER.parse(pattern).matches(PathContainer.parsePath(path)));
}
}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/ProvisionedPrincipalContext.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/ProvisionedPrincipalContext.java
new file mode 100644
index 00000000..526b92f8
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/ProvisionedPrincipalContext.java
@@ -0,0 +1,13 @@
+package com.decathlon.idp_core.infrastructure.adapters.api.auth;
+
+import java.util.Optional;
+
+import com.decathlon.idp_core.domain.model.entity.Entity;
+import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
+
+/// Request-scoped result shared by JIT provisioning and global authorization.
+public record ProvisionedPrincipalContext(PrincipalInfo principal,
+ Optional principalEntity) {
+
+ public static final String REQUEST_ATTRIBUTE = ProvisionedPrincipalContext.class.getName();
+}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/RequestAuthorizer.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/RequestAuthorizer.java
new file mode 100644
index 00000000..bc804d66
--- /dev/null
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/RequestAuthorizer.java
@@ -0,0 +1,63 @@
+package com.decathlon.idp_core.infrastructure.adapters.api.auth;
+
+import java.util.Optional;
+
+import jakarta.servlet.http.HttpServletRequest;
+
+import org.springframework.security.authentication.AnonymousAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Component;
+
+import com.decathlon.idp_core.domain.exception.authorization.PrincipalNotAuthorizedException;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationAction;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationPolicy;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationRequest;
+import com.decathlon.idp_core.domain.model.authorization.AuthorizationResource;
+import com.decathlon.idp_core.domain.model.entity.Entity;
+import com.decathlon.idp_core.domain.model.principal.PrincipalInfo;
+import com.decathlon.idp_core.domain.service.authorization.GlobalAuthorizationService;
+import com.decathlon.idp_core.domain.service.principal.PrincipalProvisioningService;
+import com.decathlon.idp_core.infrastructure.adapters.api.principal.PrincipalExtractor;
+
+import lombok.RequiredArgsConstructor;
+
+/// Reapplies global authorization after a controller has resolved body-only resource context.
+@Component
+@RequiredArgsConstructor
+public class RequestAuthorizer {
+
+ private final PrincipalExtractor principalExtractor;
+ private final PrincipalProvisioningService provisioningService;
+ private final GlobalAuthorizationService authorizationService;
+ private final AuthorizationPolicy authorizationPolicy;
+
+ /// Authorizes a sensitive operation using its fully resolved resource context.
+ ///
+ /// @param request current HTTP request
+ /// @param action operation being performed
+ /// @param resource resource context resolved from the request body
+ public void authorize(HttpServletRequest request, AuthorizationAction action,
+ AuthorizationResource resource) {
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ if (authentication == null || !authentication.isAuthenticated()
+ || authentication instanceof AnonymousAuthenticationToken) {
+ throw new PrincipalNotAuthorizedException("unknown");
+ }
+
+ Object context = request.getAttribute(ProvisionedPrincipalContext.REQUEST_ATTRIBUTE);
+ ProvisionedPrincipalContext provisionedContext = context instanceof ProvisionedPrincipalContext value
+ ? value
+ : null;
+ PrincipalInfo principal = provisionedContext != null
+ ? provisionedContext.principal()
+ : principalExtractor.extractPrincipalInfo(authentication);
+ Optional principalEntity = provisionedContext != null
+ ? provisionedContext.principalEntity()
+ : provisioningService.findPrincipalWithSameKind(principal);
+
+ authorizationService.authorize(
+ new AuthorizationRequest(principal, principalEntity, action, resource),
+ authorizationPolicy);
+ }
+}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UnifiedUserProvider.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UnifiedUserProvider.java
index 875b63b0..9b6cd594 100644
--- a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UnifiedUserProvider.java
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UnifiedUserProvider.java
@@ -1,24 +1,24 @@
package com.decathlon.idp_core.infrastructure.adapters.api.auth;
-import java.util.Optional;
-
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.oauth2.core.oidc.user.OidcUser;
-import org.springframework.security.oauth2.core.user.OAuth2User;
-import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
import org.springframework.stereotype.Component;
-/// UnifiedUserProvider is a Spring component that implements the UserIdentityProvider interface to provide a consistent way
+import com.decathlon.idp_core.domain.port.audit.AuditIdentityProviderPort;
+import com.decathlon.idp_core.infrastructure.adapters.api.principal.PrincipalExtractor;
+
+import lombok.RequiredArgsConstructor;
+
+/// UnifiedUserProvider is a Spring component that implements the AuditIdentityProviderPort interface to provide a consistent way
/// to retrieve the authenticated user's identity across different authentication mechanisms (JWT, OAuth2, OpenID).
-/// It checks the current security context for the authentication type and extracts the user ID accordingly:
-/// - For JWT authentication, it retrieves the subject (sub) claim from the JWT token.
-/// - For OAuth2 authentication, it first checks if the user is an OIDC user to
-/// retrieve the subject, otherwise it looks for a "sub" or "id" attribute in the OAuth2 user attributes, falling back to the authentication name if neither is found.
-/// - For basic authentication, it simply returns the authentication name.
+/// The shared principal extractor keeps audit identities aligned with the identifiers used for provisioning
+/// and authorization.
@Component
-public class UnifiedUserProvider implements UserIdentityProvider {
+@RequiredArgsConstructor
+public class UnifiedUserProvider implements AuditIdentityProviderPort {
+
+ private final PrincipalExtractor principalExtractor;
@Override
public String getAuthId() {
@@ -29,25 +29,7 @@ public String getAuthId() {
return "UNKNOWN";
}
- // Jwt Case
- if (authentication instanceof JwtAuthenticationToken jwtToken) {
- return jwtToken.getToken().getSubject();
- }
-
- // OAuth2 and OpenId case
- if (authentication.getPrincipal()instanceof OAuth2User oauth2Token) {
-
- if (oauth2Token instanceof OidcUser oidcUser) {
- return oidcUser.getSubject();
- }
-
- return Optional.ofNullable(oauth2Token.getAttribute("sub")).map(Object::toString)
- .orElseGet(() -> Optional.ofNullable(oauth2Token.getAttribute("id")).map(Object::toString)
- .orElse(authentication.getName()));
- }
-
- // Basic Auth case
- return authentication.getName();
+ return principalExtractor.extractPrincipalInfo(authentication).identifier();
}
@Override
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UserIdentityProvider.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UserIdentityProvider.java
deleted file mode 100644
index 3ec29a3b..00000000
--- a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/auth/UserIdentityProvider.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.decathlon.idp_core.infrastructure.adapters.api.auth;
-
-public interface UserIdentityProvider {
- String getAuthId();
- String getName();
-}
diff --git a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthenticationProperties.java b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthenticationProperties.java
index bdd62f7b..7893e05b 100644
--- a/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthenticationProperties.java
+++ b/src/main/java/com/decathlon/idp_core/infrastructure/adapters/api/configuration/AuthenticationProperties.java
@@ -7,75 +7,34 @@
import com.decathlon.idp_core.infrastructure.adapters.api.principal.PrincipalExtractor;
-/**
- * Type-safe authentication and JWT configuration properties bound from
- * {@code app.security.authentication}.
- *
- *
Purpose
Externalizes all hardcoded authentication logic to
- * configuration, enabling:
- *
- *
Support for multiple Identity Providers (Auth0, Keycloak, Azure AD,
- * etc.)
- *
Flexible service account detection without code changes
- *
Conditional authentication mechanism selection per environment
- *
Clear documentation of IdP-specific token claim expectations
- *
- *
- *
Design rationale
Follows the same pattern as {@code CorsProperties}
- * and {@code SecurityRoleProperties}. Configuration is externalized to
- * {@code application.yml} for easy environment customization.
- *
- *
Claim Mapping Strategy
Different IdPs use different JWT claim names
- * for the same semantic meaning. This configuration allows mapping IdP-specific
- * claim names to standardized extraction logic.
- *