Browse Source

Removed SwaggerWithAuthConfigurationHelper and added as a method to default configurer

pull/84/head
Galip Tolga Erdem 5 years ago
parent
commit
5cd3d6230c
  1. 2
      apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs
  2. 2
      gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs
  3. 2
      gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs
  4. 2
      services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs
  5. 2
      services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs
  6. 2
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/CatalogServiceHttpApiHostModule.cs
  7. 2
      services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs
  8. 2
      services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/OrderingServiceHttpApiHostModule.cs
  9. 2
      services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/PaymentServiceHttpApiHostModule.cs
  10. 22
      shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs
  11. 30
      shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerWithAuthConfigurationHelper.cs

2
apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs

@ -214,7 +214,7 @@ public class EShopOnAbpAuthServerModule : AbpModule
private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration)
{
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new Dictionary<string, string>

2
gateways/web-public/src/EShopOnAbp.WebPublicGateway/EShopOnAbpWebPublicGatewayModule.cs

@ -23,7 +23,7 @@ public class EShopOnAbpWebPublicGatewayModule : AbpModule
var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment();
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new Dictionary<string, string> /* Requested scopes for authorization code request and descriptions for swagger UI only */

2
gateways/web/src/EShopOnAbp.WebGateway/EShopOnAbpWebGatewayModule.cs

@ -25,7 +25,7 @@ public class EShopOnAbpWebGatewayModule : AbpModule
var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment();
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

2
services/administration/src/EShopOnAbp.AdministrationService.HttpApi.Host/AdministrationServiceHttpApiHostModule.cs

@ -37,7 +37,7 @@ public class AdministrationServiceHttpApiHostModule : AbpModule
JwtBearerConfigurationHelper.Configure(context, "AdministrationService");
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

2
services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs

@ -94,7 +94,7 @@ namespace EShopOnAbp.BasketService
private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration)
{
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

2
services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/CatalogServiceHttpApiHostModule.cs

@ -37,7 +37,7 @@ public class CatalogServiceHttpApiHostModule : AbpModule
JwtBearerConfigurationHelper.Configure(context, "CatalogService");
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

2
services/identity/src/EShopOnAbp.IdentityService.HttpApi.Host/IdentityServiceHttpApiHostModule.cs

@ -33,7 +33,7 @@ public class IdentityServiceHttpApiHostModule : AbpModule
JwtBearerConfigurationHelper.Configure(context, "IdentityService");
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

2
services/ordering/src/EShopOnAbp.OrderingService.HttpApi.Host/OrderingServiceHttpApiHostModule.cs

@ -33,7 +33,7 @@ public class OrderingServiceHttpApiHostModule : AbpModule
JwtBearerConfigurationHelper.Configure(context, "OrderingService");
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

2
services/payment/src/EShopOnAbp.PaymentService.HttpApi.Host/PaymentServiceHttpApiHostModule.cs

@ -34,7 +34,7 @@ public class PaymentServiceHttpApiHostModule : AbpModule
JwtBearerConfigurationHelper.Configure(context, "PaymentService");
SwaggerWithAuthConfigurationHelper.Configure(
SwaggerConfigurationHelper.ConfigureWithAuth(
context: context,
authority: configuration["AuthServer:Authority"],
scopes: new

22
shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Volo.Abp.Modularity;
@ -18,5 +19,24 @@ namespace EShopOnAbp.Shared.Hosting.AspNetCore
options.CustomSchemaIds(type => type.FullName);
});
}
public static void ConfigureWithAuth(
ServiceConfigurationContext context,
string authority,
Dictionary<string, string> scopes,
string apiTitle,
string apiVersion = "v1",
string apiName = "v1"
)
{
context.Services.AddAbpSwaggerGenWithOAuth(
authority: authority,
scopes: scopes,
options =>
{
options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
}
}
}

30
shared/EShopOnAbp.Shared.Hosting.AspNetCore/SwaggerWithAuthConfigurationHelper.cs

@ -1,30 +0,0 @@
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Volo.Abp.Modularity;
namespace EShopOnAbp.Shared.Hosting.AspNetCore
{
public static class SwaggerWithAuthConfigurationHelper
{
public static void Configure(
ServiceConfigurationContext context,
string authority,
Dictionary<string, string> scopes,
string apiTitle,
string apiVersion = "v1",
string apiName = "v1"
)
{
context.Services.AddAbpSwaggerGenWithOAuth(
authority: authority,
scopes: scopes,
options =>
{
options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
}
}
}
Loading…
Cancel
Save