通过CAS Ajax调用CAS、Ajax

2023-09-10 17:01:22 作者:大姨妈红遍了整个床

我需要写一个谷歌小工具,读取谷歌集团饲料。麻烦的是我正在做一个AJAX调用来检索饲料和我们的谷歌应用程序域由CAS(中央认证服务)的保护。所以,我得到一个400错误的请求进行调用。

I need to write a google gadget that reads feeds from google groups. Trouble is I'm making an ajax call to retrieve the feeds and our google apps domain is protected by CAS (central authentication service). So, I'm getting a 400 bad request on making the call.

我怀疑这使得AJAX调用时,浏览器不发送的cookie。 如何确保该Cookie也与Ajax调用发送? 要么 如果这是不应该的问题,我需要什么做的?

I suspect that the browser is not sending the cookie when making ajax call. How do I ensure that the cookie is also sent with the ajax call? OR if that's not supposed to be the problem, what do i need to do?

推荐答案

如果你正在做一个纯香草AJAX调用(用jQuery,至少),请求将失败,如果该域的和子域两者不匹配。也就是说,如果你从 app.mydomain.com 呼吁为 cas.mydomain.com ,请求韩元科技工作。

If you're making a plain-vanilla AJAX call (with jQuery, at least), the request will fail if the domain and subdomain both do not match. That is, if you're calling from app.mydomain.com to cas.mydomain.com, the request won't work.

在我的测试浏览器会发送cookie沿着正确正如你所期望的,甚至在AJAX调用。

In my testing the browser will send cookies along properly as you would expect, even on AJAX calls.

另外,还要确保你使用上的呼叫(应用程序和CAS服务器)的两端具有相同的协议(HTTP或HTTPS)。

Also make sure that you're using the same protocol (HTTP or HTTPS) on both ends of the call (the app and the CAS server).

如果您使用的是萤火虫在Firefox中,你应该看到饼干正在与请求一起发送。如果他们没有出现在那里,别的东西很可能会在你将不得不挖了起来。

If you're using Firebug in Firefox, you should see the cookies being sent along with the request. If they're not showing up there, something else is likely going on that you'll have to dig up.

下面是a类似的问题可能是有益的。