feat: expose vendor auth policy in public config endpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-27 08:48:13 +02:00
parent 89c83ec7b8
commit 9057479da7

View File

@@ -2,6 +2,7 @@ package net.siegeln.cameleer.saas.config;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import net.siegeln.cameleer.saas.vendor.VendorAuthPolicyRepository;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -25,6 +26,11 @@ public class PublicConfigController {
private String spaClientId; private String spaClientId;
private final ObjectMapper objectMapper = new ObjectMapper(); private final ObjectMapper objectMapper = new ObjectMapper();
private final VendorAuthPolicyRepository vendorPolicyRepo;
public PublicConfigController(VendorAuthPolicyRepository vendorPolicyRepo) {
this.vendorPolicyRepo = vendorPolicyRepo;
}
private static final List<String> SCOPES = List.of( private static final List<String> SCOPES = List.of(
"platform:admin", "platform:admin",
@@ -61,11 +67,19 @@ public class PublicConfigController {
endpoint = "http://localhost:3001"; endpoint = "http://localhost:3001";
} }
var policy = vendorPolicyRepo.getPolicy();
var vendorAuthPolicy = Map.of(
"mfaMode", policy.getMfaMode(),
"passkeyEnabled", policy.isPasskeyEnabled(),
"passkeyMode", policy.getPasskeyMode()
);
return Map.of( return Map.of(
"logtoEndpoint", endpoint, "logtoEndpoint", endpoint,
"logtoClientId", clientId != null ? clientId : "", "logtoClientId", clientId != null ? clientId : "",
"logtoResource", apiResource, "logtoResource", apiResource,
"scopes", SCOPES "scopes", SCOPES,
"vendorAuthPolicy", vendorAuthPolicy
); );
} }