The current OAuth2RestTemplate can be used together with @EnableDiscoveryClient and @Loadbalanced to access internal resources using a service registration like consul.
access to the rest services is client side loadbalanced using the list of available services in consul.
this is however NOT possible for the URL used to acquire the oauth2 accessToken using client credentials. This results into java.net.UnknownHostException because the accessTokenUri doesn't have a valid hostname, only a services name which needs to be resolved using consul.
it would be great that Oauth2RestTemplate would also support @Loadbalanced for acquiring the oauth2 token from the internal Oauth2 services which are known in consul
this would allow usage of client based loadbalancing and redundancy for acquiring oauth2 tokens.
The current OAuth2RestTemplate can be used together with @EnableDiscoveryClient and @Loadbalanced to access internal resources using a service registration like consul. access to the rest services is client side loadbalanced using the list of available services in consul.
this is however NOT possible for the URL used to acquire the oauth2 accessToken using client credentials. This results into java.net.UnknownHostException because the accessTokenUri doesn't have a valid hostname, only a services name which needs to be resolved using consul.
it would be great that Oauth2RestTemplate would also support @Loadbalanced for acquiring the oauth2 token from the internal Oauth2 services which are known in consul this would allow usage of client based loadbalancing and redundancy for acquiring oauth2 tokens.