fix: 补全 SaFirewallCheckHook 全局自动注入

This commit is contained in:
click33 2025-03-14 19:44:30 +08:00
parent bfb34293d6
commit a01eef8000

View File

@ -38,6 +38,8 @@ import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.stp.StpLogic;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
import cn.dev33.satoken.strategy.SaFirewallStrategy;
import cn.dev33.satoken.strategy.hooks.SaFirewallCheckHook;
import cn.dev33.satoken.temp.SaTempInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@ -231,4 +233,16 @@ public class SaBeanInject {
SaPathMatcherHolder.setPathMatcher(pathMatcher);
}
/**
* 注入自定义防火墙校验 hook 集合
*
* @param hooks /
*/
@Autowired(required = false)
public void setSaFirewallCheckHooks(List<SaFirewallCheckHook> hooks) {
for (SaFirewallCheckHook hook : hooks) {
SaFirewallStrategy.instance.registerHook(hook);
}
}
}