Reactive-Spring-Security-5.1.3.RELEASE, multiple authorizations

前端 未结 1 521
鱼传尺愫
鱼传尺愫 2021-01-15 23:07

We have some endpoints, that are secured and before to access them we\'re verifying that the jws is correctly. In order to do that, we\'ve defined a SecurityContext that act

相关标签:
1条回答
  • 2021-01-15 23:30

    You can expose more than one bean. I recommend specifying an order:

    @Bean
    @Order(1)
    public SecurityWebFilterChain first(ServerHttpSecurity http) {
        http
            .securityMatcher(...)
            ...
    
        return http.build();
    }
    
    @Bean
    @Order(2)
    public SecurityWebFilterChain second(ServerHttpSecurity http) {
       http
           .securityMatcher(...)
           ...
    
       return http.build();
    }
    

    As a side note, Spring Security does ship with support for verifying JWS tokens reactively, and you might be able to remove some boilerplate by using it.

    0 讨论(0)
提交回复
热议问题