oAuth ASP.NET 成员资格提供程序 [英] oAuth ASP.NET Membership Provider

查看:22
本文介绍了oAuth ASP.NET 成员资格提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何推荐的资源来实现使用 oAuth 的自定义成员资格提供程序?目标是让用户使用他们现有的 oAuth 凭据登录到我的 ASP.NET MVC 应用程序.用户通过身份验证后,我想利用内置的 ASP.NET 授权功能.

Are there any recommended resources for implementing a custom membership provider that uses oAuth? The goal would be to have users to log into my ASP.NET MVC application using their existing oAuth credentials. After the user is authenticated, I'd then like to leverage the built-in ASP.NET authorization features.

谢谢.

推荐答案

我不确定您要寻找的是 OAuth.

I'm not sure what you're looking for is OAuth.

OAuth 用于委托授权,通过使用令牌.根据您在做什么,您有两种情况:

OAuth is for delegating authorization, through the use of tokens. Depending on what you're doing you have two scenarios either:

  1. 您的应用程序想要使用由提供商(例如 twitter 或 google)托管的一些用户数据.在这种情况下,您的应用程序将成为消费者 - 简而言之,用户需要登录并同意授权您的应用程序访问提供者上的数据,您将获得一个可以使用的访问令牌以获得对这些受保护资源的访问权限.
  2. 或者,您有一个应用程序,用户具有登录等功能.并且您希望向 3rd 方应用程序(消费者)提供(即您是提供者)对用户的某些受限信息的访问权限,而不会暴露您的用户使用这些服务的凭据.

有关 OAuth 的更多信息 - 查看 OAuth.Net 网站.目前有 3 种 OAuth 实现可用于 .Net.

For more info on OAuth - check out the OAuth.Net website. There are currently 3 implementations of OAuth available for .Net.

由于 OAuth 的工作方式,我真的无法想象您如何拥有OAuth"成员资格提供者——它确实是为了保护 API 的安全,通常目标是在更细粒度的级别上委派授权,即让消费者应用程序只访问用户地址簿数据,而不让他们访问电子邮件档案、他们的日历等——这不适合基于成员资格/角色的安全模型.

Because of the way OAuth works, I can't really imagine how you could have an "OAuth" membership provider - It's really intended for securing API's, and often the goal is to delegate authorization at a more granular level i.e. giving a consumer application access to just a users address book data, without letting them access email archives, their calendar etc. - which doesn't fit well with a membership / role based security model.

我猜您真正要寻找的是 OpenId,即您使用 Stackoverflow 本身进行身份验证的方式.我建议阅读 Stackoverflow 此处的 OpenId 案例研究,可能是最好的 OpenId.Net 的实现目前是 DotNetOpenAuth 项目的一部分(正式名称为 DotNetOpenId,项目的 google 代码站点 在这里).

I'm guessing what you're really looking for is OpenId i.e. the way you authenticate yourself with Stackoverflow itself. I would suggest reading the Stackoverflow OpenId case study here and probably the best OpenId implementation for .Net is currently part of DotNetOpenAuth project (this was formally called DotNetOpenId, the google code site for the project is here).

这篇关于oAuth ASP.NET 成员资格提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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