Skip to content

Commit 2ada3f0

Browse files
committed
Polish gh-18888
1 parent 8f2a5a7 commit 2ada3f0

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public final class ServerOAuth2AuthorizedClientExchangeFilterFunction implements
119119
"anonymous", "anonymousUser", AuthorityUtils.createAuthorityList("ROLE_USER"));
120120

121121
private final Mono<Authentication> currentAuthenticationMono = ReactiveSecurityContextHolder.getContext()
122-
.mapNotNull(SecurityContext::getAuthentication);
122+
.flatMap((ctx) -> Mono.justOrEmpty(ctx.getAuthentication()));
123123

124124
// @formatter:off
125125
private final Mono<String> clientRegistrationIdMono = this.currentAuthenticationMono
@@ -526,7 +526,7 @@ public interface PrincipalResolver {
526526
* request, which is used to obtain an {@link OAuth2AuthorizedClient}.
527527
* @param request the intercepted request, containing HTTP method, URI, headers,
528528
* and request attributes
529-
* @return the {@link Mono} of the {@link Authentication principal} to be used for
529+
* @return a {@link Mono} of the {@link Authentication principal} to be used for
530530
* resolving an {@link OAuth2AuthorizedClient}
531531
*/
532532
Mono<Authentication> resolve(ClientRequest request);

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/reactive/function/client/ServletOAuth2AuthorizedClientExchangeFilterFunction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,12 +617,12 @@ public Object getPrincipal() {
617617
public interface PrincipalResolver {
618618

619619
/**
620-
* Resolve a {@link Authentication principal} from the current request, which is
620+
* Resolve the {@link Authentication principal} from the current request, which is
621621
* used to obtain an {@link OAuth2AuthorizedClient}.
622622
* @param request the intercepted request, containing HTTP method, URI, headers,
623623
* and request attributes
624-
* @return the {@link Mono} of the {@link Authentication principal} to be used for
625-
* resolving an {@link OAuth2AuthorizedClient}
624+
* @return the {@link Authentication principal} to be used for resolving an
625+
* {@link OAuth2AuthorizedClient}
626626
*/
627627
@Nullable Authentication resolve(ClientRequest request);
628628

0 commit comments

Comments
 (0)