authentication - 在 ASP.NET MVC5 中使用 Steam 登录

标签 authentication asp.net-mvc-5 owin steam

我最近一直在玩 ASP.NET MVC5 和新的 OWIN 身份验证中间件。
我希望我的用户使用他们的 Steam 帐户和密码登录。用户成功登录后,我只需要 Steam 帐户 ID 以进行进一步处理。 Steam 可以充当 OpenId 提供者 as stated in the documentation .

在 MVC4 中,会 implement a custom OpenIdClient .在我看来,在 MVC5 中 OpenIdClient 类已被删除,并且使用 IAppBuilder 类配置身份验证,该类提供了使用 Facebook、Google 和其他预定义提供程序登录的方法。

不幸的是,我找不到任何有关将自定义提供程序插入新身份验证系统的文档。你能给我任何说明或引用吗?

最佳答案

这是对@Buzinas 悬赏的回答。

此解决方案将使用可用的 NuGet 包 Owin Security Providers here .

转到包管理器控制台 ( Tools -> Library Package Manager -> Package Manager Console ) 并安装上述包:

Install-Package Owin.Security.Providers

在您的 App_Start\Startup.Auth.cs添加正确的 using陈述。对于 Steam,您想要
using Owin.Security.Providers.Steam;

旁注,有多个选项可用,因此此软件包不仅适用于 Steam。
Owin.Security.Providers

ConfigureAuth方法,添加 app.UseSteamAuthentication("<<API KEY>>");<<API_KEY>>应替换为您从 Valve 收到的 API key

关于authentication - 在 ASP.NET MVC5 中使用 Steam 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19477524/

相关文章:

c# - Google 的间歇性 ASP.NET oAuth 问题,AuthenticationManager.GetExternalIdentityAsync 返回 null

c# - FormsAuthentication 对象已过时 [使用 MVC5]

c# - 在实现自己的 IUserStore 时,类上的 "optional"接口(interface)实际上是可选的吗?

c# - Jwt token 授权不起作用

authentication - 加密文件并保持方便的最佳方法

authentication - 相互认证 TLS

c# - 未处理的 System.InvalidOperationException 异常会破坏我的 MVC 应用程序吗?

Owin UseStaticFiles 不尊重 RequestPath

java - 如何用Java编写一个非常简单的用户登录代码?

javascript - Passport OAuth 持有者或 isAuthenticated