【发布时间】:2017-10-23 12:48:29
【问题描述】:
我有 openiddict 示例,但我想改用 JWT。我了解到我不能将 OAuth 与 JWT 一起使用,因为它们是两个不同的东西。有道理。
但是如果我想使用 JWT,那么我需要安装一个不记名令牌中间件包。我相信,对于 .net 核心,是 Microsoft.AspNetCore.Authentication.JwtBearer
但我无法同时使用 openiddict 安装该软件包。是否需要使用特定版本的 JwtBearer 才能使其工作?
我尝试安装时遇到的错误是
Unable to resolve 'OpenIddict (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.
Unable to resolve 'OpenIddict.Mvc (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.
Unable to resolve 'OpenIddict.EntityFrameworkCore (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.
Openiddict 包设置
<!-- OpenIdDict -->
<PackageReference Include="AspNet.Security.OAuth.Validation" Version="1.0.0-*" />
<PackageReference Include="OpenIddict" Version="1.0.0-*" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="1.0.0-*" />
<PackageReference Include="OpenIddict.Mvc" Version="1.0.0-*" />
NuGet 配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="aspnet-contrib" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
</packageSources>
</configuration>
【问题讨论】:
-
错误指出没有找到 myget 或包本身查看 myget 提要,它们确实在其中,版本为:
1.0.0-beta2-0614他们的目标是应该完全兼容的 .netstandard 1.4。AspNet.Security.OAuth.Validation有 1.0.0 绰号,但没有 - 或 * myget.org/gallery/aspnet-contrib 确保您的 Nuget 管理器在过滤器上有 ALL 而不是 Nuget
标签: asp.net-core nuget .net-core jwt openiddict