From eb080668ab3288fb66713a8d89e10d4545e4642d Mon Sep 17 00:00:00 2001 From: Erik Pique Date: Wed, 24 Jul 2019 16:20:08 +0200 Subject: [PATCH] add type securitySchema OAuth2 --- .../Mobile.Bff.Shopping/aggregator/Startup.cs | 10 ++++++---- src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs | 10 ++++++---- src/Services/Basket/Basket.API/Startup.cs | 10 ++++++---- src/Services/Identity/Identity.API/Identity.API.csproj | 5 +++-- src/Services/Marketing/Marketing.API/Startup.cs | 10 ++++++---- src/Services/Ordering/Ordering.API/Startup.cs | 10 ++++++---- src/Services/Webhooks/Webhooks.API/Startup.cs | 10 ++++++---- 7 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs index efa9285c2..716f0ec5c 100644 --- a/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; using Polly; using Polly.Extensions.Http; using System; @@ -116,18 +117,19 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo + options.SwaggerDoc("v1", new OpenApiInfo { Title = "Shopping Aggregator for Mobile Clients", Version = "v1", Description = "Shopping Aggregator for Mobile Clients" }); - options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme + options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { - Flows = new OpenApi.Models.OpenApiOAuthFlows() + Type = SecuritySchemeType.OAuth2, + Flows = new OpenApiOAuthFlows() { - Implicit = new OpenApi.Models.OpenApiOAuthFlow() + Implicit = new OpenApiOAuthFlow() { AuthorizationUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/authorize"), TokenUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/token"), diff --git a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs index b6d43b300..b8ef7b459 100644 --- a/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs +++ b/src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; using Polly; using Polly.Extensions.Http; using System; @@ -142,18 +143,19 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo + options.SwaggerDoc("v1", new OpenApiInfo { Title = "Shopping Aggregator for Web Clients", Version = "v1", Description = "Shopping Aggregator for Web Clients" }); - options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme + options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { - Flows = new OpenApi.Models.OpenApiOAuthFlows() + Type = SecuritySchemeType.OAuth2, + Flows = new OpenApiOAuthFlows() { - Implicit = new OpenApi.Models.OpenApiOAuthFlow() + Implicit = new OpenApiOAuthFlow() { AuthorizationUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/authorize"), TokenUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/token"), diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 46599c616..6a23c76d4 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -26,6 +26,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Microsoft.OpenApi.Models; using RabbitMQ.Client; using StackExchange.Redis; using System; @@ -131,18 +132,19 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo + options.SwaggerDoc("v1", new OpenApiInfo { Title = "Basket HTTP API", Version = "v1", Description = "The Basket Service HTTP API" }); - options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme + options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { - Flows = new OpenApi.Models.OpenApiOAuthFlows() + Type = SecuritySchemeType.OAuth2, + Flows = new OpenApiOAuthFlows() { - Implicit = new OpenApi.Models.OpenApiOAuthFlow() + Implicit = new OpenApiOAuthFlow() { AuthorizationUrl = new Uri($"{Configuration.GetValue("IdentityUrlExternal")}/connect/authorize"), TokenUrl = new Uri($"{Configuration.GetValue("IdentityUrlExternal")}/connect/token"), diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 1fe8e7ac4..b26032233 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -5,6 +5,7 @@ aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 ..\..\..\..\docker-compose.dcproj false + true $(LangVersion) @@ -40,13 +41,13 @@ - + diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs index 533827ae2..e2d54814b 100644 --- a/src/Services/Marketing/Marketing.API/Startup.cs +++ b/src/Services/Marketing/Marketing.API/Startup.cs @@ -27,6 +27,7 @@ using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares; using Microsoft.Extensions.Diagnostics.HealthChecks; + using Microsoft.OpenApi.Models; using RabbitMQ.Client; using System; using System.Collections.Generic; @@ -127,18 +128,19 @@ services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo + options.SwaggerDoc("v1", new OpenApiInfo { Title = "Marketing HTTP API", Version = "v1", Description = "The Marketing Service HTTP API" }); - options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme + options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { - Flows = new OpenApi.Models.OpenApiOAuthFlows() + Type = SecuritySchemeType.OAuth2, + Flows = new OpenApiOAuthFlows() { - Implicit = new OpenApi.Models.OpenApiOAuthFlow() + Implicit = new OpenApiOAuthFlow() { AuthorizationUrl = new Uri($"{Configuration.GetValue("IdentityUrlExternal")}/connect/authorize"), TokenUrl = new Uri($"{Configuration.GetValue("IdentityUrlExternal")}/connect/token"), diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index ddd53489a..a987f7bcb 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -26,6 +26,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; + using Microsoft.OpenApi.Models; using Ordering.Infrastructure; using RabbitMQ.Client; using System; @@ -234,18 +235,19 @@ services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo + options.SwaggerDoc("v1", new OpenApiInfo { Title = "Ordering HTTP API", Version = "v1", Description = "The Ordering Service HTTP API" }); - options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme + options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { - Flows = new OpenApi.Models.OpenApiOAuthFlows() + Type = SecuritySchemeType.OAuth2, + Flows = new OpenApiOAuthFlows() { - Implicit = new OpenApi.Models.OpenApiOAuthFlow() + Implicit = new OpenApiOAuthFlow() { AuthorizationUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/authorize"), TokenUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/token"), diff --git a/src/Services/Webhooks/Webhooks.API/Startup.cs b/src/Services/Webhooks/Webhooks.API/Startup.cs index c7f896b0b..cf501d46c 100644 --- a/src/Services/Webhooks/Webhooks.API/Startup.cs +++ b/src/Services/Webhooks/Webhooks.API/Startup.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; using RabbitMQ.Client; using System; using System.Collections.Generic; @@ -189,18 +190,19 @@ namespace Webhooks.API services.AddSwaggerGen(options => { options.DescribeAllEnumsAsStrings(); - options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo + options.SwaggerDoc("v1", new OpenApiInfo { Title = "eShopOnContainers - Webhooks HTTP API", Version = "v1", Description = "The Webhooks Microservice HTTP API. This is a simple webhooks CRUD registration entrypoint" }); - options.AddSecurityDefinition("oauth2", new Microsoft.OpenApi.Models.OpenApiSecurityScheme + options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme { - Flows = new Microsoft.OpenApi.Models.OpenApiOAuthFlows() + Type = SecuritySchemeType.OAuth2, + Flows = new OpenApiOAuthFlows() { - Implicit = new Microsoft.OpenApi.Models.OpenApiOAuthFlow() + Implicit = new OpenApiOAuthFlow() { AuthorizationUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/authorize"), TokenUrl = new Uri($"{configuration.GetValue("IdentityUrlExternal")}/connect/token"),