package jnpf.dmsPermission; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @Component @RequiredArgsConstructor public class DmsTrustedServiceGuard { private final DmsPermissionProperties properties; public String requireAllowed(String serviceId) { String normalized = serviceId == null ? "" : serviceId.trim(); if (normalized.isEmpty() || !properties.getResourceRegistrationServiceIds().contains(normalized)) { throw DmsPermissionException.of(DmsPermissionError.TRUSTED_SERVICE_REQUIRED, "资源创建调用方不在 DMS 受信服务白名单中"); } return normalized; } }