一共有两种方法:
方法一: 找到SecurityConfig类的configue 方法中设置 httpSecurity 配置匿名访问
//接口
.antMatchers( "/api/**").permitAll()
配置完匿名访问之后,还需要将请求接口上的权限注解进行移除。
如下图红色框中所示
方法二:添加注解,@Anonymous
在ruo-common的module模块,新增一个接口Anonymous。
import java.lang.annotation.*;/** * 匿名访问不鉴权注解 * * @author ruoyi */@Target({ ElementType.METHOD, ElementType.TYPE })@Retention(RetentionPolicy.RUNTIME)@Documentedpublic @interface Anonymous{} 




暂无评论