private Mono<Void> filterInternal(ServerWebExchange wrappedExchange, WebFilterChain chain) { return this.requiresAuthenticationMatcher.matches(wrappedExchange) .filter( matchResult -> matchResult.isMatch()) .flatMap( matchResult -> this.authenticationConverter.apply(wrappedExchange)) .switchIfEmpty(chain.filter(wrappedExchange).then(Mono.empty())) .flatMap( token -> authenticate(wrappedExchange, chain, token)); }
@Override public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { return this.requiresAuthenticationMatcher.matches(exchange) .filter( matchResult -> matchResult.isMatch()) .flatMap( matchResult -> this.authenticationConverter.convert(exchange)) .switchIfEmpty(chain.filter(exchange).then(Mono.empty())) .flatMap( token -> authenticate(exchange, chain, token)); }