使用Azure ACS时无法从Active Directory注销

Ant*_*hev 5 azure single-sign-on adfs2.0 acs asp.net-mvc-4

我在我的MVC 4应用程序中使用ACS 2.0.

它已配置为登录,它适用于各种提供程序,包括ADFS.我需要实现注销功能.

由于这个问题已经过时,我使用了这些示例中的代码:

这是它的样子:

    // Load Identity Configuration 
    FederationConfiguration config = FederatedAuthentication.FederationConfiguration;

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

    // Read the ACS Ws-Federation endpoint from web.Config 
    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();

    var signoutUrl = signoutRequestMessage.WriteQueryString();
Run Code Online (Sandbox Code Playgroud)

结果,我得到了我应该重定向的注销URL,它将处理令牌并将我发送回去.URL如下所示:

https://myacsnamespace.accesscontrol.windows.net/v2/wsfederation?wa=wsignout1.0&wreply=http%3a%2f%2flocalhost%3a61192%2f&wtrealm=http%3a%2f%2flocalhost%3a61192%2f
Run Code Online (Sandbox Code Playgroud)

因此,它可以像Google,Yahoo和Microsoft帐户一样正常运行.当我退出并尝试访问受保护区域时,我会获得一个身份提供商列表,即使我选择了相同的提供商,我也必须再次登录.

但是,当我使用ADFS提供程序时,它的工作原理如下:

  • 我点击退出并进入可用提供商的页面

  • 我再次选择ADFS提供程序

  • 我用旧的AD凭据到达保护区

  • 如果我将ADFS作为唯一的提供者,则跳过上面的步骤2,并且我一直在不加入登录而无法更改用户.

当我看到会发生什么时,ACS不会处置它从ADFS获得的安全令牌,并重新使用它.

您是否有任何关于如何强制ACS处理此令牌的线索?

提前致谢!

rob*_*ich 0

@ore​​n-melzer 的答案+1:浏览器缓存 http 基本凭据并自动重新发送它们。要么转向表单身份验证(使用 cookie),要么在注销时,明确拒绝浏览器的身份验证标头,不断返回 401。有时这种“有效凭据返回 401”可以清除浏览器,有时您只需要求用户关闭浏览器。