.net - WCF 身份验证用户 Google/Facebook 等

标签 .net facebook wcf wif

我希望构建一个基本上由核心 WCF 服务组成的 SOA 应用程序。一个 ASP.NET Webforms 前端。并且,可能有多个移动前端。

我想允许我的用户使用他们的 Facebook/Google 凭据登录,这对于如今的 ASP.NET Webforms 应用程序来说非常简单。但是,我也希望移动应用程序使用相同的凭据进行身份验证。

为实现这一点,我希望对 WCF 服务的每次调用都必须使用类似的基于声明的身份验证方法。

搜索了几个小时后,我想知道是否有人可以向我指出一个教程,该教程演示了如何创建/配置 WCF 服务以专门用于 Facebook/Google 基于声明的身份验证。

谢谢 大卫

最佳答案

建议您考虑使用 OAuth 2.0 标准的 Google Accounts Authentication and Authorization。以下链接描述了如何使用 Google API 通过 OAuth 2.0 验证网络服务器应用程序。

The authorization sequence begins when your application redirects a browser to a Google URL; the URL includes query parameters that indicate the type of access being requested. As in other scenarios, Google handles user authentication, session selection, and user consent. The result is an authorization code, which Google returns to your application in a query string.

https://developers.google.com/accounts/docs/OAuth2WebServer

Google API 支持常见的 OAuth 2.0 场景,例如用于网络服务器、已安装和客户端应用程序的场景。

OAuth 2.0 is a relatively simple protocol. To begin, you obtain OAuth 2.0 credentials from the Google Developers Console. Then your client application requests an access token from the Google Authorization Server, extracts a token from the response, and sends the token to the Google API that you want to access.

https://developers.google.com/accounts/docs/OAuth2

可通过以下链接获取适用于 .NET 的 Google API 客户端库以及完整示例: https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth

关于.net - WCF 身份验证用户 Google/Facebook 等,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27843462/

相关文章:

c# - 在 .NET WMQ API 中接收 WebSphere MQ 消息有时会抛出 MQRC_RFH_FORMAT_ERROR

facebook - Facebook 页面的 iframe 高度

c# - WCF 中的调用是同步的吗?

silverlight - ssl、silverlight、wcf 和本地安装

.net - 在WCF中使用KnownType和ServiceKnownType有什么区别?

c# - 以编程方式访问 web.config 的 <compilation/> 部分?

c# - 如何格式化 DateTimeOffset 使其时区偏移量中不包含冒号?

带有页面的 Facebook 测试帐户

c# - 为什么这个正则表达式模式会导致解析器在给定某些输入时挂起?

javascript - 当 angular-ui-router 更改路由时,Facebook 社交插件消失