小编tnk*_*479的帖子

如何使用 OpenIddict 参数配置 SwaggerGen 以获取客户端凭据授予?

我试图弄清楚如何配置 SwaggerGen 来填充/显示 OpenIddict 和客户端凭据授予的字段/参数。

services.AddDbContext<AppDbContext>(options =>
{
    options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
    options.UseOpenIddict();
});

services.AddOpenIddict()
    .AddCore(options =>
    {
        // Configure OpenIddict to use the Entity Framework Core stores and models.
        // Note: call ReplaceDefaultEntities() to replace the default entities.
        options.UseEntityFrameworkCore().UseDbContext<AppDbContext>();
    })
    .AddServer(options =>
    {
        // Enable the token endpoint.
        options.SetTokenEndpointUris("/connect/token");

        // Enable the client credentials flow.
        options.AllowClientCredentialsFlow();

        // Register the signing and encryption credentials.
        options.AddDevelopmentEncryptionCertificate()
              .AddDevelopmentSigningCertificate();

        // Register the ASP.NET Core host and configure the ASP.NET Core options.
        options.UseAspNetCore()
              .EnableTokenEndpointPassthrough();
    })
    .AddValidation(options => …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-web-api swagger asp.net-core openiddict

5
推荐指数
1
解决办法
4292
查看次数

标签 统计

asp.net-core ×1

asp.net-web-api ×1

c# ×1

openiddict ×1

swagger ×1