Multiple registration ids
In some environments it is required to support targeting multiple Oauth2 servers. The current solution for non-load-balanced feign clients only provide a single client-registration-id with the property spring.cloud.openfeign.oauth2.client-registration-id, so this is not possible.
Proposed solution
Add a new configuration: spring.cloud.openfeign.oauth2.client-registration-ids which should be a Map<String, String> mapping feign clients by name to a registration id. The default should still be spring.cloud.openfeign.oauth2.client-registration-id so there are no backward compatibility issues.
Other alternatives considered
- Using load-balanced clients
- Downsides
- A new
spring.security.oauth2.client.registration and spring.security.oauth2.client.provider must be provided per each client if the clients use discrete names
- Using the same name makes it difficult to do ad-hoc switching of hostname for a single client
- The logs do not show the actual URL called, which makes debugging much more difficult
- Make a local custom
OAuth2AccessTokenInterceptor
Multiple registration ids
In some environments it is required to support targeting multiple Oauth2 servers. The current solution for non-load-balanced feign clients only provide a single client-registration-id with the property
spring.cloud.openfeign.oauth2.client-registration-id, so this is not possible.Proposed solution
Add a new configuration:
spring.cloud.openfeign.oauth2.client-registration-idswhich should be aMap<String, String>mapping feign clients by name to a registration id. The default should still bespring.cloud.openfeign.oauth2.client-registration-idso there are no backward compatibility issues.Other alternatives considered
spring.security.oauth2.client.registrationandspring.security.oauth2.client.providermust be provided per each client if the clients use discrete namesOAuth2AccessTokenInterceptor