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 + " ";
|
}
|
}
|