diff --git a/services/promotion-service-net/src/PromotionService.API/Program.cs b/services/promotion-service-net/src/PromotionService.API/Program.cs index 38ac804c..ddddc9c3 100644 --- a/services/promotion-service-net/src/PromotionService.API/Program.cs +++ b/services/promotion-service-net/src/PromotionService.API/Program.cs @@ -87,6 +87,31 @@ try Version = "v1", Description = "PromotionService microservice API / API microservice PromotionService" }); + + // EN: Add JWT Bearer security definition / VI: Thêm định nghĩa bảo mật JWT Bearer + options.AddSecurityDefinition("Bearer", new Microsoft.OpenApi.Models.OpenApiSecurityScheme + { + Description = "JWT Authorization header using the Bearer scheme. Enter 'Bearer' [space] and then your token.", + Name = "Authorization", + In = Microsoft.OpenApi.Models.ParameterLocation.Header, + Type = Microsoft.OpenApi.Models.SecuritySchemeType.ApiKey, + Scheme = "Bearer" + }); + + options.AddSecurityRequirement(new Microsoft.OpenApi.Models.OpenApiSecurityRequirement + { + { + new Microsoft.OpenApi.Models.OpenApiSecurityScheme + { + Reference = new Microsoft.OpenApi.Models.OpenApiReference + { + Type = Microsoft.OpenApi.Models.ReferenceType.SecurityScheme, + Id = "Bearer" + } + }, + Array.Empty() + } + }); }); // EN: Add health checks / VI: Thêm health checks