接口 SaFilter
public interface SaFilter
Sa-Token 过滤器接口,为不同版本的过滤器:
1、封装共同代码。
2、定义统一的行为接口。
- 从以下版本开始:
- 1.34.0
- 作者:
- click33
-
方法概要
修饰符和类型方法说明addExclude(String... paths) 添加 [ 放行路由 ]addInclude(String... paths) 添加 [ 拦截路由 ]setAuth(SaFilterAuthStrategy auth) 写入[ 认证函数 ]: 每次请求执行setBeforeAuth(SaFilterAuthStrategy beforeAuth) 写入[ 前置函数 ]:在每次[ 认证函数 ]之前执行。setError(SaFilterErrorStrategy error) 写入[ 异常处理函数 ]:每次[ 认证函数 ]发生异常时执行此函数setExcludeList(List<String> pathList) 写入 [ 放行路由 ] 集合setIncludeList(List<String> pathList) 写入 [ 拦截路由 ] 集合
-
方法详细资料
-
addInclude
添加 [ 拦截路由 ]- 参数:
paths- 路由- 返回:
- 对象自身
-
addExclude
添加 [ 放行路由 ]- 参数:
paths- 路由- 返回:
- 对象自身
-
setIncludeList
写入 [ 拦截路由 ] 集合- 参数:
pathList- 路由集合- 返回:
- 对象自身
-
setExcludeList
写入 [ 放行路由 ] 集合- 参数:
pathList- 路由集合- 返回:
- 对象自身
-
setAuth
写入[ 认证函数 ]: 每次请求执行- 参数:
auth- see note- 返回:
- 对象自身
-
setError
写入[ 异常处理函数 ]:每次[ 认证函数 ]发生异常时执行此函数- 参数:
error- see note- 返回:
- 对象自身
-
setBeforeAuth
写入[ 前置函数 ]:在每次[ 认证函数 ]之前执行。 注意点:前置认证函数将不受 includeList 与 excludeList 的限制,所有路由的请求都会进入 beforeAuth- 参数:
beforeAuth- /- 返回:
- 对象自身
-