quick login 增加可配置include

This commit is contained in:
xiejiay 2021-06-24 00:03:51 +08:00
parent 6c874e6737
commit 6935889d39
2 changed files with 22 additions and 14 deletions

View File

@ -59,10 +59,9 @@ public class SaQuickBean implements WebMvcConfigurer {
@Order(SaTokenConsts.ASSEMBLY_ORDER - 1)
public SaServletFilter getSaServletFilter() {
return new SaServletFilter().
// 拦截路由 & 放行路由
addInclude("/**").addExclude("/favicon.ico", "/saLogin", "/doLogin", "/sa-res/**").
addInclude(SaQuickManager.getConfig().getInclude().split(","))
.addExclude("/favicon.ico", "/saLogin", "/doLogin", "/sa-res/**").
// 认证函数: 每次请求执行
setAuth(r -> {
// System.out.println("---------- 进入sa-token全局认证 -----------");

View File

@ -26,7 +26,9 @@ public class SaQuickConfig {
/** 是否显示底部版权信息 */
private Boolean copr = true;
/** 配置拦截的路径,逗号分隔 */
private String include = "/**";
public Boolean getAuth() {
return auth;
}
@ -75,16 +77,23 @@ public class SaQuickConfig {
this.copr = copr;
}
@Override
public String toString() {
return "SaQuickConfig [auth=" + auth + ", name=" + name + ", pwd=" + pwd + ", auto=" + auto + ", title=" + title
+ ", copr=" + copr + "]";
public String getInclude() {
return include;
}
public void setInclude(String include) {
this.include = include;
}
@Override
public String toString() {
return "SaQuickConfig{" +
"auth=" + auth +
", name='" + name + '\'' +
", pwd='" + pwd + '\'' +
", auto=" + auto +
", title='" + title + '\'' +
", copr=" + copr +
", include='" + include + '\'' +
'}';
}
}