문제

I have recently been playing around with ASP.NET MVC5 and the new OWIN authentication middleware. I want my users to login with their Steam account and password. After a user logs in successfully, I just need the Steam Account Id for further processing. Steam can act as an OpenId Provider as stated in the documentation.

In MVC4 one would implement a custom OpenIdClient. It seems to me that in MVC5 the OpenIdClient class has been removed and authentication is configured using the IAppBuilder class which offers methods to login with Facebook, Google and other predefined providers.

Unfortunately, I haven't been able to find any documentation about plugging a custom provider to the new authentication system. Can you give me any instructions or references?

도움이 되었습니까?

해결책

This is an answer to the bounty that was placed by @Buzinas.

This solution is going to use the NuGet package Owin Security Providers which is available here.

Go to the Package Manager Console (Tools -> Library Package Manager -> Package Manager Console) and install the above package:

Install-Package Owin.Security.Providers

In your App_Start\Startup.Auth.cs add the proper using statement. For Steam, you want

using Owin.Security.Providers.Steam;

Side note, there are several options available, so this package isn't just for Steam. Owin.Security.Providers

In the ConfigureAuth method, add app.UseSteamAuthentication("<<API KEY>>");

<<API_KEY>> should be replaced with the API key you received from Valve

다른 팁

Docs are still a bit sparse. One option is to copy-paste a similar existing provider and adapt as needed.

Recommended way to implement custom authentication provider for owin authentication

https://katanaproject.codeplex.com/SourceControl/latest

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top