刘光辉
昨天 bb638871a7fb692d80f1b7a758f991dc0879002c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
    }
}