Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
c6a225ff
Commit
c6a225ff
authored
Aug 29, 2024
by
macro
Browse files
Update SecurityConfig.java
parent
0511fc48
Changes
1
Hide whitespace changes
Inline
Side-by-side
mall-security/src/main/java/com/macro/mall/security/config/SecurityConfig.java
View file @
c6a225ff
...
...
@@ -46,23 +46,23 @@ public class SecurityConfig {
//允许跨域请求的OPTIONS请求
registry
.
antMatchers
(
HttpMethod
.
OPTIONS
)
.
permitAll
();
//
任何请求需要身份认证
//任何请求
都
需要身份认证
registry
.
and
()
.
authorizeRequests
()
.
anyRequest
()
.
authenticated
()
//
关闭跨站请求防护及不使用session
//关闭跨站请求防护及不使用session
.
and
()
.
csrf
()
.
disable
()
.
sessionManagement
()
.
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
)
//
自定义权限拒绝处理类
//自定义权限拒绝处理类
.
and
()
.
exceptionHandling
()
.
accessDeniedHandler
(
restfulAccessDeniedHandler
)
.
authenticationEntryPoint
(
restAuthenticationEntryPoint
)
//
自定义权限拦截器JWT过滤器
//自定义权限拦截器JWT过滤器
.
and
()
.
addFilterBefore
(
jwtAuthenticationTokenFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
//有动态权限配置时添加动态权限校验过滤器
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment