Search code examples
c#asp.net-core.net-corejwtidentityserver4

Why is it not possible to set options in IdentityServer?


I have been tried to apply several kind of setting on Startup.cs as shown ob the given link:

https://identityserver4.readthedocs.io/en/latest/quickstarts/2_interactive_aspnetcore.html

But unfortunately I cannot set the base url for Authority parameter when I check on the following url:

https://my-pc-id:8085/_configuration/MyApp.WebUI

It seems to be weird, because if we cannot set this parameter, why there is such an option on this config?

using System.IdentityModel.Tokens.Jwt;

// ...

JwtSecurityTokenHandler.DefaultMapInboundClaims = false;

services.AddAuthentication(options =>
    {
        options.DefaultScheme = "Cookies";
        options.DefaultChallengeScheme = "oidc";
    })
    .AddCookie("Cookies")
    .AddOpenIdConnect("oidc", options =>
    {
        options.Authority = "my-pc-id:8085";

        options.ClientId = "mvc";
        options.ClientSecret = "secret";
        options.ResponseType = "code";

        options.SaveTokens = true;
    });

Solution

  • Change the Authority property like so:

    // base-address of your identityserver
    .Authority = "https://my-pc-id:8085/_configuration/MyApp.WebUI";