【问题标题】:Safari 5.1 Basic Authentication log out issueSafari 5.1 基本身份验证注销问题
【发布时间】:2013-12-30 23:27:45
【问题描述】:

我在我的站点中启用了基本身份验证。我可以在 IE、Mozilla 和 Chrome 中清除用户凭据,但无法从 Safari 中清除凭据。

我尝试了以下

  1. 调用Ajax请求并将状态码设置为401

  2. 使用 URL 中传递的用户名调用 Ajax 请求:http://invalidUSer@site.com

但是它们都不能正常工作。每当我关闭并打开一个新的 Safari 凭据时,都不会被删除。

下面是sn-p的代码:

在注销页面我有以下脚本:

$.ajax({
    type: "POST",
    contentType: "application/javascript",
    async: true,
    url: "../ClearAuthentication.aspx"
});

在 ClearAuthentication.aspx.vb 中

'Context.Response.Redirect("http://www.test.com", False) ' have tried this both adding and removing
Response.StatusCode = 401
Page.Response.StatusDescription = "Unauthorized"
'Page.Response.AppendHeader("WWW-Authenticate", "Basic realm=""foo""") ' have tried this both adding and removing
Context.Response.End()

【问题讨论】:

    标签: safari basic-authentication logout


    【解决方案1】:

    我们有同样的问题。我们成功完成了以下 hack。这就像一个简单的登录请求,但带有错误的凭据。

    function logout() {
        var request = new XMLHttpRequest();                                        
        request.open("get", "/rest/login", false, user.login, "false");                                                                                                                               
        request.send();                                                            
        window.location.replace("/");
    }
    

    这个解决方案是the question.的最后一个答案

    【讨论】:

      猜你喜欢
      • 2011-05-08
      • 2017-04-03
      • 1970-01-01
      • 2017-11-16
      • 2015-07-22
      • 2013-04-05
      • 1970-01-01
      • 2016-10-03
      • 1970-01-01
      相关资源
      最近更新 更多