mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
refactor: 封装公共配置,降低使用复杂度
This commit is contained in:
@@ -31,8 +31,10 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory;
|
||||
|
||||
/**
|
||||
* Sa-Token 自动配置
|
||||
@@ -45,6 +47,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@RequiredArgsConstructor
|
||||
@EnableConfigurationProperties(SaTokenExtensionProperties.class)
|
||||
@ConditionalOnProperty(prefix = "sa-token.extension", name = "enabled", havingValue = "true")
|
||||
@PropertySource(value = "classpath:default-auth-satoken.yml", factory = GeneralPropertySourceFactory.class)
|
||||
public class SaTokenAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private final SaTokenExtensionProperties properties;
|
||||
|
@@ -0,0 +1,10 @@
|
||||
--- ### Sa-Token 配置(https://sa-token.cc/doc.html#/use/config)
|
||||
sa-token:
|
||||
# token 前缀(例如填写 Bearer,实际传参 token 键: Bearer xxxx-xxxx-xxxx-xxxx)
|
||||
token-prefix: Bearer
|
||||
# 是否尝试从 请求体 里读取 Token
|
||||
is-read-body: true
|
||||
# 是否尝试从 header 里读取 Token
|
||||
is-read-header: true
|
||||
# 是否尝试从 cookie 里读取 Token(此值为 false 后,StpUtil.login(id) 登录时也不会再往前端注入 Cookie,适合前后端分离模式)
|
||||
is-read-cookie: false
|
Reference in New Issue
Block a user