diff --git a/docker-compose.dcproj b/docker-compose.dcproj index 5f12f7d62..d1f485b05 100644 --- a/docker-compose.dcproj +++ b/docker-compose.dcproj @@ -7,6 +7,7 @@ webmvc Linux 2.1 + LaunchBrowser diff --git a/docker-compose.override.yml b/docker-compose.override.yml index c8b952af5..93c9cde4b 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -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" + diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 443f987f8..8c8d67b5d 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -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} diff --git a/docker-compose.yml b/docker-compose.yml index bda0acded..18a3273f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -113,3 +113,10 @@ services: build: context: . dockerfile: src/Apigw/OcelotApiGw/Dockerfile + + purchasebff: + image: eshop/purchasebff + build: + context: . + dockerfile: src/BFFs/PurchaseBff/Dockerfile + diff --git a/eShopOnContainers-ServicesAndWebApps.sln b/eShopOnContainers-ServicesAndWebApps.sln index 4a07ad380..7d25f9b3a 100644 --- a/eShopOnContainers-ServicesAndWebApps.sln +++ b/eShopOnContainers-ServicesAndWebApps.sln @@ -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} diff --git a/src/Apigw/OcelotApiGw/configuration/configuration.json b/src/Apigw/OcelotApiGw/configuration/configuration.json index 6e9513993..973f6874c 100644 --- a/src/Apigw/OcelotApiGw/configuration/configuration.json +++ b/src/Apigw/OcelotApiGw/configuration/configuration.json @@ -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", diff --git a/src/BFFs/PurchaseBff/Controllers/BasketController.cs b/src/BFFs/PurchaseBff/Controllers/BasketController.cs new file mode 100644 index 000000000..7c875c9c4 --- /dev/null +++ b/src/BFFs/PurchaseBff/Controllers/BasketController.cs @@ -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 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(); + } + } +} diff --git a/src/BFFs/PurchaseBff/Dockerfile b/src/BFFs/PurchaseBff/Dockerfile new file mode 100644 index 000000000..500f8406f --- /dev/null +++ b/src/BFFs/PurchaseBff/Dockerfile @@ -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"] diff --git a/src/BFFs/PurchaseBff/Filters/AuthorizeCheckOperationFilter.cs b/src/BFFs/PurchaseBff/Filters/AuthorizeCheckOperationFilter.cs new file mode 100644 index 000000000..31b5bf99e --- /dev/null +++ b/src/BFFs/PurchaseBff/Filters/AuthorizeCheckOperationFilter.cs @@ -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().Any() || + context.ApiDescription.ActionAttributes().OfType().Any(); + + if (hasAuthorize) + { + operation.Responses.Add("401", new Response { Description = "Unauthorized" }); + operation.Responses.Add("403", new Response { Description = "Forbidden" }); + + operation.Security = new List>>(); + operation.Security.Add(new Dictionary> + { + { "oauth2", new [] { "purchasebff" } } + }); + } + } + } + } +} diff --git a/src/BFFs/PurchaseBff/Program.cs b/src/BFFs/PurchaseBff/Program.cs new file mode 100644 index 000000000..fe7210968 --- /dev/null +++ b/src/BFFs/PurchaseBff/Program.cs @@ -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() + .Build(); + } +} diff --git a/src/BFFs/PurchaseBff/Properties/launchSettings.json b/src/BFFs/PurchaseBff/Properties/launchSettings.json new file mode 100644 index 000000000..709d1b89a --- /dev/null +++ b/src/BFFs/PurchaseBff/Properties/launchSettings.json @@ -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/" + } + } +} diff --git a/src/BFFs/PurchaseBff/PurchaseBff.csproj b/src/BFFs/PurchaseBff/PurchaseBff.csproj new file mode 100644 index 000000000..b986e743f --- /dev/null +++ b/src/BFFs/PurchaseBff/PurchaseBff.csproj @@ -0,0 +1,23 @@ + + + + netcoreapp2.0 + PurchaseBff + PurchaseBff + ..\..\..\docker-compose.dcproj + + + + + + + + + + + + + + + + diff --git a/src/BFFs/PurchaseBff/Startup.cs b/src/BFFs/PurchaseBff/Startup.cs new file mode 100644 index 000000000..e82ee91fd --- /dev/null +++ b/src/BFFs/PurchaseBff/Startup.cs @@ -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("IdentityUrlExternal")}/connect/authorize", + TokenUrl = $"{Configuration.GetValue("IdentityUrlExternal")}/connect/token", + Scopes = new Dictionary() + { + { "purchasebff", "Purchase BFF API Gateway" } + } + }); + + options.OperationFilter(); + }); + + 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"); + }); + + + } + } +} diff --git a/src/BFFs/PurchaseBff/appsettings.Development.json b/src/BFFs/PurchaseBff/appsettings.Development.json new file mode 100644 index 000000000..fa8ce71a9 --- /dev/null +++ b/src/BFFs/PurchaseBff/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/BFFs/PurchaseBff/appsettings.json b/src/BFFs/PurchaseBff/appsettings.json new file mode 100644 index 000000000..26bb0ac7a --- /dev/null +++ b/src/BFFs/PurchaseBff/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "IncludeScopes": false, + "Debug": { + "LogLevel": { + "Default": "Warning" + } + }, + "Console": { + "LogLevel": { + "Default": "Warning" + } + } + } +} diff --git a/src/Services/Basket/Basket.API/Properties/launchSettings.json b/src/Services/Basket/Basket.API/Properties/launchSettings.json index 36effc287..a397c4eb3 100644 --- a/src/Services/Basket/Basket.API/Properties/launchSettings.json +++ b/src/Services/Basket/Basket.API/Properties/launchSettings.json @@ -3,7 +3,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:5103/", + "applicationUrl": "http://localhost:63335/", "sslPort": 0 } }, diff --git a/src/Services/Identity/Identity.API/Configuration/Config.cs b/src/Services/Identity/Identity.API/Configuration/Config.cs index 969b86aa1..9905a04d3 100644 --- a/src/Services/Identity/Identity.API/Configuration/Config.cs +++ b/src/Services/Identity/Identity.API/Configuration/Config.cs @@ -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" + } } + }; } } diff --git a/src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs b/src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs index bb41f0d0a..0875361be 100644 --- a/src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs +++ b/src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs @@ -23,6 +23,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Data clientUrls.Add("MarketingApi", configuration.GetValue("MarketingApiClient")); clientUrls.Add("BasketApi", configuration.GetValue("BasketApiClient")); clientUrls.Add("OrderingApi", configuration.GetValue("OrderingApiClient")); + clientUrls.Add("PurchaseBFF", configuration.GetValue("PurchaseBFFClient")); if (!context.Clients.Any()) { diff --git a/src/Services/Payment/Payment.API/Properties/launchSettings.json b/src/Services/Payment/Payment.API/Properties/launchSettings.json index faf310f83..5eac4c092 100644 --- a/src/Services/Payment/Payment.API/Properties/launchSettings.json +++ b/src/Services/Payment/Payment.API/Properties/launchSettings.json @@ -1,9 +1,9 @@ -{ +{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:3330/", + "applicationUrl": "http://localhost:63336/", "sslPort": 0 } }, @@ -26,4 +26,4 @@ "applicationUrl": "http://localhost:3331" } } -} +} \ No newline at end of file