Browse Source

Purchase BFF skeleton created

pull/565/head^2
Eduard Tomàs 7 years ago
parent
commit
02f5e1158a
19 changed files with 383 additions and 11 deletions
  1. +1
    -0
      docker-compose.dcproj
  2. +8
    -1
      docker-compose.override.yml
  3. +1
    -0
      docker-compose.prod.yml
  4. +7
    -0
      docker-compose.yml
  5. +55
    -1
      eShopOnContainers-ServicesAndWebApps.sln
  6. +8
    -0
      src/Apigw/OcelotApiGw/configuration/configuration.json
  7. +23
    -0
      src/BFFs/PurchaseBff/Controllers/BasketController.cs
  8. +18
    -0
      src/BFFs/PurchaseBff/Dockerfile
  9. +33
    -0
      src/BFFs/PurchaseBff/Filters/AuthorizeCheckOperationFilter.cs
  10. +25
    -0
      src/BFFs/PurchaseBff/Program.cs
  11. +29
    -0
      src/BFFs/PurchaseBff/Properties/launchSettings.json
  12. +23
    -0
      src/BFFs/PurchaseBff/PurchaseBff.csproj
  13. +96
    -0
      src/BFFs/PurchaseBff/Startup.cs
  14. +10
    -0
      src/BFFs/PurchaseBff/appsettings.Development.json
  15. +15
    -0
      src/BFFs/PurchaseBff/appsettings.json
  16. +1
    -1
      src/Services/Basket/Basket.API/Properties/launchSettings.json
  17. +26
    -5
      src/Services/Identity/Identity.API/Configuration/Config.cs
  18. +1
    -0
      src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
  19. +3
    -3
      src/Services/Payment/Payment.API/Properties/launchSettings.json

+ 1
- 0
docker-compose.dcproj View File

@ -7,6 +7,7 @@
<DockerServiceName>webmvc</DockerServiceName> <DockerServiceName>webmvc</DockerServiceName>
<DockerTargetOS>Linux</DockerTargetOS> <DockerTargetOS>Linux</DockerTargetOS>
<ProjectVersion>2.1</ProjectVersion> <ProjectVersion>2.1</ProjectVersion>
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include=".dockerignore" /> <None Include=".dockerignore" />


+ 8
- 1
docker-compose.override.yml View File

@ -57,6 +57,7 @@ services:
- MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110 - MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
- OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
- PurchaseBFFClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
- UseCustomizationData=True - UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE} - OrchestratorType=${ORCHESTRATOR_TYPE}
@ -203,7 +204,7 @@ services:
sql.data: sql.data:
environment: environment:
- sa_password=Pass@word
- SA_PASSWORD=Pass@word
- ACCEPT_EULA=Y - ACCEPT_EULA=Y
ports: ports:
- "5433:1433" - "5433:1433"
@ -227,3 +228,9 @@ services:
ports: ports:
- "5200:80" - "5200:80"
purchasebff:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5120:80"

+ 1
- 0
docker-compose.prod.yml View File

@ -64,6 +64,7 @@ services:
- MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110 - MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 - BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
- OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 - OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
- PurchaseBFFClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
- UseCustomizationData=True - UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
- OrchestratorType=${ORCHESTRATOR_TYPE} - OrchestratorType=${ORCHESTRATOR_TYPE}


+ 7
- 0
docker-compose.yml View File

@ -113,3 +113,10 @@ services:
build: build:
context: . context: .
dockerfile: src/Apigw/OcelotApiGw/Dockerfile dockerfile: src/Apigw/OcelotApiGw/Dockerfile
purchasebff:
image: eshop/purchasebff
build:
context: .
dockerfile: src/BFFs/PurchaseBff/Dockerfile

+ 55
- 1
eShopOnContainers-ServicesAndWebApps.sln View File

@ -99,7 +99,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "sr
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiGw", "ApiGw", "{7A58AA20-67F3-48F3-88C8-24EBFE621792}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiGw", "ApiGw", "{7A58AA20-67F3-48F3-88C8-24EBFE621792}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OcelotApiGw", "src\Apigw\OcelotApiGw\OcelotApiGw.csproj", "{E0C5162E-DF26-4341-9E51-14AE800D7505}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotApiGw", "src\Apigw\OcelotApiGw\OcelotApiGw.csproj", "{E0C5162E-DF26-4341-9E51-14AE800D7505}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BFFs", "BFFs", "{EA378316-9D49-4A6B-858E-D4A25F948A74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PurchaseBff", "src\BFFs\PurchaseBff\PurchaseBff.csproj", "{F77054A6-5808-45D7-88EB-CD92B3FDB889}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -1363,6 +1367,54 @@ Global
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x64.Build.0 = Release|Any CPU {E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x64.Build.0 = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x86.ActiveCfg = Release|Any CPU {E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x86.ActiveCfg = Release|Any CPU
{E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x86.Build.0 = Release|Any CPU {E0C5162E-DF26-4341-9E51-14AE800D7505}.Release|x86.Build.0 = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|ARM.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|ARM.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|iPhone.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|x64.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|x64.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|x86.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.AppStore|x86.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|ARM.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|iPhone.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|x64.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|x64.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|x86.ActiveCfg = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Debug|x86.Build.0 = Debug|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|Any CPU.Build.0 = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|ARM.ActiveCfg = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|ARM.Build.0 = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|iPhone.ActiveCfg = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|iPhone.Build.0 = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|x64.ActiveCfg = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|x64.Build.0 = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|x86.ActiveCfg = Release|Any CPU
{F77054A6-5808-45D7-88EB-CD92B3FDB889}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1411,6 +1463,8 @@ Global
{15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F} {15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F}
{7A58AA20-67F3-48F3-88C8-24EBFE621792} = {932D8224-11F6-4D07-B109-DA28AD288A63} {7A58AA20-67F3-48F3-88C8-24EBFE621792} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{E0C5162E-DF26-4341-9E51-14AE800D7505} = {7A58AA20-67F3-48F3-88C8-24EBFE621792} {E0C5162E-DF26-4341-9E51-14AE800D7505} = {7A58AA20-67F3-48F3-88C8-24EBFE621792}
{EA378316-9D49-4A6B-858E-D4A25F948A74} = {932D8224-11F6-4D07-B109-DA28AD288A63}
{F77054A6-5808-45D7-88EB-CD92B3FDB889} = {EA378316-9D49-4A6B-858E-D4A25F948A74}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9} SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9}


+ 8
- 0
src/Apigw/OcelotApiGw/configuration/configuration.json View File

@ -1,5 +1,13 @@
{ {
"ReRoutes": [ "ReRoutes": [
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHost": "catalog.api",
"DownstreamPort": 80,
"UpstreamPathTemplate": "/purchase-bff/catalog/{everything}",
"UpstreamHttpMethod": [ "GET" ]
},
{ {
"DownstreamPathTemplate": "/{everything}", "DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http", "DownstreamScheme": "http",


+ 23
- 0
src/BFFs/PurchaseBff/Controllers/BasketController.cs View File

@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace PurchaseBff.Controllers
{
[Route("api/v1/[controller]")]
public class BasketController : Controller
{
[HttpPost("items/{catalogItemId}")]
public async Task<IActionResult> AddBasketItem(int catalogItemId)
{
// Step 1: Get the item from catalog
// Step 2: Get current basket status
// Step 3: Merge current status with new product
// Step 4: Update basket
return Ok();
}
}
}

+ 18
- 0
src/BFFs/PurchaseBff/Dockerfile View File

@ -0,0 +1,18 @@
FROM microsoft/aspnetcore:2.0.5 AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore -nowarn:msb3202,nu1503
WORKDIR /src/src/BFFs/PurchaseBff
RUN dotnet build --no-restore -c Release -o /app
FROM build AS publish
RUN dotnet publish --no-restore -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "PurchaseBff.dll"]

+ 33
- 0
src/BFFs/PurchaseBff/Filters/AuthorizeCheckOperationFilter.cs View File

@ -0,0 +1,33 @@
namespace PurchaseBff.Filters
{
using Microsoft.AspNetCore.Authorization;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Collections.Generic;
using System.Linq;
namespace Basket.API.Infrastructure.Filters
{
public class AuthorizeCheckOperationFilter : IOperationFilter
{
public void Apply(Operation operation, OperationFilterContext context)
{
// Check for authorize attribute
var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() ||
context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any();
if (hasAuthorize)
{
operation.Responses.Add("401", new Response { Description = "Unauthorized" });
operation.Responses.Add("403", new Response { Description = "Forbidden" });
operation.Security = new List<IDictionary<string, IEnumerable<string>>>();
operation.Security.Add(new Dictionary<string, IEnumerable<string>>
{
{ "oauth2", new [] { "purchasebff" } }
});
}
}
}
}
}

+ 25
- 0
src/BFFs/PurchaseBff/Program.cs View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace PurchaseBff
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}

+ 29
- 0
src/BFFs/PurchaseBff/Properties/launchSettings.json View File

@ -0,0 +1,29 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:61631/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"PurchaseForMvc": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:61632/"
}
}
}

+ 23
- 0
src/BFFs/PurchaseBff/PurchaseBff.csproj View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyName>PurchaseBff</AssemblyName>
<RootNamespace>PurchaseBff</RootNamespace>
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
</ItemGroup>
</Project>

+ 96
- 0
src/BFFs/PurchaseBff/Startup.cs View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using PurchaseBff.Filters.Basket.API.Infrastructure.Filters;
using Swashbuckle.AspNetCore.Swagger;
namespace PurchaseBff
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
{
Title = "Purchase BFF API Gateway",
Version = "v1",
Description = "BFF API Gateway for Purchase features",
TermsOfService = "Terms Of Service"
});
options.AddSecurityDefinition("oauth2", new OAuth2Scheme
{
Type = "oauth2",
Flow = "implicit",
AuthorizationUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/authorize",
TokenUrl = $"{Configuration.GetValue<string>("IdentityUrlExternal")}/connect/token",
Scopes = new Dictionary<string, string>()
{
{ "purchasebff", "Purchase BFF API Gateway" }
}
});
options.OperationFilter<AuthorizeCheckOperationFilter>();
});
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy");
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
app.UseSwagger().UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Purchase BFF V1");
c.ConfigureOAuth2("purchasebffwaggerui", "", "", "Purchase BFF Swagger UI");
});
}
}
}

+ 10
- 0
src/BFFs/PurchaseBff/appsettings.Development.json View File

@ -0,0 +1,10 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

+ 15
- 0
src/BFFs/PurchaseBff/appsettings.json View File

@ -0,0 +1,15 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}

+ 1
- 1
src/Services/Basket/Basket.API/Properties/launchSettings.json View File

@ -3,7 +3,7 @@
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:5103/",
"applicationUrl": "http://localhost:63335/",
"sslPort": 0 "sslPort": 0
} }
}, },


+ 26
- 5
src/Services/Identity/Identity.API/Configuration/Config.cs View File

@ -14,7 +14,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
new ApiResource("orders", "Orders Service"), new ApiResource("orders", "Orders Service"),
new ApiResource("basket", "Basket Service"), new ApiResource("basket", "Basket Service"),
new ApiResource("marketing", "Marketing Service"), new ApiResource("marketing", "Marketing Service"),
new ApiResource("locations", "Locations Service")
new ApiResource("locations", "Locations Service"),
new ApiResource("purchasebff", "Purchase BFF")
}; };
} }
@ -52,7 +53,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"orders", "orders",
"basket", "basket",
"locations", "locations",
"marketing"
"marketing",
"purchasebff"
} }
}, },
new Client new Client
@ -78,7 +80,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"orders", "orders",
"basket", "basket",
"locations", "locations",
"marketing"
"marketing",
"purchasebff"
}, },
//Allow requesting refresh tokens for long lived API access //Allow requesting refresh tokens for long lived API access
AllowOfflineAccess = true, AllowOfflineAccess = true,
@ -114,7 +117,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"orders", "orders",
"basket", "basket",
"locations", "locations",
"marketing"
"marketing",
"purchasebff"
}, },
}, },
new Client new Client
@ -146,7 +150,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
"orders", "orders",
"basket", "basket",
"locations", "locations",
"marketing"
"marketing",
"purchasebff"
}, },
}, },
new Client new Client
@ -208,7 +213,23 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
{ {
"orders" "orders"
} }
},
new Client
{
ClientId = "purchasebffwaggerui",
ClientName = "Purchase BFF Swagger UI",
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RedirectUris = { $"{clientsUrl["PurchaseBFF"]}/swagger/o2c.html" },
PostLogoutRedirectUris = { $"{clientsUrl["PurchaseBFF"]}/swagger/" },
AllowedScopes =
{
"purchasebff"
}
} }
}; };
} }
} }

+ 1
- 0
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs View File

@ -23,6 +23,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
clientUrls.Add("MarketingApi", configuration.GetValue<string>("MarketingApiClient")); clientUrls.Add("MarketingApi", configuration.GetValue<string>("MarketingApiClient"));
clientUrls.Add("BasketApi", configuration.GetValue<string>("BasketApiClient")); clientUrls.Add("BasketApi", configuration.GetValue<string>("BasketApiClient"));
clientUrls.Add("OrderingApi", configuration.GetValue<string>("OrderingApiClient")); clientUrls.Add("OrderingApi", configuration.GetValue<string>("OrderingApiClient"));
clientUrls.Add("PurchaseBFF", configuration.GetValue<string>("PurchaseBFFClient"));
if (!context.Clients.Any()) if (!context.Clients.Any())
{ {


+ 3
- 3
src/Services/Payment/Payment.API/Properties/launchSettings.json View File

@ -1,9 +1,9 @@
{
{
"iisSettings": { "iisSettings": {
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:3330/",
"applicationUrl": "http://localhost:63336/",
"sslPort": 0 "sslPort": 0
} }
}, },
@ -26,4 +26,4 @@
"applicationUrl": "http://localhost:3331" "applicationUrl": "http://localhost:3331"
} }
} }
}
}

Loading…
Cancel
Save