Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oAuth ASP.NET Membership Provider

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.

Thanks.

like image 814
Eric Tobia Avatar asked Jul 30 '09 20:07

Eric Tobia


People also ask

How can I use ASP net membership provider?

The ASP.NET membership provider is a feature that enables ASP.NET developers to create Web sites that allow users to create unique user name and password combinations. With this facility, any user can establish an account with the site, and sign in for exclusive access to the site and its services.

How can I use ASP Net Membership in C#?

To create a user in our application by using ASP.NET Membership we need the following steps to complete this process. Step 1: Firstly, open visual studio, then go to File Menu and click New -> Web Site. Step 2: After open the new empty website and add a new item Login. aspx in Registration inside Solution Explorer.

What is OAuth 2.0 in C#?

(Open Authorization) is an open standard for token-based authentication and authorization on the Internet.


2 Answers

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

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

  1. Your application wants to use some of the users data, hosted by a provider (say twitter or google). In which case your application would be a consumer - in short, the user would need to log-in and agree to authorizing your application to have access to the their data on the provider, and you would be given an access token which can be used to gain access to those protected resources.
  2. Alternatively, you have an application, with users who have log-ins etc. And you want to provide (i.e. you're the provider) access to some restricted information of your users to 3rd party applications (consumers) without exposing your users credentials to those services.

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

  • DevDefined.OAuth
  • Madgex OAuth.Net
  • DotNetOpenAuth

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.

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).

like image 58
Bittercoder Avatar answered Oct 13 '22 10:10

Bittercoder


I think you might be looking for DotNetOpenAuth. I haven't used it, so I can't tell you for sure if it includes a membership provider, but I would expect that it does. If not, it's open source, so should help you with what you're trying to do anyway.

like image 6
CoderDennis Avatar answered Oct 13 '22 10:10

CoderDennis