Reo.Core.ApiDocumentation 6.0.359

There is a newer version of this package available.
See the version list below for details.
dotnet add package Reo.Core.ApiDocumentation --version 6.0.359
                    
NuGet\Install-Package Reo.Core.ApiDocumentation -Version 6.0.359
                    
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="6.0.359" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reo.Core.ApiDocumentation" Version="6.0.359" />
                    
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 6.0.359
                    
#r "nuget: Reo.Core.ApiDocumentation, 6.0.359"
                    
#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@6.0.359
                    
#: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=6.0.359
                    
Install as a Cake Addin
#tool nuget:?package=Reo.Core.ApiDocumentation&version=6.0.359
                    
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.125 99 4/27/2026
10.0.124 87 4/24/2026
10.0.120 89 4/24/2026
10.0.119 84 4/23/2026
10.0.117 91 4/23/2026
10.0.116 87 4/22/2026
10.0.115 85 4/22/2026
10.0.114 89 4/21/2026
10.0.113 86 4/21/2026
10.0.112 101 4/17/2026
10.0.111 93 4/16/2026
10.0.110 90 4/16/2026
10.0.109 85 4/16/2026
10.0.108 88 4/16/2026
10.0.107 86 4/16/2026
10.0.106 92 4/16/2026
10.0.105 91 4/15/2026
10.0.104 98 4/15/2026
10.0.103 104 4/14/2026
6.0.359 259 6/4/2025
Loading failed