Commit c6a225ff authored by macro's avatar macro
Browse files

Update SecurityConfig.java

parent 0511fc48
...@@ -46,23 +46,23 @@ public class SecurityConfig { ...@@ -46,23 +46,23 @@ public class SecurityConfig {
//允许跨域请求的OPTIONS请求 //允许跨域请求的OPTIONS请求
registry.antMatchers(HttpMethod.OPTIONS) registry.antMatchers(HttpMethod.OPTIONS)
.permitAll(); .permitAll();
// 任何请求需要身份认证 //任何请求需要身份认证
registry.and() registry.and()
.authorizeRequests() .authorizeRequests()
.anyRequest() .anyRequest()
.authenticated() .authenticated()
// 关闭跨站请求防护及不使用session //关闭跨站请求防护及不使用session
.and() .and()
.csrf() .csrf()
.disable() .disable()
.sessionManagement() .sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS) .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
// 自定义权限拒绝处理类 //自定义权限拒绝处理类
.and() .and()
.exceptionHandling() .exceptionHandling()
.accessDeniedHandler(restfulAccessDeniedHandler) .accessDeniedHandler(restfulAccessDeniedHandler)
.authenticationEntryPoint(restAuthenticationEntryPoint) .authenticationEntryPoint(restAuthenticationEntryPoint)
// 自定义权限拦截器JWT过滤器 //自定义权限拦截器JWT过滤器
.and() .and()
.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); .addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
//有动态权限配置时添加动态权限校验过滤器 //有动态权限配置时添加动态权限校验过滤器
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment