Skip to content

oauth2RedirectUrl cached unexpectedly #1556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jjathman opened this issue Mar 16, 2022 · 1 comment
Closed

oauth2RedirectUrl cached unexpectedly #1556

jjathman opened this issue Mar 16, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@jjathman
Copy link

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.

@jjathman jjathman changed the title oauth2RedirectUrl calculated in unexpected ways oauth2RedirectUrl cached unexpectedly Mar 16, 2022
@bnasslahsen
Copy link
Collaborator

@jjathman,

Using v1.6.6, this is the workaround:

springdoc.cache.disabled=true

An enhancement, will be available for the next release without having to disable the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants