Samhammer.Swagger.Authentication 6.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Samhammer.Swagger.Authentication --version 6.0.0                
NuGet\Install-Package Samhammer.Swagger.Authentication -Version 6.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Samhammer.Swagger.Authentication" Version="6.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Samhammer.Swagger.Authentication --version 6.0.0                
#r "nuget: Samhammer.Swagger.Authentication, 6.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Samhammer.Swagger.Authentication as a Cake Addin
#addin nuget:?package=Samhammer.Swagger.Authentication&version=6.0.0

// Install Samhammer.Swagger.Authentication as a Cake Tool
#tool nuget:?package=Samhammer.Swagger.Authentication&version=6.0.0                

Build Status

Samhammer.Swagger.Default [OBSOLETE]

This providdes configuration for swagger with default endpoints for swagger spec and ui. It can be used in every web API project that is built with ASP.NET Core.

How to add this to your project:
How to use:
public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGen();
    services.AddSwaggerDefaultApi();
}

public void Configure(IApplicationBuilder app)
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
Remove package & change to default configuration:
public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGen();
}

public void Configure(IApplicationBuilder app)
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

Samhammer.Swagger.Authentication

This providdes configuration for swagger with authentication by oauth2 codeflow or bearer token or guest auth. It can be used in every web API project that is built with ASP.NET Core.

How to add this to your project:
How to use:

JWT Authentication

public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGen();
    services.AddSwaggerAuthentication(Configuration);
}

public void Configure(IApplicationBuilder app)
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

For setup of auth2 codeflow add this to appsettings.json:

  "SwaggerAuthOptions": {
    "ClientId": "<<ClientId>>",
    "AccessTokenUrl": "<<TokenUrl>>",
    "AuthUrl": "<<AuthUrl>>"
  },

Guest Authentication

For Authenticaton by https://github.com/SamhammerAG/Samhammer.Authentication#guest-authentication

public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGuest(Configuration);
}

For override of default settings (enabled true) add this to appsettings.json:

  "SwaggerGuestOptions": {
    "Enabled": false
  }

Samhammer.Swagger.Versioning

This providdes configuration for swagger with api versioning support. It can be used in every web API project that is built with ASP.NET Core.

How to add this to your project:
How to use:
public void ConfigureServices(IServiceCollection services)
{
    services.AddApiVersioning(...);
    services.AddSwaggerGen();
    services.AddSwaggerVersionedApi();
}

public void Configure(IApplicationBuilder app)
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

Contribute

How to publish package
  • Create a tag and let the github action do the publishing for you
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 2,128 3/8/2024
6.0.0 11,116 1/20/2022
1.1.0 3,960 10/26/2020
1.0.2 4,965 8/13/2020
1.0.1 455 4/28/2020
1.0.0 1,504 3/9/2020