oauth-2.0 - 使用 Identity Core 颁发不记名 JWT token

标签 oauth-2.0 asp.net-identity asp.net-core-mvc openid-connect aspnet-contrib

我有一个移动应用程序,它使用对 ASP.NET Core api 的 RESTful 调用,而 Angular 2 应用程序也执行 RESTful 调用。我还使用 Identity Core 来验证用户身份 (Identity 3.0)。

我想基于身份框架颁发不记名 token ,并使用资源所有者密码凭证授予对用户进行身份验证(这只是为我的网站提供用户名和密码,它将颁发 token ,因为这是一个受信任的环境)。

  • ASP.NET CORE 1.0 RTM 中是否有简单的配置来执行此操作?
  • AspNet.Security.OpenIdConnect.Server我正在看这个,它看起来像是 OpenIdDict 的较小版本,但作者提到它是针对 Owin/Katana 的,我没有使用任何版本。
  • OpenIdDict是一个执行此操作的框架,但首先它是 Alpha 版本,其次它需要一个单独的网站,这将导致额外的维护和性能损失,以便通过 HTTP 与另一台服务器进行通信。
  • IdentityServer4对于我想要实现的目标来说,它看起来太大了,我不确定它是否与 Identity Core 集成,我只对密码授予感兴趣。看起来它需要一个单独的网站。

如果您能澄清上述几点,并让我知道这些是我唯一的选择还是我遗漏了什么,我将不胜感激。

我不想成为公共(public)身份提供商,我只想为我自己的用户发行 token 。

最佳答案

AspNet.Security.OpenIdConnect.Server I am looking at this one and it looks like a smaller version of OpenIdDict, but the author mentions it is for Owin/Katana, I am not using any.

AspNet.Security.OpenIdConnect.Server(代号 ASOS)实际上并不是“OpenIddict 的较小版本”,而是一个低级 OAuth2/OpenID Connect 服务器框架,您可以使用它来构建自己的服务器框架授权服务器/身份提供商。

它不依赖于任何成员资格堆栈(例如 ASP.NET Core Identity),并且可以虚拟地添加到任何现有环境中。

请注意,虽然有 OWIN/Katana 版本(名为 Owin.Security.OpenIdConnect.Server),但主要部分针对 ASP.NET Core,当然也与 .NET Desktop 和 . NET 核心。

如果您想了解有关此项目的更多信息,我建议您阅读此博客文章系列: http://kevinchalet.com/2016/07/13/creating-your-own-openid-connect-server-with-asos-introduction


OpenIdDict is a framework that does this, but first it is Alpha release and second it requires a separate website which will incur extra maintenance and performance hit to communicate via HTTP to another server.

虽然 OpenIddict 确实仅作为预发布 alpha 版本提供,但在单独的项目中使用它并不是强制性的(甚至也不推荐):您当然可以将其添加到您的主项目中.

由于您正在尝试实现 ROPC 资助,我建议您阅读以下博客文章:

IdentityServer4 which looks too big for what I want to achieve and I am not sure if it integrates with Identity Core and I am only interested in the password grant. And it looks like it requires a separate website.

据我所知,IdentityServer4 尚未提供任何官方 IdSrv/Identity 集成(还没有?),但我很确定社区已经开发了一些桥接器。

关于oauth-2.0 - 使用 Identity Core 颁发不记名 JWT token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38423224/

相关文章:

angular - 如何在 Angular 8 中使用 angular-oauth2-oidc 实现身份验证代码流

ASP.NET 将 DbContext 注入(inject) Identity UserManager

error-handling - 如何判断哪个 Controller 引发了异常

facebook-graph-api - Grails Spring Security如何在自定义身份验证中记住Me?

azure - 机器人生成器 : How to create a bot using OAuth 2 implicit grant flow method in sharepoint

c# - ASP.NET Core Identity 中的两个身份验证 cookie

asp.net-mvc - 在启动/程序设置中设置允许的最大内容长度限制不起作用

c# - 将 COM 对象添加到 Asp Net Core

javascript - Web 前端和 REST API 中的 OAuth2 流程

c# - 使用 Guid 和自定义表名称与 Asp.net Identity 1.1 Alpha 创建自定义实现