@ -1,9 +1,8 @@
using System ;
using System.Collections.Generic ;
using System.IdentityModel.Tokens.Jwt ;
using System.Net.Http ;
using Devspaces.Support ;
using HealthChecks.UI.Client ;
using Microsoft.AspNetCore.Authentication.JwtBearer ;
using Microsoft.AspNetCore.Builder ;
using Microsoft.AspNetCore.Diagnostics.HealthChecks ;
using Microsoft.AspNetCore.Hosting ;
using Microsoft.AspNetCore.Http ;
using Microsoft.AspNetCore.Mvc ;
@ -13,14 +12,14 @@ using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Infrastructure;
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services ;
using Microsoft.Extensions.Configuration ;
using Microsoft.Extensions.DependencyInjection ;
using Microsoft.Extensions.Diagnostics.HealthChecks ;
using Microsoft.Extensions.Logging ;
using Polly ;
using Polly.Extensions.Http ;
using Swashbuckle.AspNetCore.Swagger ;
using HealthChecks.UI.Client ;
using Microsoft.AspNetCore.Diagnostics.HealthChecks ;
using Microsoft.Extensions.Diagnostics.HealthChecks ;
using Devspaces.Support ;
using System ;
using System.Collections.Generic ;
using System.IdentityModel.Tokens.Jwt ;
using System.Net.Http ;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{
@ -110,28 +109,31 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
services . Configure < UrlsConfig > ( configuration . GetSection ( "urls" ) ) ;
services . AddMvc ( )
. SetCompatibilityVersion ( CompatibilityVersion . Version_2_2 ) ;
. SetCompatibilityVersion ( CompatibilityVersion . Version_3_0 ) ;
services . AddSwaggerGen ( options = >
{
options . DescribeAllEnumsAsStrings ( ) ;
options . SwaggerDoc ( "v1" , new Swashbuckle . AspNetCore . Swagger . Info
options . SwaggerDoc ( "v1" , new OpenApi . Models . OpenApi Info
{
Title = "Shopping Aggregator for Mobile Clients" ,
Version = "v1" ,
Description = "Shopping Aggregator for Mobile Clients" ,
TermsOfService = "Terms Of Service"
Description = "Shopping Aggregator for Mobile Clients"
} ) ;
options . AddSecurityDefinition ( "oauth2" , new OAuth2 Scheme
options . AddSecurityDefinition ( "oauth2" , new OpenApi . Models . OpenApiSecurity Scheme
{
Type = "oauth2" ,
Flow = "implicit" ,
AuthorizationUrl = $"{configuration.GetValue<string>(" IdentityUrlExternal ")}/connect/authorize" ,
TokenUrl = $"{configuration.GetValue<string>(" IdentityUrlExternal ")}/connect/token" ,
Scopes = new Dictionary < string , string > ( )
Flows = new OpenApi . Models . OpenApiOAuthFlows ( )
{
{ "mobileshoppingagg" , "Shopping Aggregator for Mobile Clients" }
Implicit = new OpenApi . Models . OpenApiOAuthFlow ( )
{
AuthorizationUrl = new Uri ( $"{configuration.GetValue<string>(" IdentityUrlExternal ")}/connect/authorize" ) ,
TokenUrl = new Uri ( $"{configuration.GetValue<string>(" IdentityUrlExternal ")}/connect/token" ) ,
Scopes = new Dictionary < string , string > ( )
{
{ "marketing" , "Marketing API" }
}
}
}
} ) ;