2021与蓝度共同重构项目,服务端
liuhaonan
2022-01-18 51b53373d150e4107a51fcf502d0598b7d82c455
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
51
52
53
54
55
package com.sandu.common.security.config;
 
import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
 
/**
 * @author chenjiantian
 * @date 2021/4/23 16:39
 * spring security 相关配置
 */
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "sandu.jwt")
public class SecurityProperties {
    /**
     * Request Headers : Authorization
     */
    private String header;
 
    /**
     * 令牌前缀,最后留个空格 Bearer
     */
    private String tokenStartWith;
 
    /**
     * 必须使用最少88位的Base64对该令牌进行编码
     */
    private String base64Secret;
 
    /**
     * 令牌过期时间 此处单位/毫秒
     */
    private Long tokenValidityInSeconds;
 
    /**
     * 在线用户 model name
     */
    private String onlineKey;
 
    /**
     * 是否redis缓存 在线用户
     */
    private boolean cacheOnline = false;
 
    public String getTokenStartWith() {
        if(StrUtil.isBlank(tokenStartWith)){
            return "";
        }
        return tokenStartWith + " ";
    }
}