From b905cb8aaa98b4d702af34ae67c18dfec2582a9e Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Wed, 27 Nov 2019 12:37:47 -0500 Subject: [PATCH] Polish OAuth2AuthorizedClientArgumentResolver --- .../OAuth2AuthorizedClientArgumentResolver.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolver.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolver.java index 38e825b3f7..5f784a51c1 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolver.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/result/method/annotation/OAuth2AuthorizedClientArgumentResolver.java @@ -137,13 +137,11 @@ public final class OAuth2AuthorizedClientArgumentResolver implements HandlerMeth .switchIfEmpty(currentServerWebExchange()); return Mono.zip(defaultedRegistrationId, defaultedAuthentication, defaultedExchange) - .map(t3 -> { - OAuth2AuthorizeRequest.Builder builder = OAuth2AuthorizeRequest.withClientRegistrationId(t3.getT1()).principal(t3.getT2()); - if (t3.getT3() != null) { - builder.attribute(ServerWebExchange.class.getName(), t3.getT3()); - } - return builder.build(); - }); + .map(t3 -> OAuth2AuthorizeRequest.withClientRegistrationId(t3.getT1()) + .principal(t3.getT2()) + .attribute(ServerWebExchange.class.getName(), t3.getT3()) + .build() + ); } private Mono currentAuthentication() {