Skip to content

Incorrect Oauth2 redirect URL #2932

@zaa4wz

Description

@zaa4wz

Describe the bug

After upgrading the library from version 2.7.0 to 2.8.5, the Oauth2 redirect URL is built incorrectly.

I have a Spring WebFlux project that is deployed to a server. To access the service, I am using a DNS and service name to reach it. Let's say the service URL is https://apigateway.apps.internal.cloud/apigateway. To access Swagger, I have to type https://apigateway.apps.internal.cloud/apigateway/openapiwebjars/swagger-ui/index.html. Accessing the swagger is working fine. To integrate Swagger with our security, I have added an Authorize button with the OAuthFlows security schema. When clicking on the Authorize button, providing necessary information and clicking on the second Authorize button, I am redirected to an authorization server to be authorized. One of the request parameters to the authorization server is redirect_uri. In springdoc-openapi-starter-webflux-ui version 2.7.0 the redirect_uri was https://apigateway.apps.internal.cloud/apigateway/openapiwebjars/swagger-ui/oauth2-redirect.html , but in version 2.8.5 the redirect_uri changed to https://apigateway/openapiwebjars/swagger-ui/oauth2-redirect.html

It looks like the host part of URI is missing.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Spring WebFlux project with Spring Boot version 3.4.3 and webflux-ui version 2.8.5
    1.1. spring-boot-starter-parent 3.4.3
    1.2. spring-boot-starter-webflux
    1.3. springdoc-openapi-starter-webflux-ui 2.8.5

  2. Add OAuthFlows security schema to the Swagger

  3. Deploy the project on a server and set up DNS to access the service by name

  4. Authorize yourself with the help of Authorize button

  5. Verify the redirect_uri request parameter
    5.1. Expected value: https://apigateway.apps.internal.cloud/apigateway/openapiwebjars/swagger-ui/oauth2-redirect.html
    5.2. Actual value: https://apigateway/openapiwebjars/swagger-ui/oauth2-redirect.html

Expected behavior

The redirect_uri should contain the actual server URL

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
It could be related to:

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