spring-cloud / spring-cloud/spring-cloud-openfeign

Support multiple client-registration-id configurations

Open
#1,343 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
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.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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.