zoukankan      html  css  js  c++  java
  • ResourceServerConfig过滤器优先级

    @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); } }
  • 相关阅读:
    后端Golang+前端React架构开发案例
    Vim技巧大全
    Draggable Modal dialog in Bootstrap
    Github.com的镜像站
    kettle之excel上传数据库
    自定义函数之分割函数
    jmeter 压测 ActiveMq 消息队列
    SQL---查找+删除重复记录
    异常值检测(Outlier Detection)
    使用u盘在pc上安装centos7(安装停留在dracut:/#的处理)
  • 原文地址:https://www.cnblogs.com/zaierzai/p/14331192.html
Copyright © 2011-2022 走看看