类 SaInterceptor

java.lang.Object
cn.sinozg.applet.common.sa.SaInterceptor
所有已实现的接口:
org.springframework.web.servlet.HandlerInterceptor

public class SaInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor
Sa-Token 综合拦截器,提供注解鉴权和路由拦截鉴权能力 重写,保证可以拿到具体异常 由全局异常处理器去处理所有的异常
从以下版本开始:
1.31.0
作者:
click33
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    boolean
    是否打开注解鉴权,配置为 true 时注解鉴权才会生效,配置为 false 时,即使写了注解也不会进行鉴权
  • 构造器概要

    构造器
    构造器
    说明
    创建一个 Sa-Token 综合拦截器,默认带有注解鉴权能力
  • 方法概要

    修饰符和类型
    方法
    说明
    isAnnotation(boolean isAnnotation)
    设置是否打开注解鉴权:配置为 true 时注解鉴权才会生效,配置为 false 时,即使写了注解也不会进行鉴权
    boolean
    preHandle(@NotNull jakarta.servlet.http.HttpServletRequest request, @NotNull jakarta.servlet.http.HttpServletResponse response, @NotNull Object handler)
    每次请求之前触发的方法

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    从接口继承的方法 org.springframework.web.servlet.HandlerInterceptor

    afterCompletion, postHandle
  • 字段详细资料

    • isAnnotation

      public boolean isAnnotation
      是否打开注解鉴权,配置为 true 时注解鉴权才会生效,配置为 false 时,即使写了注解也不会进行鉴权
  • 构造器详细资料

    • SaInterceptor

      public SaInterceptor()
      创建一个 Sa-Token 综合拦截器,默认带有注解鉴权能力
  • 方法详细资料

    • isAnnotation

      public SaInterceptor isAnnotation(boolean isAnnotation)
      设置是否打开注解鉴权:配置为 true 时注解鉴权才会生效,配置为 false 时,即使写了注解也不会进行鉴权
      参数:
      isAnnotation - /
      返回:
      对象自身
    • preHandle

      public boolean preHandle(@NotNull @NotNull jakarta.servlet.http.HttpServletRequest request, @NotNull @NotNull jakarta.servlet.http.HttpServletResponse response, @NotNull @NotNull Object handler) throws Exception
      每次请求之前触发的方法
      指定者:
      preHandle 在接口中 org.springframework.web.servlet.HandlerInterceptor
      抛出:
      Exception