inc-librsvcs - [inc-librsvcs] Invoking Shibboleth from Javascript
Subject: InCommon Library Services
List archive
- From: Rich Wenger <>
- To: "" <>
- Subject: [inc-librsvcs] Invoking Shibboleth from Javascript
- Date: Tue, 31 May 2011 15:21:05 -0400
- Accept-language: en-US
- Acceptlanguage: en-US
Hi:
I’m trying to retrofit Shibboleth authentication into an existing web application that was constructed according to a very different model. It is a complex mix of php and _javascript_. I had hoped that I could simply (!) locate one of the required _javascript_
files in the Shib-protected directory and refer to it at run time with JQery’s $.getScript function. There is some sample code on the web here http://stackoverflow.com/questions/912711/jquery-to-load-_javascript_-file-dynamically
and I set this code up as a test case. My expectation was that the load of the code from the protected directory would trigger the Shibboleth authentication cycle, but that does not seem to be the case.
I have this code in https://delisle.mit.edu/geoweb/testload.html (unprotected directory):
<html>
<head>
<title>Example of getScript</title>
<script type="text/_javascript_" src=""jscript/jquery-1.4.1.min.js"></script>
<script type="text/_javascript_">
$(function()
{
$('#loadButton').click(function(){
$.getScript('https://delisle.mit.edu/secure/new.js',function(){
newFun('"Checking new script"');//This is the external function present in new.js
});
});
});
</script>
</head>
<body>
<button type="button" id="loadButton">Load</button>
</body>
</html>
And this code in /secure/new.js: (Shib-protected)
var testVar = 'New JS loaded!';
var testVar = 'New JS loaded!';
alert(testVar);
function newFun(dynParam)
{
alert('You just passed '+dynParam+ ' as parameter.');
}
When I load https://delisle.mit.edu/geoweb/testload.html and click the Load button, I see responses of this kind in the web console:
[14:49:28.381] GET https://delisle.mit.edu/secure/new.js [HTTP/1.1 302 Found 31ms]
but Shibboleth does not intercept the load, and the loaded file does not execute. If I move new.js to some other directory and point to it, it works fine.
Should this work, or does Shibboleth not support this for some reason? Does anybody have a suggestion for a better way to accomplish a Shibboleth authentication cycle from within _javascript_?
Thanks,
Rich Wenger
E-Resource Systems Manager, MIT Libraries
617-253-0035
E-Resource Systems Manager, MIT Libraries
617-253-0035
- [inc-librsvcs] Invoking Shibboleth from Javascript, Rich Wenger, 05/31/2011
Archive powered by MHonArc 2.6.16.