forked from kidgrow-microservices-platform

zhaoxiaohao
2020-10-30 2e109492d152e08bfca445b54f15c91a2334f21c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.kidgrow.authclient.properties;
 
import lombok.Data;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @Description: 放权白名单列表<br>
 * @Project: <br>
 * @CreateDate: Created in 2020/2/13 10:39 <br>
 * @Author: <a href="4345453@kidgrow.com">liuke</a>
 */
@Data
public class PermitProperties {
    /**
     * 监控中心和swagger需要访问的url
     */
    private static final String[] ENDPOINTS = {
            "/oauth/**",
            "/actuator/**",
            "/*/v2/api-docs",
            "/swagger/api-docs",
            "/swagger-ui.html",
            "/swagger-resources/**",
            "/webjars/**",
            "/druid/**"
    };
 
    /**
     * 设置不用认证的url
     */
    private String[] httpUrls = {};
 
    public String[] getUrls() {
        if (httpUrls == null || httpUrls.length == 0) {
            return ENDPOINTS;
        }
        List<String> list = new ArrayList<>();
        for (String url : ENDPOINTS) {
            list.add(url);
        }
        for (String url : httpUrls) {
            list.add(url);
        }
        return list.toArray(new String[list.size()]);
    }
}