Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Overcome Cross-domain Issues for Ajax Calls to CAS-protected Resources?

What are potential solutions to a redirection problem that occurs when trying to make AJAX calls to a CAS-protected, SSL-encrypted resource located on a server different from the CAS server?

The CAS server is used for authentication and behaves as designed. This issue appears to be ajax-specific.

There is a similar question here, but we cannot use the same domain/server/port for the CAS server and the backend resource.

The JASIG CAS mailing lists mentions using JSESSIONID.

Another possible approach is to modify the CAS Filter to change the expired-ticket default behavior to something more robust.

What design pattern would you use to overcome this issue?

like image 777
Jon Jaroker Avatar asked Apr 08 '11 02:04

Jon Jaroker


People also ask

How to allow cross domain ajax request?

For a successful cross-domain communication, we need to use dataType “jsonp” in jquery ajax call. JSONP or “JSON with padding” is a complement to the base JSON data format which provides a method to request data from a server in a different domain, something prohibited by typical web browsers.

What is crossDomain in ajax?

CORS is a mechanism that defines a procedure in which the browser and the web server interact to determine whether to allow a web page to access a resource from different origin. Figure 2. Cross domain ajax request. When you do a cross-origin request, the browser sends Origin header with the current domain value.

Are ajax calls blocking?

ajax has async property. If you set it to false it will block. possible duplicate of Synchronous calls with jquery -- you cannot block the runtime without blocking the browser though. And you cannot return the response from the callbacks, you have to assign it to a variable and return that one from the actual function.


1 Answers

I have 2 suggestions:

  • can you set up a proxy script on the same domain as the one that holds the JS code? That way the proxy script would query the CAS and return desired results
  • can you enable JSONP? this type of request is not limited by the security policy (but then anyone could use the service)
like image 120
Lucian2k Avatar answered Oct 05 '22 15:10

Lucian2k