swagger-api / swagger-api/swagger-ui
Swagger UI Add ability to automatically load Authorization window
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Content & configuration
I have couple of swagger API with ASP.NET Core 3.1 that are meant only for internal dev or internal users. For e.g. They have API that create and manage VMs.
I do not want any external user to see the API or explore them. Currently I have the OAuth 2.0 Authorization Code Workflow setup that will authenticate our internal users but still any external user can open the URL look at the APIs and syntax.
I would like to see a feature in swagger-ui that will force the OAuth authentication for e.g. show Authorize window automatically when the swagger ui is loaded and disallow user closing the Authorize Window till user is authorized.
This feature will be useful for all private and internal APIs.
Describe the solution you'd like
As an example... I would like to see two configuration properties
app.UseSwaggerUI(c =>
{
// This will automatically show the Authorize window as soon as the swagger-ui page is loaded
c.AuthorizeOnLoad = true;
// This will ensure that user cannot close the Authorize window untill he is authenticated by server.
c.DisableCancelOnAuthorize = true;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the Swagger UI authorization flow and the configuration example in the issue, focusing on the OAuth 2.0 Authorization Code workflow. Done means the authorization window opens when the UI loads and cannot be dismissed until server authentication succeeds, with the behavior exposed through the requested configuration properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authentication, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100