mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 10:18:17 +08:00
Added integration test project as acceptance style doesnt work when running the new admin area because identityserver needs to use proper networking
This commit is contained in:
@ -4,7 +4,7 @@ using Ocelot.Services;
|
||||
|
||||
namespace Ocelot.Controllers
|
||||
{
|
||||
[Authorize(Roles = "Admin")]
|
||||
[Authorize]
|
||||
[Route("configuration")]
|
||||
public class FileConfigurationController : Controller
|
||||
{
|
||||
@ -18,7 +18,6 @@ namespace Ocelot.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Get()
|
||||
{
|
||||
var user = this.HttpContext.User;
|
||||
return new OkObjectResult(_getFileConfig.Invoke().Data);
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,9 @@ namespace Ocelot.DependencyInjection
|
||||
SubjectId = "admin",
|
||||
}
|
||||
});
|
||||
services.AddMvcCore().AddJsonFormatters();
|
||||
services.AddMvcCore()
|
||||
.AddAuthorization()
|
||||
.AddJsonFormatters();
|
||||
services.AddLogging();
|
||||
services.AddSingleton<IGetFileConfiguration, GetFileConfiguration>();
|
||||
services.AddSingleton<IQosProviderHouse, QosProviderHouse>();
|
||||
|
@ -148,9 +148,11 @@ namespace Ocelot.Middleware
|
||||
{
|
||||
builder.Map(configuration.AdministrationPath, app =>
|
||||
{
|
||||
var identityServerUrl = $"http://localhost:5000/{configuration.AdministrationPath.Remove(0,1)}";
|
||||
|
||||
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
|
||||
{
|
||||
Authority = "http://localhost:5000/admin",
|
||||
Authority = identityServerUrl,
|
||||
ApiName = "admin",
|
||||
RequireHttpsMetadata = false,
|
||||
AllowedScopes = new List<string>(),
|
||||
|
Reference in New Issue
Block a user