Skip to content

Support multiple client-registration-id configurations #1343

Description

@jkstrauss

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions