新增客户端令牌认证 - secure放行策略

This commit is contained in:
mameng 2020-05-29 11:43:10 +08:00
parent 3e974afe30
commit bc9fa6af33
2 changed files with 19 additions and 1 deletions

View File

@ -52,7 +52,14 @@ public class SecureConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
secureProperties.getClient().forEach(cs -> registry.addInterceptor(new ClientInterceptor(cs.getClientId())).addPathPatterns(cs.getPathPatterns()));
secureProperties.getClient()
.parallelStream()
.forEach(
cs -> registry.addInterceptor(new ClientInterceptor(cs.getClientId()))
.addPathPatterns(cs.getPathPatterns())
.excludePathPatterns(cs.getSkipUrl())
);
if (secureRegistry.isEnabled()) {
registry.addInterceptor(new SecureInterceptor())

View File

@ -28,8 +28,19 @@ import java.util.List;
@Data
public class ClientSecure {
/**
* 客户端id
*/
private String clientId;
/**
* secure拦截策略
*/
private final List<String> pathPatterns = new ArrayList<>();
/**
* secure放行策略
*/
private final List<String> skipUrl = new ArrayList<>();
}