cancel
Showing results for 
Search instead for 
Did you mean: 

IFRAME and webscripts authentication

dgenard
Champ on-the-rise
Champ on-the-rise
Hi,

I'm developping a component to easily edit associations in document properties pages.
The visual part of the component is an IFRAME showing the myspaces webscript.
I'm having difficulties to transfer user authentication to the content of the IFRAME. The session is lost, so the browser ask for a new BasicAuthentication.
I can transfer the ticket using the alf_ticket url parameter, but it is not reused for other urls produced by the webscript.

How could I transfer the Alfresco authentication to the webscript included in the IFRAME ?

Denis
4 REPLIES 4

mikeh
Star Contributor
Star Contributor
Hi

Use the /alfresco/wcservice servlet instead, which will use Web Client authentication - you can add a "ticket" parameter onto the URL. Previews and links will then work from the MySpaces portlet.

Thanks,
Mike

dgenard
Champ on-the-rise
Champ on-the-rise
It works fine.
Thanks !

Denis

robertoroberto
Champ in-the-making
Champ in-the-making
It works but lost ticket and redirect to login come operations.

manjunathab
Champ in-the-making
Champ in-the-making

Using below code ... but still taking to login scree.

var self = this;var ticket;var xmlHttpReq = false;
// Mozilla/Safari
if (window.XMLHttpRequest) {self.xmlHttpReq = new XMLHttpRequest();}
// IE
else if (window.ActiveXObject) {self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");}
self.xmlHttpReq.open("GET", "http://blrkec335927d:8080/alfresco/wcservice/api/login?u=admin&pw=admin", true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'json');
self.xmlHttpReq.setRequestHeader('X-Alfresco-Remote-User', 'admin');
xmlHttpReq.onreadystatechange = function() {//Call a function when the state changes.
alert(xmlHttpReq.status);
if (xmlHttpReq.readyState == 4 && xmlHttpReq.status == 200)
{ var xml = xmlHttpReq.responseXML;
var getticket = xml.getElementsByTagName("ticket");
ticket = getticket[0].childNodes[0].nodeValue
var url1 = "http://blrkec335927d:8080/alfresco/wcservice/ui/myspaces?f=0&p=%2FCompany%20Home&alf_ticket="+ticket;
var aa='';
document.getElementById('uploaddoc').innerHTML = aa;
}
}
self.xmlHttpReq.send();

${label['ALFRESCO_DOCUMENT']}