Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to implement custom authentication provider for owin authentication

I need to authenticate users via LinkedIn, Vkontakte and other social networks that do not have providers yet.

I succeeded creating custom authentication provider in the following way:

  1. Get code for Facebook provider in Katana source code.
  2. Change all "Facebook" to "Vkontakte" (just find&replace).
  3. Customize [provider_name]AuthenticatedContext class, [provider_name]AuthenticationHandler.ApplyResponseChallengeAsync() and [provider_name]AuthenticationHandler.AuthenticateCoreAsync().

Everything works well, but just wondering. Much code is duplicated with no actual change. Is there a way to use any standard stuff for building custom provider, not just copying the files?

like image 632
aleyush Avatar asked Oct 21 '13 08:10

aleyush


1 Answers

Unfortunately not. I also created new providers for LinkedIn and Yahoo and even though I copied much of the code from the Katana project there are little nuances with each provider which means you cannot really use a single code base for all.

BTW, you can check out the LinkedIn and Yahoo providers at http://www.beabigrockstar.com/introducing-the-yahoo-linkedin-oauth-security-providers-for-owin/

like image 133
Jerrie Pelser Avatar answered Oct 21 '22 16:10

Jerrie Pelser