Spring security with Oauth2 or Http-Basic authentication for the same resource

前端 未结 8 1187
南方客
南方客 2021-01-30 09:07

I\'m attempting to implement an API with resources that are protected by either Oauth2 OR Http-Basic authentication.

When I load the WebSecurityConfigurerAdapter which a

8条回答
  •  不知归路
    2021-01-30 09:23

    If anyone is trying to get this working with Spring WebFlux, the method which determines whether the request is handled is called "securityMatcher", rather than "requestMatcher".

    i.e.

    fun configureBasicAuth(http: ServerHttpSecurity): SecurityWebFilterChain {
        return http
            .securityMatcher(BasicAuthServerWebExchangeMatcher())
            .authorizeExchange()
            ...
    

提交回复
热议问题