You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1013 B
32 lines
1013 B
using Microsoft.Extensions.Options;
|
|
using Microsoft.OpenApi.Models;
|
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
|
using System.Collections.Generic;
|
|
using Volo.Abp.MultiTenancy;
|
|
|
|
namespace LY.MicroService.BackendAdmin;
|
|
|
|
public class TenantHeaderParamter : IOperationFilter
|
|
{
|
|
private readonly AbpMultiTenancyOptions _options;
|
|
public TenantHeaderParamter(
|
|
IOptions<AbpMultiTenancyOptions> options)
|
|
{
|
|
_options = options.Value;
|
|
}
|
|
|
|
public void Apply(OpenApiOperation operation, OperationFilterContext context)
|
|
{
|
|
if (_options.IsEnabled)
|
|
{
|
|
operation.Parameters = operation.Parameters ?? new List<OpenApiParameter>();
|
|
operation.Parameters.Add(new OpenApiParameter
|
|
{
|
|
Name = TenantResolverConsts.DefaultTenantKey,
|
|
In = ParameterLocation.Header,
|
|
Description = "Tenant Id in http header",
|
|
Required = false
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|