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); } }
  • 相关阅读:
    Redis(三)、Redis主从复制
    Redis(二)、Redis持久化RDB和AOF
    Redis(一)、Redis五种数据结构
    docker(部署常见应用):docker部署redis
    docker(三):Harbor 1.8.0 仓库的安装和使用
    Redis List 命令技巧
    数据库——MySQL——事务
    数据库——MySQL
    数据库——MySQL——权限管理
    数据库——MySQL——多表查询
  • 原文地址:https://www.cnblogs.com/zaierzai/p/14331192.html
Copyright © 2011-2022 走看看