SwaggerDocumentAuth 1.0.0

dotnet add package SwaggerDocumentAuth --version 1.0.0
NuGet\Install-Package SwaggerDocumentAuth -Version 1.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="SwaggerDocumentAuth" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SwaggerDocumentAuth --version 1.0.0
#r "nuget: SwaggerDocumentAuth, 1.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 SwaggerDocumentAuth as a Cake Addin
#addin nuget:?package=SwaggerDocumentAuth&version=1.0.0

// Install SwaggerDocumentAuth as a Cake Tool
#tool nuget:?package=SwaggerDocumentAuth&version=1.0.0

给swagger文档添加身份认证,访问swagger文档的人需要先登录 代码示例:
在Configura中添加
app.UseSwaggerDocumentAuth(
//初始用户
new Option
{
RoutePrefix = "swagger", //不传默认值为“swagger”
UsersInitialValue = new List<CustomSwaggerAuth>()
{
new CustomSwaggerAuth("admin","123456")
}
},
//定义用户设置方式
users ⇒
{
//users.AddRange(RedisHelpers.GetObj<List<CustomSwaggerAuth>>("SwagerDocumentUsers") ?? new List<CustomSwaggerAuth>());
//RedisHelpers.SetObj("SwagerDocumentUsers", users.GroupBy(g ⇒ g.UserName).Select(s ⇒ s.Last()));
},
//定义用户读取方式
() ⇒ new List<CustomSwaggerAuth>() { new CustomSwaggerAuth("admin", "123456") }
);
app.UseSwagger();
app.UseSwaggerUI(s ⇒
{
s.SwaggerEndpoint("/swagger/v1/swagger.json", "My API");
//s.RoutePrefix = string.Empty;
s.ConfigSwaggerUIOpions();
});

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 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
1.0.0 8,543 10/29/2020