简体   繁体   English

具有 WWW-Authenticate 标头的同源和 CORS

[英]Same origin and CORS with WWW-Authenticate header

I have a digest authenticate implemented on my application server, in my client, i make a get http request and my server returns the WWW-Authenticate header, with this header in my javascript i do the digest challenge and send it to the server.我在我的应用程序服务器上实现了摘要身份验证,在我的客户端中,我发出一个 get http 请求,我的服务器返回 WWW-Authenticate 标头,在我的 javascript 中使用这个标头,我执行摘要质询并将其发送到服务器。 Everything is ok because i'm testing with CORS, the server and the client aren't in the same origin (all the policies with the Allow headers is running ok).一切正常,因为我正在使用 CORS 进行测试,服务器和客户端不在同一来源(所有带有 Allow 标头的策略都运行正常)。 But my problem is when i test it in a same origin context.但我的问题是当我在同一个源上下文中测试它时。 The browser catch the response of the server and put the typical login window, but i don't want the browser do it.浏览器捕获服务器的响应并放置典型的登录窗口,但我不希望浏览器这样做。

Anyone know why in the same origin the Browser catch it and paint the window?任何人都知道为什么浏览器会在同一个来源中捕获它并绘制窗口? It'll be avoid somehow?它会以某种方式避免吗?

Like in this link , the problem haven't a good solution.就像在这个链接中一样,问题没有很好的解决方案。 Maybe changing the 401 unauthorized code the browser don't catch and pop up the window.也许更改浏览器没有捕获并弹出窗口的 401 未经授权的代码。

There is a discussion on code.google in this link , talking about the solution of firefox with the xhr.mozBackgroundRequest = true, but without a solution in Chrome.这个链接中有一个关于code.google的讨论,讨论了xhr.mozBackgroundRequest = true的firefox的解决方案,但在Chrome中没有解决方案。

I'll change the 401 for another code or i'll change the WWW-Authenticate header for another custom header.我将为另一个代码更改 401,或者我将更改另一个自定义标头的 WWW-Authenticate 标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM