mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-06-28 13:34:18 +08:00
v1.40.0 update .
This commit is contained in:
parent
8cbb09d6b7
commit
1fe9a644c7
@ -42,17 +42,17 @@ public final class SaFirewallStrategy {
|
||||
/**
|
||||
* 请求 path 黑名单
|
||||
*/
|
||||
public String[] BLACK_PATHS = {};
|
||||
public String[] blackPaths = {};
|
||||
|
||||
/**
|
||||
* 请求 path 白名单
|
||||
*/
|
||||
public String[] WHITE_PATHS = {};
|
||||
public String[] whitePaths = {};
|
||||
|
||||
/**
|
||||
* 请求 path 不允许出现的字符
|
||||
*/
|
||||
public String[] INVALID_CHARACTER = {
|
||||
public String[] invalidCharacter = {
|
||||
"//", // //
|
||||
"\\", // \
|
||||
"%2e", "%2E", // .
|
||||
@ -67,14 +67,14 @@ public final class SaFirewallStrategy {
|
||||
*/
|
||||
public SaCheckRequestPathFunction checkRequestPath = (requestPath, extArg1, extArg2) -> {
|
||||
// 1、如果在白名单里,则直接放行
|
||||
for (String item : WHITE_PATHS) {
|
||||
for (String item : whitePaths) {
|
||||
if (requestPath.equals(item)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2、如果在黑名单里,则抛出异常
|
||||
for (String item : BLACK_PATHS) {
|
||||
for (String item : blackPaths) {
|
||||
if (requestPath.equals(item)) {
|
||||
throw new RequestPathInvalidException("非法请求:" + requestPath, requestPath);
|
||||
}
|
||||
@ -87,7 +87,7 @@ public final class SaFirewallStrategy {
|
||||
throw new RequestPathInvalidException("非法请求:null", null);
|
||||
}
|
||||
// 不允许包含非法字符
|
||||
for (String item : INVALID_CHARACTER) {
|
||||
for (String item : invalidCharacter) {
|
||||
if (requestPath.contains(item)) {
|
||||
throw new RequestPathInvalidException("非法请求:" + requestPath, requestPath);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.pj;
|
||||
|
||||
import cn.dev33.satoken.oauth2.SaOAuth2Manager;
|
||||
import cn.dev33.satoken.oauth2.template.SaOAuth2Util;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@ -16,7 +15,6 @@ public class SaOAuth2ServerApplication {
|
||||
SpringApplication.run(SaOAuth2ServerApplication.class, args);
|
||||
System.out.println("\nSa-Token-OAuth2 Server端启动成功,配置如下:");
|
||||
System.out.println(SaOAuth2Manager.getServerConfig());
|
||||
SaOAuth2Util.getCode("xxxxxxxxx");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.pj.satoken;
|
||||
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
|
||||
/**
|
||||
* 自定义权限验证接口扩展
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user