-
Notifications
You must be signed in to change notification settings - Fork 47
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
support custom swagger config and oauth redirects #262
Conversation
dfd0db9
to
b4db9bc
Compare
b4db9bc
to
6e700b5
Compare
Is it possible to get an additional test that showcases the requests workflow against azure AD or similar, with mocked responses? I don't have much experience with oauth2 and a would be afraid of breaking it in future updates without a more high-level testsuite. Not a blocker though. |
@zupo Hey I'm interested but not on the same page:
Ultimately this flow is quite simple (as simple as any standard oauth2 flow) and is baked into the swagger ui.
I'm trying to think about what aspects of this could have further tests and mocked responses and struggling. Thoughts? |
Hey @mmerickel!
|
Ok it took me a minute to figure out but the issue was poetry created a 3.13 virtualenv which isn't compatible with the makefile hardcoding PYTHON=python3.12. The following works:
Thank you for helping with that, I was distracted by all the nix stuff and the almost-empty poetry.toml that I wasn't familiar with. I can run the tests now. |
Basically 100% of this flow is in javascript so I'm trying to figure out what responses to mock. None of it hits the python backend other than what's tested already - loading the swagger html and the oauth2-redirect html as basically static pages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally mergeable, have some minor (potentially stupid) questions.
Co-authored-by: Neyts Zupan <[email protected]>
These are all explorer features:
ui_config
parameter to add extra options to theSwaggerUI
constructor. Obviously you can't configure everything but it allows some support.enable_oauth_redirect
boolean which will enable and start serving theoauth2-redirect.html
which is required for a proper oauth2 flow through the swagger UI.oauth_config
which will invoke theui.initOAuth
API on theSwaggerUI
which is necessary to enable things like the PKCE challenge flow that is managed automatically by theoauth2-redirect
HTML.Fixes #261.
This enables the following dummy example to work against Azure AD:
Example
openapi.yaml
: