Describe the bug

The class JwtDecoderProviderConfigurationUtils is instanciating the RestTemplate instead of using the bean, making impossible to customise the SSL context.

https://github.com/spring-projects/spring-security/blob/master/oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtDecoderProviderConfigurationUtils.java#L42

To Reproduce

Try to setup a sample project as an OAuth2 resource server pointing to an AS exposed with a self signed certificate for example. This would throw a SSLHandshakeException.

Expected behavior

Use the bean.

Comment From: jgrandja

Closing as duplicate of #8882. Please see JwtDecoders and provide any additional feedback there.