-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add OAuth config and rework URL config #25
Conversation
This is simpler and more robust. The regexp solution, for instance, served up 'index.html' if you ask for 'index.htmlnotreally'. The early 404 if the regexp doesn't match is not necessary - the swaggerFiles handler will return 404 if the filename doesn't match any swaggerUI content. Setting the prefix on the handler is also not necessary, as we are already passing in the filename, so the prefix doesn't need to be stripped.
This makes it more clear that this config option should only be set if the Swagger spec document is not expected to be hosted by this middleware but instead by an external website or service. It also fixes the link to the JSON document under the base path on the Swagger UI. Also set the swaggerFiles handler prefix again, as this is required.
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 75 78 +3
=========================================
+ Hits 75 78 +3
Continue to review full report at Codecov.
|
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.
LGTM
@drewsilcock, Would you mind fixing the conflicts so we can go forward with it. |
When will this branch be merge into master? |
e5ac771
to
1f4b3dd
Compare
1f4b3dd
to
3acf681
Compare
Hi @ubogdan thanks for your patience, I've resolved the merge conflicts now. |
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.
LGTM
@drewsilcock Thanks for your contribution. |
Adding 0Auth config values based on this PR from echo-swagger: swaggo/echo-swagger#25
This adds support for configuring the Swagger UI OAuth2 integration, as per docs here: https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/.
This also slightly reworks the Swagger specification JSON document location configuration. The default value is
nil
instead ofdoc.json
(this is to make it more clear what the configuration parameter is for and to make it work with the additional field in the config). This fixes the link to the Swagger spec when the path is local on the Swagger UI page (just below the "Base Path").