Facebook 在使用Azure';什么是ACS?

Facebook 在使用Azure';什么是ACS?,facebook,oauth,azure,openid,acs,Facebook,Oauth,Azure,Openid,Acs,说我必须提供一个明确的注销链接,但我无法让它工作 我的目标是将我的应用程序从整个Facebook体验环境的用户Facebook注销,或者两者都注销。到目前为止,这些我都做不到 这可能会因为我使用的是Azure ACS而不是典型的FB API而变得复杂。我尝试过的事情包括: 尝试2:ACS注销(未记录?) 这两种方法都不允许备用Facebook用户登录。任何链接将不胜感激 简化问题 如何使*.accescontrol.windows.net重定向回我的网站 正如这篇文章所建议的:,您可以创建一个

说我必须提供一个明确的注销链接,但我无法让它工作

我的目标是将我的应用程序从整个Facebook体验环境的用户Facebook注销,或者两者都注销。到目前为止,这些我都做不到

这可能会因为我使用的是Azure ACS而不是典型的FB API而变得复杂。我尝试过的事情包括:

尝试2:ACS注销(未记录?)

这两种方法都不允许备用Facebook用户登录。任何链接将不胜感激

简化问题

如何使*.accescontrol.windows.net重定向回我的网站


正如这篇文章所建议的:,您可以创建一个自定义的注销按钮,只需单击该按钮即可调用ederatedAuthentication.WSFederationAuthenticationModule.SignOut方法。ACS然后应该为您处理注销过程。

一般来说,联邦注销有两个或三个步骤-在本地您需要删除表单验证cookie。如果使用了表单验证cookie以及FIM cookie,这将从本地应用程序注销

然后,您需要向使用的STS发出wasignoutcleanup10请求,这将使您从STS本身注销,理论上,应该向流程中涉及的所有其他IP发出wasignoutcleanup1.0请求(或等效请求)(STS应跟踪每个请求所联系的IP)

我曾经使用Windows身份基础构建了这样的场景,它具有所需的组件,但是它确实需要一些开发来跟踪所有的IPS并发出调用。


我怀疑ACS目前不支持这种行为,这意味着用户必须关闭浏览器才能从所有应用程序完全注销。

2012年12月的ACS更新包括对联邦单一注销的支持:

使用WS-Federation协议。使用ACS的Web应用程序 使用身份提供程序启用单点登录(SSO) WS-Federation协议现在可以利用单一注销 能力。当用户注销web应用程序时,ACS可以 自动将用户注销身份提供程序并注销 使用相同身份提供程序的其他依赖方应用程序

此功能可用于WS-Federation标识提供程序,包括 Active Directory联合身份验证服务2.0和Windows Live ID (Microsoft帐户)。要启用单点注销,ACS将执行 WS-Federation协议终结点的以下任务:

  • ACS识别来自身份提供程序的wsignoutcleanup1.0消息 并通过向依赖方发送wsignoutcleanup1.0消息进行响应 应用程序

  • ACS识别来自依赖方的wsignout1.0和wreply消息 应用程序并通过向identity发送wsignout1.0消息进行响应 提供程序和发送给依赖方的wsignoutcleanup1.0消息 应用程序

从中,执行以下操作以从ACS注销:

(注意Windows身份基础现在被并入.NET 4.5框架中,这就是为什么下面的新命名空间)

使用System.IdentityModel.Services;
使用System.IdentityModel.Services.Configuration;
公共操作结果注销()
{
//负载标识配置
FederationConfiguration配置=FederatedAuthentication.FederationConfiguration;
//从WsFederationConfiguation节获取wtrealm
字符串wtrealm=config.WsFederationConfiguration.Realm;
绳套;
//从wtrealm构造wreply值(这将是应用程序的返回URL)
如果(wtrealm.Last().Equals('/'))
{
wreply=wtrealm+“注销”;
}
其他的
{
wreply=wtrealm+“/Logout”;
}
//从web.Config读取ACS Ws-Federation端点
//类似于“https://.accesscontrol.windows.net/v2/wsfederation"
字符串wsFederationEndpoint=ConfigurationManager.AppSettings[“ida:Issuer”];
SignOutRequestMessage SignOutRequestMessage=新的SignOutRequestMessage(新Uri(wsFederationEndpoint));
signoutRequestMessage.Parameters.Add(“wreply”,wreply);
signoutRequestMessage.Parameters.Add(“wtrealm”,wtrealm);
FederatedAuthentication.SessionAuthenticationModule.SignOut();
string signoutUrl=signoutRequestMessage.WriteQueryString();
返回此。重定向(signoutUrl);
}

该代码使FAM cookie过期,但不执行重定向到提供程序。。。好吧,至少在我的设置中不是这样的,它基于示例MVC本地表单签名插入,例如
GET
to/Logout不再有效。。。
 "http://www.facebook.com/logout.php?api_key={0}&;session_key={1}";
 // I don't know how to get the session key.  I attempted the values stored in 
 // the claim  "http://www.facebook.com/claims/AccessToken" but no luck
https://tlsadmin.accesscontrol.windows.net/v2/wsfederation?wa=wsignoutcleanup1.0 
using System.IdentityModel.Services;
using System.IdentityModel.Services.Configuration;

public ActionResult Logout()
{
    // Load Identity Configuration
    FederationConfiguration config = FederatedAuthentication.FederationConfiguration;

    // Get wtrealm from WsFederationConfiguation Section
    string wtrealm = config.WsFederationConfiguration.Realm;
    string wreply;

    // Construct wreply value from wtrealm (This will be the return URL to your app)
    if (wtrealm.Last().Equals('/'))
    {
        wreply = wtrealm + "Logout";
    }
    else
    {
        wreply = wtrealm + "/Logout";
    }

    // Read the ACS Ws-Federation endpoint from web.Config
    // something like "https://<your-namespace>.accesscontrol.windows.net/v2/wsfederation"
    string wsFederationEndpoint = ConfigurationManager.AppSettings["ida:Issuer"];

    SignOutRequestMessage signoutRequestMessage = new SignOutRequestMessage(new Uri(wsFederationEndpoint));

    signoutRequestMessage.Parameters.Add("wreply", wreply);
    signoutRequestMessage.Parameters.Add("wtrealm", wtrealm);

    FederatedAuthentication.SessionAuthenticationModule.SignOut();

    string signoutUrl = signoutRequestMessage.WriteQueryString();

    return this.Redirect(signoutUrl);
}