Skip to content

Commit eb08066

Browse files
committed
add type securitySchema OAuth2
1 parent 2506782 commit eb08066

File tree

7 files changed

+39
-26
lines changed

7 files changed

+39
-26
lines changed

src/ApiGateways/Mobile.Bff.Shopping/aggregator/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using Microsoft.Extensions.DependencyInjection;
1515
using Microsoft.Extensions.Diagnostics.HealthChecks;
1616
using Microsoft.Extensions.Logging;
17+
using Microsoft.OpenApi.Models;
1718
using Polly;
1819
using Polly.Extensions.Http;
1920
using System;
@@ -116,18 +117,19 @@ public static IServiceCollection AddCustomMvc(this IServiceCollection services,
116117
services.AddSwaggerGen(options =>
117118
{
118119
options.DescribeAllEnumsAsStrings();
119-
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo
120+
options.SwaggerDoc("v1", new OpenApiInfo
120121
{
121122
Title = "Shopping Aggregator for Mobile Clients",
122123
Version = "v1",
123124
Description = "Shopping Aggregator for Mobile Clients"
124125
});
125126

126-
options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme
127+
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
127128
{
128-
Flows = new OpenApi.Models.OpenApiOAuthFlows()
129+
Type = SecuritySchemeType.OAuth2,
130+
Flows = new OpenApiOAuthFlows()
129131
{
130-
Implicit = new OpenApi.Models.OpenApiOAuthFlow()
132+
Implicit = new OpenApiOAuthFlow()
131133
{
132134
AuthorizationUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
133135
TokenUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),

src/ApiGateways/Web.Bff.Shopping/aggregator/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using Microsoft.Extensions.DependencyInjection;
1515
using Microsoft.Extensions.Diagnostics.HealthChecks;
1616
using Microsoft.Extensions.Logging;
17+
using Microsoft.OpenApi.Models;
1718
using Polly;
1819
using Polly.Extensions.Http;
1920
using System;
@@ -142,18 +143,19 @@ public static IServiceCollection AddCustomMvc(this IServiceCollection services,
142143
services.AddSwaggerGen(options =>
143144
{
144145
options.DescribeAllEnumsAsStrings();
145-
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo
146+
options.SwaggerDoc("v1", new OpenApiInfo
146147
{
147148
Title = "Shopping Aggregator for Web Clients",
148149
Version = "v1",
149150
Description = "Shopping Aggregator for Web Clients"
150151
});
151152

152-
options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme
153+
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
153154
{
154-
Flows = new OpenApi.Models.OpenApiOAuthFlows()
155+
Type = SecuritySchemeType.OAuth2,
156+
Flows = new OpenApiOAuthFlows()
155157
{
156-
Implicit = new OpenApi.Models.OpenApiOAuthFlow()
158+
Implicit = new OpenApiOAuthFlow()
157159
{
158160
AuthorizationUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
159161
TokenUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),

src/Services/Basket/Basket.API/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using Microsoft.Extensions.Diagnostics.HealthChecks;
2727
using Microsoft.Extensions.Logging;
2828
using Microsoft.Extensions.Options;
29+
using Microsoft.OpenApi.Models;
2930
using RabbitMQ.Client;
3031
using StackExchange.Redis;
3132
using System;
@@ -131,18 +132,19 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
131132
services.AddSwaggerGen(options =>
132133
{
133134
options.DescribeAllEnumsAsStrings();
134-
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo
135+
options.SwaggerDoc("v1", new OpenApiInfo
135136
{
136137
Title = "Basket HTTP API",
137138
Version = "v1",
138139
Description = "The Basket Service HTTP API"
139140
});
140141

141-
options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme
142+
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
142143
{
143-
Flows = new OpenApi.Models.OpenApiOAuthFlows()
144+
Type = SecuritySchemeType.OAuth2,
145+
Flows = new OpenApiOAuthFlows()
144146
{
145-
Implicit = new OpenApi.Models.OpenApiOAuthFlow()
147+
Implicit = new OpenApiOAuthFlow()
146148
{
147149
AuthorizationUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
148150
TokenUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),

src/Services/Identity/Identity.API/Identity.API.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<UserSecretsId>aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5</UserSecretsId>
66
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
77
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
8+
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
89
<LangVersion>$(LangVersion)</LangVersion>
910
</PropertyGroup>
1011

@@ -40,13 +41,13 @@
4041
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="$(Microsoft_AspNetCore_Diagnostics_EntityFrameworkCore)" />
4142
</ItemGroup>
4243

43-
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
44+
<!--<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
4445
<Exec Command="dotnet bundle" Condition="'$(ASPNETCORE_ENVIRONMENT)'!='Development'" />
4546
</Target>
4647
4748
<ItemGroup>
4849
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="$(BundlerMinifier_Core)" />
49-
</ItemGroup>
50+
</ItemGroup>-->
5051

5152
<ItemGroup>
5253
<EmbeddedResource Include="Certificate\idsrv3test.pfx" />

src/Services/Marketing/Marketing.API/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using Microsoft.EntityFrameworkCore.Diagnostics;
2828
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Middlewares;
2929
using Microsoft.Extensions.Diagnostics.HealthChecks;
30+
using Microsoft.OpenApi.Models;
3031
using RabbitMQ.Client;
3132
using System;
3233
using System.Collections.Generic;
@@ -127,18 +128,19 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
127128
services.AddSwaggerGen(options =>
128129
{
129130
options.DescribeAllEnumsAsStrings();
130-
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo
131+
options.SwaggerDoc("v1", new OpenApiInfo
131132
{
132133
Title = "Marketing HTTP API",
133134
Version = "v1",
134135
Description = "The Marketing Service HTTP API"
135136
});
136137

137-
options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme
138+
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
138139
{
139-
Flows = new OpenApi.Models.OpenApiOAuthFlows()
140+
Type = SecuritySchemeType.OAuth2,
141+
Flows = new OpenApiOAuthFlows()
140142
{
141-
Implicit = new OpenApi.Models.OpenApiOAuthFlow()
143+
Implicit = new OpenApiOAuthFlow()
142144
{
143145
AuthorizationUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
144146
TokenUrl = new Uri($"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),

src/Services/Ordering/Ordering.API/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
using Microsoft.Extensions.DependencyInjection;
2727
using Microsoft.Extensions.Diagnostics.HealthChecks;
2828
using Microsoft.Extensions.Logging;
29+
using Microsoft.OpenApi.Models;
2930
using Ordering.Infrastructure;
3031
using RabbitMQ.Client;
3132
using System;
@@ -234,18 +235,19 @@ public static IServiceCollection AddCustomSwagger(this IServiceCollection servic
234235
services.AddSwaggerGen(options =>
235236
{
236237
options.DescribeAllEnumsAsStrings();
237-
options.SwaggerDoc("v1", new OpenApi.Models.OpenApiInfo
238+
options.SwaggerDoc("v1", new OpenApiInfo
238239
{
239240
Title = "Ordering HTTP API",
240241
Version = "v1",
241242
Description = "The Ordering Service HTTP API"
242243
});
243244

244-
options.AddSecurityDefinition("oauth2", new OpenApi.Models.OpenApiSecurityScheme
245+
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
245246
{
246-
Flows = new OpenApi.Models.OpenApiOAuthFlows()
247+
Type = SecuritySchemeType.OAuth2,
248+
Flows = new OpenApiOAuthFlows()
247249
{
248-
Implicit = new OpenApi.Models.OpenApiOAuthFlow()
250+
Implicit = new OpenApiOAuthFlow()
249251
{
250252
AuthorizationUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
251253
TokenUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),

src/Services/Webhooks/Webhooks.API/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Microsoft.Extensions.DependencyInjection;
2020
using Microsoft.Extensions.Diagnostics.HealthChecks;
2121
using Microsoft.Extensions.Logging;
22+
using Microsoft.OpenApi.Models;
2223
using RabbitMQ.Client;
2324
using System;
2425
using System.Collections.Generic;
@@ -189,18 +190,19 @@ public static IServiceCollection AddSwagger(this IServiceCollection services, IC
189190
services.AddSwaggerGen(options =>
190191
{
191192
options.DescribeAllEnumsAsStrings();
192-
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
193+
options.SwaggerDoc("v1", new OpenApiInfo
193194
{
194195
Title = "eShopOnContainers - Webhooks HTTP API",
195196
Version = "v1",
196197
Description = "The Webhooks Microservice HTTP API. This is a simple webhooks CRUD registration entrypoint"
197198
});
198199

199-
options.AddSecurityDefinition("oauth2", new Microsoft.OpenApi.Models.OpenApiSecurityScheme
200+
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
200201
{
201-
Flows = new Microsoft.OpenApi.Models.OpenApiOAuthFlows()
202+
Type = SecuritySchemeType.OAuth2,
203+
Flows = new OpenApiOAuthFlows()
202204
{
203-
Implicit = new Microsoft.OpenApi.Models.OpenApiOAuthFlow()
205+
Implicit = new OpenApiOAuthFlow()
204206
{
205207
AuthorizationUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize"),
206208
TokenUrl = new Uri($"{configuration.GetValue<string>("IdentityUrlExternal")}/connect/token"),

0 commit comments

Comments
 (0)