spring-cloud / spring-cloud/spring-cloud-openfeign
Support multiple client-registration-id configurations
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 838
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 13
Description
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.registrationandspring.security.oauth2.client.providermust 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
- A new
- Downsides
- Make a local custom
OAuth2AccessTokenInterceptor
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the existing handling for spring.cloud.openfeign.oauth2.client-registration-id and the OAuth2AccessTokenInterceptor entry point. Add support for the proposed client-registration-ids map keyed by Feign client name, while retaining the existing property as the default, and verify both configuration paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, authentication, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100