Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ctyar/swashbuckle.auth
A package to simplify adding authentication to the Swagger.
https://github.com/ctyar/swashbuckle.auth
Last synced: 5 days ago
JSON representation
A package to simplify adding authentication to the Swagger.
- Host: GitHub
- URL: https://github.com/ctyar/swashbuckle.auth
- Owner: ctyar
- License: mit
- Created: 2023-02-26T11:11:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T19:45:05.000Z (8 months ago)
- Last Synced: 2024-05-22T20:48:52.107Z (8 months ago)
- Language: C#
- Homepage:
- Size: 67.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swashbuckle Auth
[![Build Status](https://ctyar.visualstudio.com/Swashbuckle.Auth/_apis/build/status%2Fctyar.Swashbuckle.Auth?branchName=main)](https://ctyar.visualstudio.com/Swashbuckle.Auth/_build/latest?definitionId=9&branchName=main)
[![Ctyar.Swashbuckle.Auth](https://img.shields.io/nuget/v/Ctyar.Swashbuckle.Auth.svg)](https://www.nuget.org/packages/Ctyar.Swashbuckle.Auth/)A package to simplify adding authentication to the Swagger.
## Usage
**Auth0**
```csharp
builder.Services.AddSwaggerGen(c =>
{
c.AddAuth0(authority, audience);
});app.UseSwaggerUI(c =>
{
c.UseAuth0(clientId, scopes);
});
```**Identity Server**
```csharp
builder.Services.AddSwaggerGen(c =>
{
c.AddIdentityServer(authority);
});app.UseSwaggerUI(c =>
{
c.UseIdentityServer(clientId, scopes);
});
```**OAuth2**
```csharp
builder.Services.AddSwaggerGen(c =>
{
c.AddOAuth2(authorizationUrl, tokenUrl);
});app.UseSwaggerUI(c =>
{
c.UseOAuth2(clientId, scopes);
});
```## Demo
![Demo](https://user-images.githubusercontent.com/1432648/227712843-8ffd08f7-0489-46f6-9e46-aeec6e99dac4.gif)## Build
[Install](https://get.dot.net) the [required](global.json) .NET SDK.Run:
```
$ dotnet build
```