问题遇到的现象和发生背景
SpringSecurity + JWT + Vue实现登录时出现403拒绝访问错误,后端开启了关闭跨域保护,可依旧报错
问题相关代码,请勿粘贴截图
/**
* 核心配置,认证用户
* @param http
* @throws Exception
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/hello").hasRole("user")
.antMatchers("/admin").hasRole("system_manage")
.antMatchers("/login").permitAll()
.anyRequest().authenticated()
.and()
.addFilterBefore(new JwtLoginFilter("/login",authenticationManager()), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(new JwtFilter(),UsernamePasswordAuthenticationFilter.class)
.csrf().disable();
}
运行结果及报错内容
我的解答思路和尝试过的方法
加了任何跨域解决方案依旧是403
我想要达到的结果
正常实现登录