Skip to content

The configuration value spring.cloud.openfeign.oauth2.clientRegistrationId is only accepted with CamelCase and not with dash-case #1270

@lucasvc

Description

@lucasvc

Describe the bug
Using spring-cloud-openfeign-core-4.3.0.jar, if the application.yml configuration provides

spring:
  security:
    oauth2:
      client:
        registration:
          fancy:
            client-id: jane.appeo
            client-secret: ${env:SUPER_SECRET}
            provider: fancy-authserver
            authorization-grant-type: client_credentials
        provider:
          fancy-authserver:
            token-uri: http://localhost:9999
  cloud:
    openfeign:
      oauth2:
        enabled: true
        clientRegistrationId: fancy

When the configuration spring.cloud.openfeign.oauth2.clientRegistrationId is set with CamelCase it is matched correctly, but when using spring.cloud.openfeign.oauth2.client-registration-id with dash-case the identifier is not matched when creating the OAuth2AccessTokenInterceptor at FeignAutoConfiguration#defaultOAuth2AccessTokenInterceptor.

Sample
This was found debugging some kind of test. I will try provide later a full test with the situation

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