WIP on Ocelot: Change routing and config errors.
This commit is contained in:
parent
dcb9b87361
commit
e59829e96b
@ -34,7 +34,17 @@ namespace OcelotApiGw
|
||||
{
|
||||
x.Authority = identityUrl;
|
||||
x.RequireHttpsMetadata = false;
|
||||
x.Audience = "ocelot";
|
||||
x.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
|
||||
{
|
||||
ValidAudiences = new[] { "orders", "basket", "locations", "marketing", "purchasebff" }
|
||||
};
|
||||
x.Events = new Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerEvents()
|
||||
{
|
||||
OnAuthenticationFailed = async ctx =>
|
||||
{
|
||||
int i = 0;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
services.AddOcelot(_cfg);
|
||||
|
@ -11,7 +11,7 @@
|
||||
{
|
||||
"DownstreamPathTemplate": "/{everything}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHost": "purchase-bff",
|
||||
"DownstreamHost": "purchasebff",
|
||||
"DownstreamPort": 80,
|
||||
"UpstreamPathTemplate": "/purchase-bff/{everything}",
|
||||
"UpstreamHttpMethod": [],
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PurchaseBff.Models;
|
||||
using PurchaseBff.Services;
|
||||
using System;
|
||||
@ -9,6 +10,7 @@ using System.Threading.Tasks;
|
||||
namespace PurchaseBff.Controllers
|
||||
{
|
||||
[Route("api/v1/[controller]")]
|
||||
[Authorize]
|
||||
public class BasketController : Controller
|
||||
{
|
||||
private readonly ICatalogService _catalog;
|
||||
|
@ -18,12 +18,19 @@ namespace PurchaseBff
|
||||
}
|
||||
|
||||
public static IWebHost BuildWebHost(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>()
|
||||
WebHost
|
||||
.CreateDefaultBuilder(args)
|
||||
.ConfigureAppConfiguration(cb =>
|
||||
{
|
||||
cb.AddJsonFile("appsettings.localhost.json", optional: true);
|
||||
var sources = cb.Sources;
|
||||
sources.Insert(3, new Microsoft.Extensions.Configuration.Json.JsonConfigurationSource()
|
||||
{
|
||||
Optional = true,
|
||||
Path = "appsettings.localhost.json",
|
||||
ReloadOnChange = false
|
||||
});
|
||||
})
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace PurchaseBff
|
||||
{
|
||||
options.Authority = identityUrl;
|
||||
options.RequireHttpsMetadata = false;
|
||||
options.Audience = "ocelot";
|
||||
options.Audience = "purchasebff";
|
||||
options.Events = new JwtBearerEvents()
|
||||
{
|
||||
OnAuthenticationFailed = async ctx =>
|
||||
|
@ -3,7 +3,7 @@
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:55103/",
|
||||
"applicationUrl": "http://localhost:51078/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user