Skip to content

Race condition on Oauth2RedirectUrl #349

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
Kruschenstein opened this issue Jan 16, 2020 · 3 comments
Closed

Race condition on Oauth2RedirectUrl #349

Kruschenstein opened this issue Jan 16, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@Kruschenstein
Copy link

Hello!

I encounter a synchronization issue during Oauth2RedirectUrl generation. That's odd because it's due to swagger interface that sends two time each request (GET swagger-config & api-doc), but that's involve a race condition that generate the wrong redirect uri:

image
image

I want to add that this not happens every time, but when we are in this configuration, we couldn't authenticate and we have to reboot the server.

A priori, there is a lack of synchronization in SwaggerWelcome#buildConfigUrl(HttpServletRequest).

By the way, there is another annoying stuff about oauth2RedirectUrl because this addressed is cached too, and depending on end-user domain request, this url may change. It doesn't seem to have a way to disable the cache here, or am I wrong? (may I open another issue?)

Thank you in advance

@bnasslahsen
Copy link
Collaborator

Hi,

For the swagger-config loaded twice, there is a know issue on swagger-ui that is the root cause.
Our library is built on top of it.

For oauth2RedirectUrl, there is no cache around it.
But you may be describing that you need dynamic oauth2RedirectUrl. This can be handled for the next release.

@Kruschenstein
Copy link
Author

Thank you for the answer. A dynamic oauth2RedirectUrl would really be nice for the next release, thanks again for all the work 👍

@bnasslahsen
Copy link
Collaborator

@Kruschenstein,

Starting from v1.4.1, the following properties can be used to prevent the load of the swagger-config twice.
Please note this properties works only in the case where there is no groups (no multiple urls and no configUrl set on the swagger-ui):

  • If your REST APIs, are not using OAuth2:
springdoc.swagger-ui.display-query-params-without-oauth2=true
  • If your REST APIs, are using OAuth2:
springdoc.swagger-ui.display-query-params=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants