|
|
@ -2,8 +2,10 @@ |
|
|
using Lion.AbpPro.AspNetCore; |
|
|
using Lion.AbpPro.AspNetCore; |
|
|
using Lion.AbpPro.AspNetCore.Options; |
|
|
using Lion.AbpPro.AspNetCore.Options; |
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc.Filters; |
|
|
using Microsoft.AspNetCore.Mvc.Filters; |
|
|
using Microsoft.IdentityModel.Tokens; |
|
|
using Microsoft.IdentityModel.Tokens; |
|
|
|
|
|
using Microsoft.OpenApi; |
|
|
using Swagger; |
|
|
using Swagger; |
|
|
using Volo.Abp.AspNetCore.Auditing; |
|
|
using Volo.Abp.AspNetCore.Auditing; |
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
@ -158,7 +160,7 @@ public static class ServiceCollectionExtensions |
|
|
service.AddSwaggerGen(options => |
|
|
service.AddSwaggerGen(options => |
|
|
{ |
|
|
{ |
|
|
// 文件下载类型
|
|
|
// 文件下载类型
|
|
|
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" }); |
|
|
//options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
|
|
|
options.SwaggerDoc(name, new OpenApiInfo { Title = name, Version = version }); |
|
|
options.SwaggerDoc(name, new OpenApiInfo { Title = name, Version = version }); |
|
|
options.DocInclusionPredicate((docName, description) => true); |
|
|
options.DocInclusionPredicate((docName, description) => true); |
|
|
//options.EnableAnnotations(); // 启用注解
|
|
|
//options.EnableAnnotations(); // 启用注解
|
|
|
@ -181,21 +183,12 @@ public static class ServiceCollectionExtensions |
|
|
Scheme = JwtBearerDefaults.AuthenticationScheme, |
|
|
Scheme = JwtBearerDefaults.AuthenticationScheme, |
|
|
BearerFormat = "JWT" |
|
|
BearerFormat = "JWT" |
|
|
}); |
|
|
}); |
|
|
options.AddSecurityRequirement(new OpenApiSecurityRequirement |
|
|
|
|
|
|
|
|
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement() |
|
|
{ |
|
|
{ |
|
|
{ |
|
|
[new OpenApiSecuritySchemeReference("Bearer", document)] = [] |
|
|
new OpenApiSecurityScheme |
|
|
|
|
|
{ |
|
|
|
|
|
Reference = new OpenApiReference |
|
|
|
|
|
{ |
|
|
|
|
|
Type = ReferenceType.SecurityScheme, Id = "Bearer" |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
new List<string>() |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
options.AddSecurityDefinition("Accept-Language", new OpenApiSecurityScheme() |
|
|
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme() |
|
|
|
|
|
{ |
|
|
{ |
|
|
Type = SecuritySchemeType.ApiKey, |
|
|
Type = SecuritySchemeType.ApiKey, |
|
|
In = ParameterLocation.Header, |
|
|
In = ParameterLocation.Header, |
|
|
@ -203,17 +196,11 @@ public static class ServiceCollectionExtensions |
|
|
Description = "多语言设置,系统预设语言有zh-Hans、en,默认为zh-Hans", |
|
|
Description = "多语言设置,系统预设语言有zh-Hans、en,默认为zh-Hans", |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
options.AddSecurityRequirement(new OpenApiSecurityRequirement |
|
|
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement() |
|
|
{ |
|
|
{ |
|
|
{ |
|
|
[new OpenApiSecuritySchemeReference("Accept-Language", document)] = [] |
|
|
new OpenApiSecurityScheme |
|
|
|
|
|
{ |
|
|
|
|
|
Reference = new OpenApiReference |
|
|
|
|
|
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" } |
|
|
|
|
|
}, |
|
|
|
|
|
Array.Empty<string>() |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
return service; |
|
|
return service; |
|
|
} |
|
|
} |
|
|
|