@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); } }

 

相关文章:

  • 2021-10-27
  • 2021-06-20
  • 2021-06-17
  • 2021-11-09
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-04
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
  • 2021-11-05
相关资源
相似解决方案