zoukankan      html  css  js  c++  java
  • Integrate Identity Server 4 with Ocelot

    Setp1: In startup.cs

    public void ConfigureServices(IServiceCollection services)
    {

    #region Integrate with Identity Server 4

    var authenticationProviderKey = "ID4";

    services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
    .AddIdentityServerAuthentication(authenticationProviderKey, options =>
    {
    options.RequireHttpsMetadata = false;   //it is very important to have it in dev enviroment, otherwise will meet http 500 error
    options.Authority = "http://localhost:5000";
    options.ApiName = "socialnetwork";
    });

    #endregion

    services.AddOcelot(Configuration)
    .AddCacheManager(x => {
    x.WithMicrosoftLogging(log =>
    {
    log.AddConsole(LogLevel.Debug);
    })
    .WithDictionaryHandle();
    }); ;
    }

    Step2: In ocelot configuration.json

    {
    "DownstreamPathTemplate": "/api/values",
    "DownstreamScheme": "http",
    "DownstreamPort": 8802,
    "DownstreamHost": "localhost",
    "UpstreamPathTemplate": "/api/product",
    "UpstreamHttpMethod": [ "Get" ],
    "QoSOptions": {
    "ExceptionsAllowedBeforeBreaking": 3,
    "DurationOfBreak": 10,
    "TimeoutValue": 5000
    },
    "AuthenticationOptions": {
    "AuthenticationProviderKey": "ID4",
    "AllowedScopes": []
    }
    }

  • 相关阅读:
    C#中double转int时需要注意的地方
    OracleHelper类
    POJ2570, ZOJ1967
    ZOJ3088
    POJ3259(spfa判负环)
    POJ3268
    ZOJ1092 POJ2240
    ZOJ1298 POJ1135
    SRM587 div2
    POJ1679判断最小生成树是否唯一
  • 原文地址:https://www.cnblogs.com/zhifu-feng/p/7986651.html
Copyright © 2011-2022 走看看