I am trying to validate the audience of the authToken received by the Spring Boot app. I saw this, but when I try to do it I get the following...
'DefaultAuthorizationCodeTokenResponseClient' is deprecated. Deprecated in Java
'OAuth2AuthorizationCodeGrantRequestEntityConverter' is deprecated. Deprecated in Java
This comes from the lines
val requestEntityConverter = OAuth2AuthorizationCodeGrantRequestEntityConverter()
val accessTokenResponseClient = DefaultAuthorizationCodeTokenResponseClient()
What should I be using instead since this is the latest docs? When I try to debug into the code I do not see an alternative in the javadocs?
Per the comments I tried changing to
@Bean
fun authorizationCodeAccessTokenResponseClient(): OAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> {
val requestEntityConverter = DefaultOAuth2TokenRequestParametersConverter()
requestEntityConverter.addParametersConverter(parametersConverter())
val accessTokenResponseClient = RestClientAuthorizationCodeTokenResponseClient()
accessTokenResponseClient.setRequestEntityConverter(requestEntityConverter)
return accessTokenResponseClient
}
But then I get
Not enough information to infer type variable T
Unresolved reference: setRequestEntityConverter