Skip to content

Commit f0515a0

Browse files
committed
Polish #7116
1 parent 2ddab8b commit f0515a0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/WebClientReactiveRefreshTokenTokenResponseClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.springframework.core.io.buffer.DataBuffer;
1919
import org.springframework.core.io.buffer.DataBufferUtils;
2020
import org.springframework.http.HttpHeaders;
21+
import org.springframework.http.HttpStatus;
2122
import org.springframework.http.MediaType;
2223
import org.springframework.security.oauth2.client.registration.ClientRegistration;
2324
import org.springframework.security.oauth2.core.AuthorizationGrantType;
@@ -66,7 +67,8 @@ public Mono<OAuth2AccessTokenResponse> getTokenResponse(OAuth2RefreshTokenGrantR
6667
.body(tokenRequestBody(refreshTokenGrantRequest))
6768
.exchange()
6869
.flatMap(response -> {
69-
if (!response.statusCode().is2xxSuccessful()) {
70+
HttpStatus status = HttpStatus.resolve(response.rawStatusCode());
71+
if (status == null || !status.is2xxSuccessful()) {
7072
OAuth2Error oauth2Error = new OAuth2Error(INVALID_TOKEN_RESPONSE_ERROR_CODE,
7173
"An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: " +
7274
"HTTP Status Code " + response.rawStatusCode(), null);

0 commit comments

Comments
 (0)