首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IdentityServer4问题

IdentityServer4问题
EN

Stack Overflow用户
提问于 2016-09-28 19:07:26
回答 1查看 400关注 0票数 0

我正在使用IdentityServer4创建一个web安全性。我通过在控制台管理器中键入以下语法来安装identityserver4包: Install-Package IdentityServer4 -Pre。它安装成功。现在我不能在我的项目中引用它。下面是我安装后的project.json代码:

代码语言:javascript
复制
{
    "webroot": "wwwroot",
    "version": "1.0.0-*",

    "dependencies": {
        "Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
        "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
        "IdentityServer4": "1.0.0-rc1-update2"
    },

    "commands": {
        "web": "Microsoft.AspNet.Hosting --config hosting.ini"
    },

    "frameworks": {
        "dnx451": { },
        "dnxcore50": { }
    },

    "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
    ],
    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ]
}

因此,现在我已经使用以下代码创建了一个客户端类:

代码语言:javascript
复制
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LearningIdentityServer4.OAuth
{
    public class Clients
    {
        public static IEnumerable<Client> Get()
        {
            return new[]
            {
                new Client
                {
                    ClientId = "myApi",
                    ClientSecrets = new List<Secret>
                    {
                        new Secret("secret".Sha256())
                    },
                    ClientName = "My lovely Api",
                    Flow = Flows.ResourceOwner,
                    AllowedScope =
                    {
                        Constants.StandardScope.OpenId,
                        "read"
                    },
                    Enabled = true
                }
            };
        }
    }
}

所以我得到了很多错误。当我将鼠标悬停在第一个客户端上时,我得到的唯一选项是Add Package IdentityServer3 2.1.1

那么,如何引用IdentityServer4而不是IdentityServer3 2.1.1呢

我期待着您的回音。

谢谢,索马德

EN

回答 1

Stack Overflow用户

发布于 2016-09-28 20:53:29

这些框架已经完全过时了。

要使用identityserver4,您需要(至少)依赖于带有一些附加依赖项的netcoreapp 1.0框架。将project.json中的框架替换为以下内容:

代码语言:javascript
复制
"frameworks": {
"netcoreapp1.0": {
  "imports": [
    "dotnet5.6",
    "portable-net45+win8"
  ]
}
},

另请参阅samples。我假设您的工具已经过时,或者您正在重新打开一个旧项目。随着ASP.NET核心的出现,很多东西都改变了。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39745718

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档