123
This commit is contained in:
1 parent
951912687a
commit
cf9c801b93
1 file changed
+19
-6
@@ -62,6 +62,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TraceIdFilter traceIdFilter;
|
||||||
/**
|
/**
|
||||||
* 跨域过滤器
|
* 跨域过滤器
|
||||||
*/
|
*/
|
||||||
@@ -138,12 +140,23 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.and()
|
.and()
|
||||||
.headers().frameOptions().disable();
|
.headers().frameOptions().disable();
|
||||||
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler);
|
||||||
// 添加JWT filter
|
// CORS Filter
|
||||||
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
httpSecurity.addFilterBefore(
|
||||||
// 添加CORS filter
|
corsFilter,
|
||||||
httpSecurity.addFilterBefore(corsFilter, TraceIdFilter.class);
|
LogoutFilter.class
|
||||||
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
|
);
|
||||||
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
|
|
||||||
|
// TraceId Filter
|
||||||
|
httpSecurity.addFilterBefore(
|
||||||
|
traceIdFilter,
|
||||||
|
LogoutFilter.class
|
||||||
|
);
|
||||||
|
|
||||||
|
// JWT Filter
|
||||||
|
httpSecurity.addFilterAfter(
|
||||||
|
authenticationTokenFilter,
|
||||||
|
TraceIdFilter.class
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user