|
|
|
@ -28,6 +28,7 @@ import org.springframework.http.ReactiveHttpInputMessage; |
|
|
|
import org.springframework.security.oauth2.core.OAuth2AccessToken; |
|
|
|
import org.springframework.security.oauth2.core.OAuth2AccessToken; |
|
|
|
import org.springframework.security.oauth2.core.OAuth2AuthenticationException; |
|
|
|
import org.springframework.security.oauth2.core.OAuth2AuthenticationException; |
|
|
|
import org.springframework.security.oauth2.core.OAuth2Error; |
|
|
|
import org.springframework.security.oauth2.core.OAuth2Error; |
|
|
|
|
|
|
|
import org.springframework.security.oauth2.core.OAuth2ErrorCodes; |
|
|
|
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse; |
|
|
|
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse; |
|
|
|
import org.springframework.web.reactive.function.BodyExtractor; |
|
|
|
import org.springframework.web.reactive.function.BodyExtractor; |
|
|
|
import org.springframework.web.reactive.function.BodyExtractors; |
|
|
|
import org.springframework.web.reactive.function.BodyExtractors; |
|
|
|
@ -80,11 +81,15 @@ class OAuth2AccessTokenResponseBodyExtractor |
|
|
|
} |
|
|
|
} |
|
|
|
TokenErrorResponse tokenErrorResponse = (TokenErrorResponse) tokenResponse; |
|
|
|
TokenErrorResponse tokenErrorResponse = (TokenErrorResponse) tokenResponse; |
|
|
|
ErrorObject errorObject = tokenErrorResponse.getErrorObject(); |
|
|
|
ErrorObject errorObject = tokenErrorResponse.getErrorObject(); |
|
|
|
OAuth2Error oauth2Error = new OAuth2Error(errorObject.getCode(), |
|
|
|
OAuth2Error oauth2Error; |
|
|
|
errorObject.getDescription(), (errorObject.getURI() != null ? |
|
|
|
if (errorObject == null) { |
|
|
|
errorObject.getURI().toString() : |
|
|
|
oauth2Error = new OAuth2Error(OAuth2ErrorCodes.SERVER_ERROR); |
|
|
|
null)); |
|
|
|
} else { |
|
|
|
|
|
|
|
oauth2Error = new OAuth2Error( |
|
|
|
|
|
|
|
errorObject.getCode() != null ? errorObject.getCode() : OAuth2ErrorCodes.SERVER_ERROR, |
|
|
|
|
|
|
|
errorObject.getDescription(), |
|
|
|
|
|
|
|
errorObject.getURI() != null ? errorObject.getURI().toString() : null); |
|
|
|
|
|
|
|
} |
|
|
|
return Mono.error(new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString())); |
|
|
|
return Mono.error(new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|