如何在 ASP.NET MVC 5 和 WEB API 2 中实现 oauth2 服务器 [英] How to implement oauth2 server in ASP.NET MVC 5 and WEB API 2

查看:21
本文介绍了如何在 ASP.NET MVC 5 和 WEB API 2 中实现 oauth2 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先我要勾画我的项目:

First I'll sketch my project:

在实习期间,我需要向现有系统添加功能.一旦用户通过 OAuth2 授权,第 3 方客户端必须能够访问来自 AX Webservices 的数据.我知道我需要制作一个代理网络服务",客户端可以在其中进行调用并调用 AX 服务,但我对 OAuth2 部分有点不确定.大多数教程和指南都是关于将 ASP.NET 的身份用于 Facebook 或 Google 登录.我不需要那个,我需要使用现有的凭据,所以我需要制作自己的 OAuth2 服务.

For my internship I need to add functionality to an existing system. A 3rd party client must be able to access data from AX Webservices once he is authorised by the user via OAuth2. I understand that I need to make a 'proxy web service' whereto the client can make its calls and that calls the AX services but I am a bit unsure about the OAuth2 part. Most tutorials and guides are about using ASP.NET's Identity for Facebook or Google-logins. I do not need that, I need to use existing credentials so I need to make my own OAuth2 service.

我发现很难找到这方面的教程、指南或解释.我了解OAuth2以及需要做什么,但我以前从未做过这样的事情,并且很难开始.我发现的最接近我需要的是这个 github repo link,但解决方案没有构建.

I find it hard to find tutorials, guides or explanations on this. I understand OAuth2 and what needs to be done, but I have never done such a thing before and find it hard to start. The closest thing to what I need that I found is this github repo link, but the solution does not build.

我的想法是制作一个 ASP.NET MVC 网站,客户(第 3 方)可以在其中注册自己并获取他们的客户 ID.使用 ASP.NET API,我想创建采用所需令牌和参数的 API,然后访问 Dyn AX 服务.

What I had in mind is making an ASP.NET MVC Website where clients (3rd parties) can register themselves and acquire their Client ID's. With ASP.NET API I wanted to create the API that take the required tokens and parameters, and then access the Dyn AX services.

这是正确的还是我完全错了?任何有关构建您自己的 oauth2 服务器/服务的帮助或链接都会很好.

Is this correct or am I entirely wrong? Any help or links regarding building your own oauth2 server/service would be nice.

推荐答案

Taiseer Joudeh 有一篇精彩的博客文章,其中包含详细的步骤-分步说明.

There is a brilliant blog post from Taiseer Joudeh with a detailed step-by-step description.

  1. 第 1 部分:使用 ASP.NET Web API 2、Owin 和 Identity 的基于令牌的身份验证
  2. 第 2 部分:使用 ASP.NET Web API 2、Owin 和 Identity 的 AngularJS 令牌身份验证
  3. 第 3 部分:使用 ASP .NET Web API 2 和 Owin 在 AngularJS 应用程序中启用 OAuth 刷新令牌
  4. 第 4 部分:ASP.NET Web API 2 在 AngularJS 应用程序中使用 Facebook 和 Google 进行外部登录
  5. 第 5 部分:解耦来自资源服务器的 OWIN 授权服务器

这篇关于如何在 ASP.NET MVC 5 和 WEB API 2 中实现 oauth2 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆