Remove use of Mono.deferWithContext()

Closes gh-8901
This commit is contained in:
Joe Grandja 2020-07-28 11:44:57 -04:00
parent dfaf251970
commit 4e5a304a8a
2 changed files with 2 additions and 4 deletions

View File

@ -139,14 +139,13 @@ public final class DefaultReactiveOAuth2AuthorizedClientManager implements React
.defaultIfEmpty(authorizeRequest.getAuthorizedClient() != null ?
authorizeRequest.getAuthorizedClient() : authorizedClient);
})
.switchIfEmpty(Mono.deferWithContext(context ->
.switchIfEmpty(Mono.defer(() ->
// Authorize
this.clientRegistrationRepository.findByRegistrationId(clientRegistrationId)
.switchIfEmpty(Mono.error(() -> new IllegalArgumentException(
"Could not find ClientRegistration with id '" + clientRegistrationId + "'")))
.flatMap(clientRegistration -> authorizationContext(authorizeRequest, clientRegistration))
.flatMap(authorizationContext -> authorize(authorizationContext, principal, serverWebExchange))
.subscriberContext(context)
)
));
}

View File

@ -540,14 +540,13 @@ public final class ServerOAuth2AuthorizedClientExchangeFilterFunction implements
.defaultIfEmpty(authorizeRequest.getAuthorizedClient() != null ?
authorizeRequest.getAuthorizedClient() : authorizedClient);
})
.switchIfEmpty(Mono.deferWithContext(context ->
.switchIfEmpty(Mono.defer(() ->
// Authorize
this.clientRegistrationRepository.findByRegistrationId(clientRegistrationId)
.switchIfEmpty(Mono.error(() -> new IllegalArgumentException(
"Could not find ClientRegistration with id '" + clientRegistrationId + "'")))
.flatMap(clientRegistration -> Mono.just(OAuth2AuthorizationContext.withClientRegistration(clientRegistration).principal(principal).build()))
.flatMap(authorizationContext -> authorize(authorizationContext, principal))
.subscriberContext(context)
));
}