06-13-2016 01:18 PM
06-14-2016 04:19 AM
06-14-2016 10:17 AM
// HANDLE UN-AUTHORIZED
if (response.response && response.response.status === 401)
{
// HANDLE LOGOUT
if (config.isLogout) {
if (typeof config.logoutCallback === "function")
{
callbackScope = (config.logoutCallbackScope ? config.logoutCallbackScope : (config.callbackScope ? config.callbackScope : _this));
config.logoutCallback.call(callbackScope, response, config);
}
return;
}
// HANDLE SESSION TIMEOUT
var redirect = response.response.getHeader("Location");
if (redirect)
{
window.location.href = window.location.protocol + "//" + window.location.host + redirect;
return;
}
else
{
window.location.reload(true);
return;
}
}
doLogout: function alfresco_services_LogoutService__doLogout() {
this.serviceXhr({
method: "POST",
url: Alfresco.constants.URL_PAGECONTEXT + "dologout",
isLogout: true,
logoutCallback: function() {
if (Alfresco.constants.CAS_SERVER_LOGOUT_URL) {
window.location.href = Alfresco.constants.CAS_SERVER_LOGOUT_URL;
}
},
callbackScope: this
});
}
<@markup id="alfrescoConstants">
<@inlineScript group="template-common">
<!– Alfresco web framework constants –>
Alfresco.constants = Alfresco.constants || {};
……………
Alfresco.constants.CAS_SERVER_URL = "${casServerUrl}";
Alfresco.constants.CAS_SERVER_LOGOUT_URL = "${casServerLogoutUrl}";
……………
// model items required by resources template
model.preferences = preferences.value;
model.casServerUrl = MyappnameShareConfiguration.getCasServerUrl();
model.casServerLogoutUrl = MyappnameShareConfiguration.getCasServerLogoutUrl();
<bean id="presentationJavascriptCompatibleConfiguration" parent="baseScriptExtension"
class="my.company.myappname.config.PresentationJavascriptCompatibleConfiguration">
<property name="extensionName" value="MyappnameShareConfiguration" /> <!– This defines the name of the javascript object which will be accessible in the webscripts –>
<property name="casServerUrl" value="${casServerUrl}" />
<property name="casServerLogoutUrl" value="${casServerLogoutUrl}" />
</bean>
package my.company.myappname.config;
import org.springframework.extensions.webscripts.processor.BaseProcessorExtension;
public class PresentationJavascriptCompatibleConfiguration extends BaseProcessorExtension {
private String casServerUrl;
private String casServerLogoutUrl;
public String getCasServerUrl() {
return this.casServerUrl;
}
public void setCasServerUrl(String casServerUrl) {
this.casServerUrl = casServerUrl;
}
public String getCasServerLogoutUrl() {
return this.casServerLogoutUrl;
}
public void setCasServerLogoutUrl(String casServerLogoutUrl) {
this.casServerLogoutUrl = casServerLogoutUrl;
}
}
casServerUrl=https://my.company.cas.server:port
casServerLogoutUrl=${casServerUrl}/cas/logout
09-26-2016 09:16 AM
You can just change the Aikau HEADER_USER_MENU_LOGOUT as shown below (share-header.get.js)
var logoutItem = widgetUtils.findObject(model.jsonModel, "id", "HEADER_USER_MENU_LOGOUT");
if (logoutItem != null)
{
logoutItem.config.targetUrl += "?redirectURL=";
logoutItem.config.targetUrl += "https://my.company.cas.serverort/cas/logout";
logoutItem.config.targetUrl += "&redirectURLQueryKey=service&";
logoutItem.config.targetUrl += "redirectURLQueryValue=https://my.company.server/";
}
Of course this does have the redirect locations hard-coded rather than in alfresco-global.properties but it looks like you're able to deal with that.
Note that this will only work for 4.2 (as will your code)
(See GitHub - wrighting/alfresco-cas: A project designed to show how to integrate Alfresco with CAS singl... for details of later versions)
09-26-2016 10:32 AM
Dear Mr. Wrighting,
Will the "redirectURL" parameter make sure that Alfresco will first perform a normal Alfresco logout (clearing of Alfresco session cookies) and it will then do a redirect to my specified URL?
09-26-2016 11:03 AM
Yes, it will.
The 3 redirect parameters get used in the Surf Logout servlet so it logs out of Alfresco first then uses those 3 parameters to construct the URL to forward to.
09-26-2016 11:47 AM
That is very good to know, thank you.
I could not find any information like that in the Alfresco Share documentation, nor in the forums.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.