|
7 | 7 | using global::Ordering.API.Application.IntegrationEvents.Events; |
8 | 8 | using global::Ordering.API.Infrastructure.Filters; |
9 | 9 | using global::Ordering.API.Infrastructure.Middlewares; |
| 10 | + using HealthChecks.UI.Client; |
10 | 11 | using Infrastructure.AutofacModules; |
11 | 12 | using Infrastructure.Filters; |
12 | 13 | using Infrastructure.Services; |
13 | | - using Microsoft.ApplicationInsights.Extensibility; |
14 | | - using Microsoft.ApplicationInsights.ServiceFabric; |
15 | | - using Microsoft.AspNetCore.Authentication.JwtBearer; |
16 | 14 | using Microsoft.AspNetCore.Builder; |
| 15 | + using Microsoft.AspNetCore.Diagnostics.HealthChecks; |
17 | 16 | using Microsoft.AspNetCore.Hosting; |
18 | 17 | using Microsoft.AspNetCore.Mvc; |
19 | 18 | using Microsoft.Azure.ServiceBus; |
|
26 | 25 | using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services; |
27 | 26 | using Microsoft.Extensions.Configuration; |
28 | 27 | using Microsoft.Extensions.DependencyInjection; |
| 28 | + using Microsoft.Extensions.Diagnostics.HealthChecks; |
29 | 29 | using Microsoft.Extensions.Logging; |
30 | 30 | using Ordering.Infrastructure; |
31 | 31 | using RabbitMQ.Client; |
32 | | - using Swashbuckle.AspNetCore.Swagger; |
33 | 32 | using System; |
34 | 33 | using System.Collections.Generic; |
35 | 34 | using System.Data.Common; |
36 | 35 | using System.IdentityModel.Tokens.Jwt; |
37 | 36 | using System.Reflection; |
38 | | - using HealthChecks.UI.Client; |
39 | | - using Microsoft.AspNetCore.Diagnostics.HealthChecks; |
40 | | - using Microsoft.Extensions.Diagnostics.HealthChecks; |
41 | 37 |
|
42 | 38 | public class Startup |
43 | 39 | { |
@@ -148,12 +144,6 @@ public static IServiceCollection AddApplicationInsights(this IServiceCollection |
148 | 144 | // Enable K8s telemetry initializer |
149 | 145 | services.AddApplicationInsightsKubernetesEnricher(); |
150 | 146 | } |
151 | | - if (orchestratorType?.ToUpper() == "SF") |
152 | | - { |
153 | | - // Enable SF telemetry initializer |
154 | | - services.AddSingleton<ITelemetryInitializer>((serviceProvider) => |
155 | | - new FabricTelemetryInitializer()); |
156 | | - } |
157 | 147 |
|
158 | 148 | return services; |
159 | 149 | } |
@@ -249,23 +239,26 @@ public static IServiceCollection AddCustomSwagger(this IServiceCollection servic |
249 | 239 | services.AddSwaggerGen(options => |
250 | 240 | { |
251 | 241 | options.DescribeAllEnumsAsStrings(); |
252 | | - options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info |
| 242 | + options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo |
253 | 243 | { |
254 | 244 | Title = "Ordering HTTP API", |
255 | 245 | Version = "v1", |
256 | | - Description = "The Ordering Service HTTP API", |
257 | | - TermsOfService = "Terms Of Service" |
| 246 | + Description = "The Ordering Service HTTP API" |
258 | 247 | }); |
259 | 248 |
|
260 | | - options.AddSecurityDefinition("oauth2", new OAuth2Scheme |
| 249 | + options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme |
261 | 250 | { |
262 | | - Type = "oauth2", |
263 | | - Flow = "implicit", |
264 | | - AuthorizationUrl = $"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize", |
265 | | - TokenUrl = $"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token", |
266 | | - Scopes = new Dictionary<string, string>() |
| 251 | + Flows = new OpenApi.Models.OpenApiOAuthFlows() |
267 | 252 | { |
268 | | - { "orders", "Ordering API" } |
| 253 | + Implicit = new OpenApi.Models.OpenApiOAuthFlow() |
| 254 | + { |
| 255 | + AuthorizationUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"), |
| 256 | + TokenUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"), |
| 257 | + Scopes = new Dictionary<string, string>() |
| 258 | + { |
| 259 | + { "orders", "Ordering API" } |
| 260 | + } |
| 261 | + } |
269 | 262 | } |
270 | 263 | }); |
271 | 264 |
|
@@ -407,8 +400,8 @@ public static IServiceCollection AddCustomAuthentication(this IServiceCollection |
407 | 400 |
|
408 | 401 | services.AddAuthentication(options => |
409 | 402 | { |
410 | | - options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; |
411 | | - options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; |
| 403 | + options.DefaultAuthenticateScheme = AspNetCore.Authentication.JwtBearer.JwtBearerDefaults.AuthenticationScheme; |
| 404 | + options.DefaultChallengeScheme = AspNetCore.Authentication.JwtBearer.JwtBearerDefaults.AuthenticationScheme; |
412 | 405 |
|
413 | 406 | }).AddJwtBearer(options => |
414 | 407 | { |
|
0 commit comments