11using Autofac ;
22using Autofac . Extensions . DependencyInjection ;
33using HealthChecks . UI . Client ;
4- using Microsoft . ApplicationInsights . Extensibility ;
5- using Microsoft . ApplicationInsights . ServiceFabric ;
64using Microsoft . AspNetCore . Authentication . JwtBearer ;
75using Microsoft . AspNetCore . Builder ;
86using Microsoft . AspNetCore . Diagnostics . HealthChecks ;
2321using Microsoft . Extensions . DependencyInjection ;
2422using Microsoft . Extensions . Diagnostics . HealthChecks ;
2523using Microsoft . Extensions . Logging ;
24+ using Microsoft . OpenApi . Models ;
2625using RabbitMQ . Client ;
27- using Swashbuckle . AspNetCore . Swagger ;
2826using System ;
2927using System . Collections . Generic ;
3028using System . IdentityModel . Tokens . Jwt ;
@@ -50,7 +48,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
5048 {
5149 options . Filters . Add ( typeof ( HttpGlobalExceptionFilter ) ) ;
5250 } )
53- . SetCompatibilityVersion ( CompatibilityVersion . Version_2_2 )
51+ . SetCompatibilityVersion ( CompatibilityVersion . Version_3_0 )
5452 . AddControllersAsServices ( ) ;
5553
5654 ConfigureAuthService ( services ) ;
@@ -99,31 +97,35 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
9997
10098 return new DefaultRabbitMQPersistentConnection ( factory , logger , retryCount ) ;
10199 } ) ;
102- }
100+ }
103101
104102 RegisterEventBus ( services ) ;
105103
106104 // Add framework services.
107105 services . AddSwaggerGen ( options =>
108106 {
109107 options . DescribeAllEnumsAsStrings ( ) ;
110- options . SwaggerDoc ( "v1" , new Swashbuckle . AspNetCore . Swagger . Info
108+ options . SwaggerDoc ( "v1" , new OpenApiInfo
111109 {
112110 Title = "eShopOnContainers - Location HTTP API" ,
113111 Version = "v1" ,
114112 Description = "The Location Microservice HTTP API. This is a Data-Driven/CRUD microservice sample" ,
115- TermsOfService = "Terms Of Service"
116113 } ) ;
117114
118- options . AddSecurityDefinition ( "oauth2" , new OAuth2Scheme
115+ options . AddSecurityDefinition ( "oauth2" , new OpenApiSecurityScheme
119116 {
120- Type = "oauth2" ,
121- Flow = "implicit" ,
122- AuthorizationUrl = $ "{ Configuration . GetValue < string > ( "IdentityUrlExternal" ) } /connect/authorize",
123- TokenUrl = $ "{ Configuration . GetValue < string > ( "IdentityUrlExternal" ) } /connect/token",
124- Scopes = new Dictionary < string , string > ( )
117+ Type = SecuritySchemeType . OAuth2 ,
118+ Flows = new OpenApiOAuthFlows ( )
125119 {
126- { "locations" , "Locations API" }
120+ Implicit = new OpenApiOAuthFlow ( )
121+ {
122+ AuthorizationUrl = new Uri ( $ "{ Configuration . GetValue < string > ( "IdentityUrlExternal" ) } /connect/authorize") ,
123+ TokenUrl = new Uri ( $ "{ Configuration . GetValue < string > ( "IdentityUrlExternal" ) } /connect/token") ,
124+ Scopes = new Dictionary < string , string > ( )
125+ {
126+ { "locations" , "Locations API" }
127+ }
128+ }
127129 }
128130 } ) ;
129131
@@ -204,12 +206,6 @@ private void RegisterAppInsights(IServiceCollection services)
204206 // Enable K8s telemetry initializer
205207 services . AddApplicationInsightsKubernetesEnricher ( ) ;
206208 }
207- if ( orchestratorType ? . ToUpper ( ) == "SF" )
208- {
209- // Enable SF telemetry initializer
210- services . AddSingleton < ITelemetryInitializer > ( ( serviceProvider ) =>
211- new FabricTelemetryInitializer ( ) ) ;
212- }
213209 }
214210
215211 private void ConfigureAuthService ( IServiceCollection services )
0 commit comments