Add support for JVM proxy system properties to the Oauth2 Client support, when creating RestTemplates #9101
Labels
in: oauth2
An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
status: duplicate
A duplicate of another issue
Expected Behavior
Spring Security OAuth2 clients work when the authorization server/provider, e.g. Okta, have to be accessed through a proxy server, as when running app on a corporate network. Oauth2 Clients should honor/support the JVM proxy system proprties, e.g. https.proxyHost, https.proxyPort.
Current Behavior
In older versions of Spring Security (5.0.8) and Spring Boot (2.0.x), and at least when using the Okta oauth starter (0.6.0), proxy support worked, when setting https.proxyHost and https.proxyPort system properties, e.g. via -D arguments passed to JVM.
In newer versions, Spring Boot 2.2.x, Spring Security (5.2.x), and Okta extensions (1.3.0), the JVM proxy config appears to be ignored. Appears implementations create a RestTemplate out of the box, and JVM proxy config is not honored, nor is there any clear/easy way to configure the RestTemplate, without supplying your own customized implementation. The app fails at startup, trying to get the Outh2 config, e.g "https://dev-nnnn.okta.com/oauth2/default/.well-known/openid-configuration", can't connect, and won't use the jvm proxy config.
This has been noted before, see, but that thread seems to focus on overriding the RestTemplate. Don't see why the JVM system props can't be used, if defined, to configure the default RestTemplate, without having to provide custom user service implementations:
#7027
Context
As noted, older versions of boot and security honored the JVM proxy system properties, newer versions do not.
The text was updated successfully, but these errors were encountered: