增加Cookie模式的secure、httpOnly、sameSite等配置

This commit is contained in:
click33
2021-10-05 23:51:04 +08:00
parent cf6632df79
commit 643118177a
12 changed files with 541 additions and 172 deletions

View File

@@ -133,7 +133,7 @@ public class SaTokenJwtUtil {
String tokenValue = createTokenValue(loginId);
storage.set(splicingKeyJustCreatedSave(), tokenValue); // 将token保存到本次request里
if(config.getIsReadCookie() == true){ // cookie注入
SaManager.getSaTokenContext().getResponse().addCookie(getTokenName(), tokenValue, "/", config.getCookieDomain(), (int)config.getTimeout());
SaManager.getSaTokenContext().getResponse().addCookie(getTokenName(), tokenValue, "/", config.getCookie().getDomain(), (int)config.getTimeout());
}
}

View File

@@ -37,7 +37,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 注册注解拦截器
registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**").excludePathPatterns("");
registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**");
}
/**

View File

@@ -239,7 +239,7 @@ public class TestController {
// 测试 浏览器访问: http://localhost:8081/test/test
@RequestMapping("test")
public AjaxJson test() {
System.out.println("进来了");
System.out.println("------------进来了");
return AjaxJson.getSuccess();
}
@@ -249,6 +249,4 @@ public class TestController {
return AjaxJson.getSuccess();
}
}

View File

@@ -18,7 +18,7 @@ sa-token:
token-style: uuid
# 是否输出操作日志
is-log: false
spring:
# redis配置
redis: