Skip to content

Spring security @RegisteredOAuth2AuthorizedClient is not handled in the right way #2595

Closed
@jarekkar

Description

@jarekkar

Describe the Bug

When @RegisteredOAuth2AuthorizedClient is added to the controller definition, it is rendered in Swagger-UI. For @AuthenticationPrincipal, everything works fine.

To Reproduce

Java: 21
Spring Boot: 3.2.5
Springdocs: 2.5.0

Code Example:

@Operation(summary = "Returns authenticated user details")
@GetMapping(value = "/users/me", produces = APPLICATION_JSON_VALUE)
UserView user(@AuthenticationPrincipal OidcUser principal, @RegisteredOAuth2AuthorizedClient OAuth2AuthorizedClient authorizedClient){
    return UserView.of(principal.getName(), principal.getEmail(), principal.getGivenName(), principal.getFamilyName());
}

In Swagger-UI, authorizedClient is rendered as a required query parameter.

Expected Behavior

authorizedClient should not be rendered in Swagger-UI.

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions