刘光辉
15 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
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;
    }
}