Class AuthInterceptor
java.lang.Object
cn.coufran.springboot.starter.auth.config.AuthInterceptor
- All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor
public class AuthInterceptor
extends Object
implements org.springframework.web.servlet.HandlerInterceptor
权限拦截器
- Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Coufran
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWhitePath(String whitePath) 添加权限拦截路径白名单booleanpreHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) 拦截请求,做权限校验voidremoveWhitePath(String whitePath) 移除权限拦截路径白名单voidsetAuthAdditions(List<AuthAddition> authAdditions) 设置自定义拦截规则voidsetWhitePaths(List<String> whitePaths) 设置权限拦截路径白名单Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.HandlerInterceptor
afterCompletion, postHandle
-
Constructor Details
-
AuthInterceptor
构造拦截器- Parameters:
authUser- 权限用户
-
-
Method Details
-
setWhitePaths
设置权限拦截路径白名单- Parameters:
whitePaths- 权限拦截路径白名单
-
addWhitePath
添加权限拦截路径白名单- Parameters:
whitePath- 权限拦截路径白名单
-
removeWhitePath
移除权限拦截路径白名单- Parameters:
whitePath- 权限拦截路径白名单
-
setAuthAdditions
设置自定义拦截规则- Parameters:
authAdditions- 自定义拦截规则
-
preHandle
public boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler) throws Exception 拦截请求,做权限校验- Specified by:
preHandlein interfaceorg.springframework.web.servlet.HandlerInterceptor- Throws:
Exception
-