v1.40.0 update .

This commit is contained in:
click33 2025-01-31 23:28:02 +08:00
parent 8cbb09d6b7
commit 1fe9a644c7
3 changed files with 9 additions and 12 deletions

View File

@ -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);
}

View File

@ -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");
}
}

View File

@ -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;
/**
* 自定义权限验证接口扩展
*/