Authentication of OpenId in ASP.NET MVC as a sedative service?

Can I offer authentication, authorization, etc. created using the ASP.NET MVC Open Id extension as a REST service in ASP.NET MVC? How can I create this service (possibly using WCF)? (Please, if you can, offer me some examples, please).

+4
source share
3 answers

Yes, you can. OpenID does not concern authorization of web services in general. This is what OAuth does. But DotNetOpenAuth does both OpenID and OAuth, so your users can authenticate with OpenID and then authorize RESTful clients through OAuth, and the user story is probably exactly what you are looking for.

There is a project template that shows you how to do this (is it really for you), available in the Visual Studio gallery.

+9
source

You can easily create REST services using only MVC. WCF is not required. ASP.NET MVC has a lot of posts about a relaxed architecture.

Code is available with the basic API for Restful services using ASP.NET MVC: http://code.msdn.microsoft.com/MvcWebAPI .

The author of this library has an excellent article explaining how to create a service that can serve both JSON and XML. You can read it at: http://omaralzabir.com/create_rest_api_using_asp_net_mvc_that_speaks_both_json_and_plain_xml/

There are many tools that can help you implement the OpenId service, for example http://www.dotnetopenauth.net/ or the solution described at http://www.west-wind.com/weblog/posts/899303.aspx . You said you already created the OpenId logging system. Basically, take a registration system, create an interface, for example:

public interface IOpenIdService{ bool Login(string login, string password); } 

and execute it in the Action Controller method. If it is a successful return of a JSON or XML message. If this fails, you will receive a JSON or XML error message.

* I also found this article useful for REST with MVC: http://blog.wekeroad.com/2007/12/06/aspnet-mvc-using-restful-architecture/ . Also, if you want to extend the functionality of JSON, take a look at JSON.NET.

+2
source

Check out nerddinner’s latest codeplex tutorial. It has an OpenId integration built into the MVC example application: http://nerddinner.codeplex.com/

0
source

Source: https://habr.com/ru/post/1335300/


All Articles