Purchase BFF skeleton created
This commit is contained in:
parent
c42a096ebb
commit
02f5e1158a
@ -7,6 +7,7 @@
|
||||
<DockerServiceName>webmvc</DockerServiceName>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".dockerignore" />
|
||||
|
@ -57,6 +57,7 @@ services:
|
||||
- MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
|
||||
- BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
|
||||
- OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
|
||||
- PurchaseBFFClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
|
||||
- UseCustomizationData=True
|
||||
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
|
||||
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
||||
@ -203,7 +204,7 @@ services:
|
||||
|
||||
sql.data:
|
||||
environment:
|
||||
- sa_password=Pass@word
|
||||
- SA_PASSWORD=Pass@word
|
||||
- ACCEPT_EULA=Y
|
||||
ports:
|
||||
- "5433:1433"
|
||||
@ -227,3 +228,9 @@ services:
|
||||
ports:
|
||||
- "5200:80"
|
||||
|
||||
purchasebff:
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
ports:
|
||||
- "5120:80"
|
||||
|
||||
|
@ -64,6 +64,7 @@ services:
|
||||
- MarketingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5110
|
||||
- BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103
|
||||
- OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102
|
||||
- PurchaseBFFClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120
|
||||
- UseCustomizationData=True
|
||||
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
|
||||
- OrchestratorType=${ORCHESTRATOR_TYPE}
|
||||
|
@ -113,3 +113,10 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/Apigw/OcelotApiGw/Dockerfile
|
||||
|
||||
purchasebff:
|
||||
image: eshop/purchasebff
|
||||
build:
|
||||
context: .
|
||||
dockerfile: src/BFFs/PurchaseBff/Dockerfile
|
||||
|
||||
|
@ -99,7 +99,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebHost.Customization", "sr
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ApiGw", "ApiGw", "{7A58AA20-67F3-48F3-88C8-24EBFE621792}"
|
||||
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
|
||||
Global
|
||||
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|x86.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -1411,6 +1463,8 @@ Global
|
||||
{15F4B3AA-89B6-4A0D-9051-414305974781} = {1815B651-941C-466B-AE33-D1D7EEB8F77F}
|
||||
{7A58AA20-67F3-48F3-88C8-24EBFE621792} = {932D8224-11F6-4D07-B109-DA28AD288A63}
|
||||
{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
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {25728519-5F0F-4973-8A64-0A81EB4EA8D9}
|
||||
|
@ -1,5 +1,13 @@
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHost": "catalog.api",
|
||||
"DownstreamPort": 80,
|
||||
"UpstreamPathTemplate": "/purchase-bff/catalog/{everything}",
|
||||
"UpstreamHttpMethod": [ "GET" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
|
23
src/BFFs/PurchaseBff/Controllers/BasketController.cs
Normal file
23
src/BFFs/PurchaseBff/Controllers/BasketController.cs
Normal 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
src/BFFs/PurchaseBff/Dockerfile
Normal file
18
src/BFFs/PurchaseBff/Dockerfile
Normal 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"]
|
@ -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
src/BFFs/PurchaseBff/Program.cs
Normal file
25
src/BFFs/PurchaseBff/Program.cs
Normal 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
src/BFFs/PurchaseBff/Properties/launchSettings.json
Normal file
29
src/BFFs/PurchaseBff/Properties/launchSettings.json
Normal 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
src/BFFs/PurchaseBff/PurchaseBff.csproj
Normal file
23
src/BFFs/PurchaseBff/PurchaseBff.csproj
Normal 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
src/BFFs/PurchaseBff/Startup.cs
Normal file
96
src/BFFs/PurchaseBff/Startup.cs
Normal 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
src/BFFs/PurchaseBff/appsettings.Development.json
Normal file
10
src/BFFs/PurchaseBff/appsettings.Development.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"System": "Information",
|
||||
"Microsoft": "Information"
|
||||
}
|
||||
}
|
||||
}
|
15
src/BFFs/PurchaseBff/appsettings.json
Normal file
15
src/BFFs/PurchaseBff/appsettings.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"Logging": {
|
||||
"IncludeScopes": false,
|
||||
"Debug": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"Console": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5103/",
|
||||
"applicationUrl": "http://localhost:63335/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
|
@ -14,7 +14,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
new ApiResource("orders", "Orders Service"),
|
||||
new ApiResource("basket", "Basket 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",
|
||||
"basket",
|
||||
"locations",
|
||||
"marketing"
|
||||
"marketing",
|
||||
"purchasebff"
|
||||
}
|
||||
},
|
||||
new Client
|
||||
@ -78,7 +80,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
"orders",
|
||||
"basket",
|
||||
"locations",
|
||||
"marketing"
|
||||
"marketing",
|
||||
"purchasebff"
|
||||
},
|
||||
//Allow requesting refresh tokens for long lived API access
|
||||
AllowOfflineAccess = true,
|
||||
@ -114,7 +117,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
"orders",
|
||||
"basket",
|
||||
"locations",
|
||||
"marketing"
|
||||
"marketing",
|
||||
"purchasebff"
|
||||
},
|
||||
},
|
||||
new Client
|
||||
@ -146,7 +150,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
"orders",
|
||||
"basket",
|
||||
"locations",
|
||||
"marketing"
|
||||
"marketing",
|
||||
"purchasebff"
|
||||
},
|
||||
},
|
||||
new Client
|
||||
@ -208,7 +213,23 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Configuration
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data
|
||||
clientUrls.Add("MarketingApi", configuration.GetValue<string>("MarketingApiClient"));
|
||||
clientUrls.Add("BasketApi", configuration.GetValue<string>("BasketApiClient"));
|
||||
clientUrls.Add("OrderingApi", configuration.GetValue<string>("OrderingApiClient"));
|
||||
clientUrls.Add("PurchaseBFF", configuration.GetValue<string>("PurchaseBFFClient"));
|
||||
|
||||
if (!context.Clients.Any())
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:3330/",
|
||||
"applicationUrl": "http://localhost:63336/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user