chore 抽象微服务基本类库
This commit is contained in:
@ -0,0 +1,32 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Volo.Abp.Modularity;
|
||||
|
||||
namespace KonSoft.Shared.Hosting.AspNetCore;
|
||||
|
||||
public static class SwaggerConfigurationHelper
|
||||
{
|
||||
public static void ConfigureWithOidc(
|
||||
ServiceConfigurationContext context,
|
||||
string authority,
|
||||
string[] scopes,
|
||||
string apiTitle,
|
||||
string apiVersion = "v1",
|
||||
string apiName = "v1",
|
||||
string[]? flows = null,
|
||||
string? discoveryEndpoint = null
|
||||
)
|
||||
{
|
||||
context.Services.AddAbpSwaggerGenWithOidc(
|
||||
authority: authority,
|
||||
scopes: scopes,
|
||||
flows: flows,
|
||||
discoveryEndpoint: discoveryEndpoint,
|
||||
options =>
|
||||
{
|
||||
options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion });
|
||||
options.DocInclusionPredicate((docName, description) => true);
|
||||
options.CustomSchemaIds(type => type.FullName);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user