swaggo / gin-swagger

gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
MIT License
3.76k stars 270 forks source link

Configure the default OAuth2 ClientID #209

Closed joshstrohminger closed 2 years ago

joshstrohminger commented 2 years ago

Describe the PR Allow callers to configure the default ClientID for OAuth2. This just pre-populates the client_id form field in the Authorize dialog. Here is what it looks like using the following line config:

router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, ginSwagger.Oauth2DefaultClientID("swagger")))

image

Relation issue None

Additional context This is done by calling the initOAuth function with the configured value if one is provided.

codecov[bot] commented 2 years ago

Codecov Report

Merging #209 (99aeaa0) into master (64d8dea) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 99aeaa0 differs from pull request most recent head 36f23f5. Consider uploading reports for the commit 36f23f5 to get more accurate results

@@            Coverage Diff            @@
##            master      #209   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           93        98    +5     
=========================================
+ Hits            93        98    +5     
Impacted Files Coverage Δ
swagger.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 64d8dea...36f23f5. Read the comment docs.

ubogdan commented 2 years ago

@joshstrohminger would you mind updating the README.md file regarding this feature?

joshstrohminger commented 2 years ago

Sorry I missed the readme update. Let me know if it's not to your liking.

ubogdan commented 2 years ago

@joshstrohminger Thanks for your contribution.