Merge pull request #167 from akabiru/feat/add-basic-auth

🔒Add Optional Basic Auth for Rswag UI
This commit is contained in:
Greg Myers
2020-04-04 18:29:39 +01:00
committed by GitHub
7 changed files with 215 additions and 0 deletions

View File

@@ -545,6 +545,17 @@ Rswag::Ui.configure do |c|
end
```
### Enable Simple Basic Auth for swagger-ui
You can also update the _rswag-ui.rb_ initializer, installed with rswag-ui to specify a username and password should you want to keep your documentation private.
```ruby
Rswag::Ui.configure do |c|
c.basic_auth_enabled = true
c.basic_auth_credentials 'username', 'password'
end
```
### Route Prefix for the swagger-ui ###
Similar to rswag-api, you can customize the swagger-ui path by changing it's mount prefix in _routes.rb_: