首页 > 其他 > 详细

ResourceServerConfig过滤器优先级

时间:2021-01-26 21:37:48      阅读:81      评论:0      收藏:0      [点我收藏+]
@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
    private final JsonToUrlEncodedAuthenticationFilter jsonFilter;
    private final LogFilter logFilter;
    private final HLandraySsoFilter hLandraySsoFilter;

    @Autowired
    public ResourceServerConfig(JsonToUrlEncodedAuthenticationFilter jsonFilter, LogFilter logFilter, HLandraySsoFilter hLandraySsoFilter) {
        this.jsonFilter = jsonFilter;
        this.logFilter = logFilter;
        this.hLandraySsoFilter = hLandraySsoFilter;
    }

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.requestMatchers().antMatchers("/api/**", "/token/**", "/sso/**",
                "/hSsoCallback**", "/hOldSsoCallback**", "/hOldSsoRedirect**")
                .and() //允许上面这些接口访问
                .authorizeRequests().antMatchers("/api/aes/**").permitAll().and()  //"/api/aes/**"的接口请求不需要auth校验
                .authorizeRequests()
                .antMatchers("/api/**").authenticated(); //"/api/**"需要auth校验
//
-2147483648

http.addFilterBefore(logFilter, ChannelProcessingFilter.class);
//未配置@Order ,默认为
ChannelProcessingFilter.class的Order减1
http.addFilterBefore(new ClientInfoFilter(), ChannelProcessingFilter.class); 
//
0x80000000(16进制)=2147483648(十进制)
http.addFilterBefore(jsonFilter, ChannelProcessingFilter.class); 
http.addFilterBefore(
new SimpleCorsFilter(), ChannelProcessingFilter.class);
http.addFilterBefore(hLandraySsoFilter, ChannelProcessingFilter.
class); } }

 

ResourceServerConfig过滤器优先级

原文:https://www.cnblogs.com/zaierzai/p/14331192.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!