Reo.Core.ApiDocumentation 8.0.370

There is a newer version of this package available.
See the version list below for details.
dotnet add package Reo.Core.ApiDocumentation --version 8.0.370
                    
NuGet\Install-Package Reo.Core.ApiDocumentation -Version 8.0.370
                    
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="Reo.Core.ApiDocumentation" Version="8.0.370" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reo.Core.ApiDocumentation" Version="8.0.370" />
                    
Directory.Packages.props
<PackageReference Include="Reo.Core.ApiDocumentation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Reo.Core.ApiDocumentation --version 8.0.370
                    
#r "nuget: Reo.Core.ApiDocumentation, 8.0.370"
                    
#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.
#:package Reo.Core.ApiDocumentation@8.0.370
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Reo.Core.ApiDocumentation&version=8.0.370
                    
Install as a Cake Addin
#tool nuget:?package=Reo.Core.ApiDocumentation&version=8.0.370
                    
Install as a Cake Tool

Reo.Core.ApiDocumentation NuGet Version


Описание пакета

Пакет Reo.Core.ApiDocumentation предназначен для интеграции Swagger (OpenAPI) с IdentityServer в ASP.NET Core-приложениях. Он решает проблему автоматической настройки Swagger-документации с поддержкой OAuth2-авторизации, используя конфигурации клиентов из IdentityServer.

Основные функции:

  • Автоматическое получение информации о клиенте (ClientId, AllowedScopes) из IdentityServer.
  • Настройка Swagger-документации с поддержкой OAuth2.
  • Поддержка кастомных фильтров и операций для Swagger.

Основные компоненты

1. ClientDefinition

  • Описание: Класс, содержащий метаданные о клиенте (ClientId, ClientName, AllowedScopes, TokenEndpoint и т.д.).
  • Использование: Используется для передачи информации о клиенте в Swagger-конфигурацию.

2. IdentityClientSwaggerDefinitionStrategy

  • Описание: Стратегия для получения определения клиента из IdentityServer через API-запрос.
  • Использование: Используется для динамической загрузки конфигурации клиента из IdentityServer.

3. DefaultConfigureSwaggerOptions

  • Описание: Класс для настройки SwaggerGen с использованием информации о клиенте.
  • Использование: Регистрируется как IConfigureOptions<SwaggerGenOptions> для автоматической настройки Swagger.

4. DefaultPathDocumentFilter

  • Описание: Фильтр для документа Swagger, удаляющий серверы по умолчанию.
  • Использование: Применяется для кастомизации вывода Swagger-документации.

Требования

  • .NET: .NET Core 3.1, .NET 5+, .NET 6+.
  • Зависимости:
    • Swashbuckle.AspNetCore (для генерации Swagger).
    • IdentityModel.Client (для работы с IdentityServer).

Установка

NuGet Package Manager

Install-Package Reo.Core.ApiDocumentation -Version 1.0.0

.NET CLI

dotnet add package Reo.Core.ApiDocumentation --version 1.0.0

Настройка

Регистрация в ASP.NET Core

Добавьте в Startup.cs или Program.cs (для .NET 6+):

public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGen(options =>
    {
        options.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
        options.UseDefaultConfiguration();
    });

    services.Configure<AuthConfigureOptions>(Configuration.GetSection("Auth"));
}

Конфигурационные параметры

Добавьте в appsettings.json:

{
  "Auth": {
    "IdentityServerUrl": "https://identityserver.example.com",
    "ClientId": "my-client-id"
  }
}

Использование

Пример 1: Настройка Swagger с OAuth2

public void ConfigureServices(IServiceCollection services)
{
    services.AddSwaggerGen(c =>
    {
        c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
        c.UseDefaultConfiguration(); // Использует конфигурацию из IdentityServer
        c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
        {
            Type = SecuritySchemeType.OAuth2,
            Flows = new OpenApiOAuthFlows
            {
                Implicit = new OpenApiOAuthFlow
                {
                    AuthorizationUrl = new Uri("https://identityserver.example.com/connect/authorize"),
                    TokenUrl = new Uri("https://identityserver.example.com/connect/token")
                }
            }
        });
    });
}

Пример 2: Кастомизация Swagger UI

app.UseSwaggerUI(options =>
{
    options.OAuthClientId("my-client-id");
    options.OAuthClientSecret("my-client-secret");
    options.OAuthAppName("My Application");
});

Лицензия

Этот пакет распространяется под лицензией MIT License. См. файл LICENSE для подробностей.


Репозиторий и поддержка


Контакты


📌 Пакет активно развивается. Для получения обновлений подписывайтесь на репозиторий.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
10.0.168 0 6/2/2026
10.0.167 46 6/1/2026
10.0.166 50 6/1/2026
10.0.165 47 6/1/2026
10.0.164 50 6/1/2026
10.0.163 46 6/1/2026
10.0.162 49 6/1/2026
10.0.161 68 5/28/2026
10.0.160 101 5/27/2026
10.0.159 91 5/26/2026
10.0.158 92 5/25/2026
10.0.157 92 5/25/2026
10.0.156 96 5/20/2026
10.0.155 99 5/19/2026
10.0.154 96 5/15/2026
10.0.153 91 5/15/2026
10.0.152 95 5/15/2026
10.0.151 94 5/15/2026
10.0.150 95 5/15/2026
8.0.370 233 6/6/2025
Loading failed