首页 > 解决方案 > asp .net core 3.1 身份服务器

问题描述

我有一个需要在 .net core 3.1 更新的项目。问题是我不知道如何使用 3.1 中的这个新功能。我在 appsettings.development.json 中有我的身份服务器设置,如下所示:

"IdentityServerSettings": {
    "TokenUrl": "https://esample/token",
    "ClientId": "xxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx",
    "ClientSecret": "yyyyy-yyyyy-yyyyy-yyyyy-yyyyyyyyy",
    "GrantType": "credentials",
    "Scope": "scope"
 }

这是 Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
    var identityServerSettingsSection = this.Configuration.GetSection("IdentityServerSettings");
    services.AddIdentityServer()
    // here i need to app those properties from json
}

这是我从 json 文件中读取它们的方法

identityServerSettingsSection.GetValue<string>("ClientId")

提前致谢!

标签: asp.net-coreidentityserver4asp.net-core-identity

解决方案


你可以像这样添加身份服务器

services.AddIdentityServer(Configuration);

哪个配置是 IConfiguration。对于 appsetting.json,请遵循此IdentityServer 选项


推荐阅读