Identityserver 4 and Ocelot

问题描述 投票:4回答:1

我正在尝试将Ocelot与IS4配合使用https://ocelot.readthedocs.io/en/latest/features/authentication.html

使用时

public void ConfigureServices(IServiceCollection services)
{
    var authenticationProviderKey = "TestKey";

    services.AddAuthentication()
        .AddJwtBearer(authenticationProviderKey, x =>
        {
        });
}

并在ocelot.json中使用“ TestKey”,启动应用程序时会引发错误

无法启动Ocelot,错误是:TestKey,AllowedScopes:[]是不受支持的身份验证提供程序

知道有什么问题吗?我是否需要在IdentityServer应用中特别设置一些内容?

c# .net-core identityserver4 api-gateway ocelot
1个回答
0
投票
您需要添加选项,例如:

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { // base-address of your identityserver options.Authority = "https://demo.identityserver.io"; // name of the API resource options.Audience = "api1"; });

© www.soinside.com 2019 - 2024. All rights reserved.