Skip to content

oauth2RedirectUrl cached unexpectedly #1556

Closed
@jjathman

Description

@jjathman

Describe the bug
We use OAuth2 for authentication of our endpoints. We do not set any server configurations or the oauth2RedirectUrl explicitly and allow Springdoc to calculate the oauth2RedirectUrl at runtime when the Swagger UI is loaded. This works the first time, however it has the unexpected side effect of caching this value forever.

Our use case is we have servers which may have both a server name and an IP address (or an FQDN as well). However, whichever method is used to initially access the Swagger UI, that is the oauth2RedirectUrl which will be used forever.

Currently, the only workaround I have found is to completely disable the cache, which works but is obviously less than ideal.

To Reproduce

  1. Setup oauth2 auth for an endpoint
  2. Do not specify the oauth2RedirectUrl
  3. Access the Swagger UI using an IP address
  4. Access the Swagger UI using localhost

Expected behavior
If the oauth2RedirectUrl has not been specified as an FQDN and is simply a relative path, then upon each request a new oauth2RedirectUrl would be calculated using the incoming host name on the request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions