Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Perform the following steps to enable the Auto Log-on feature for the Child App:

  1. Select the SSO provider for your Parent and Child apps. For example, ARX.

Note: The steps in this document have been explained by using a sample property file - ARXTicketValidationStatus.properties file as the ARX SSO provider. The properties file contains the following details:

The SSO provider selected by you will replace this dummy properties file.

  1. Read the services offered by the SSO provider and select the services that you want for your Parent and Child Apps.
  2. Create a custom authentication provider by implementing the Java 'Interface' - IAuthenticationServiceProvider.
  3. Mention the authentication provider to Canvas framework by providing a value for the AUTH_SERV_PROV_CLASS key in the securityconfig.properties file.

Here, CTAutoLoginAuthenticationProvider.java is the custom authentication provider file created for the ARX SSO.
# This is the default authentication provider that is to be used during Login / logout / re-authentication purposes
AUTH_SERV_PROV_CLASS=com.intellectdesign.modelhouse.CTAutoLoginAuthenticationProvider
Note:

  • Please refer the CTAutoLoginAuthenticationProvider.java file in the Auto Log-on Feature zip folder for the sample implementation of the ARX SSO.
  • You will be using a real SSO provider and therefore, you must properly read and understand the SSO services and consume it accordingly instead of reading and writing the dummy properties file.
  1. A few changes are required in the Parent and Child Apps' JavaScript files to retrieve and set the armor cookie. Sample codes with respect to the CTAutoLoginAuthenticationProvider.java file and the ARX SSO provider - ARXTicketValidationStatus.properties file is provided for your reference.
  • In the Parent App's Hybrid.js file, add the following methods:
  1. getArmorTicket() – This method retrieves the armor cookie from the Parent App for the Parent App server.

function getArmorTicket(armorSuccessCallBack) {
cookieMaster.getCookieValue(localStorage.getItem("appUrl"),'ArmorTicket',function(cookie) {
armorSuccessCallBack.apply(this, [cookie.cookieValue]);
},function(error) {
if(error) {
console.log('error: '+ error);
}
});
}

  1. setArmorTicket() – This method sets the retrieved armor cookie to the Child App server.


function setArmorTicket() {
var armorTicket = localStorage.getItem("ArmorTicket");
cookieMaster.setCookieValue(localStorage.getItem("appUrl"),'ArmorTicket', armorTicket,function() {
console.log('Armor cookie has been set');
},function(error) {
console.log('Error setting cookie: '+ error);
});
}

  1. launchChildApp() – This method launches the Child App.


function launchChildApp() {
if(!cbx.isEmpty(iportal.workspace.metadata.getCurrentWorkspaceId())) {
localStorage.setItem("Parent_WSID", iportal.workspace.metadata.getCurrentWorkspaceId());
var strUrl ="http://172.19.32.28:9080/ctmodelhouse/";
localStorage.setItem("appUrl", strUrl);
setArmorTicket();
window.location ="www/CTHome.html";
}
}

  • In the Child App's Hybrid.js, add the following methods:
  1. getArmorTicket() - This method retrieves the armor cookie from the Child App for the Child App server.

function getArmorTicket(armorSuccessCallBack) {
cookieMaster.getCookieValue(localStorage.getItem("appUrl"),'ArmorTicket',function(cookie) {
armorSuccessCallBack.apply(this, [cookie.cookieValue]);
},function(error) {
if(error) {
console.log('error: '+ error);
}
});
}

  1. setArmorTicket() - This method sets the retrieved armor cookie to the Parent App server.


function setArmorTicket() {
var armorTicket = localStorage.getItem("ArmorTicket");
cookieMaster.setCookieValue(localStorage.getItem("appUrl"),'ArmorTicket', armorTicket,function() {
console.log('Armor cookie has been set');
},function(error) {
console.log('Error setting cookie: '+ error);
});
}

  1. launchParentApp() - This method launches the Parent App.


function launchParentApp(){
var strUrl ="http://172.19.32.38:9080/ctmodelhouse/";
localStorage.setItem("appUrl",strUrl);
setArmorTicket();
window.location ="../../www/CTHome.html";
}
Note: If the Parent and Child Apps are both built on different versions of Canvas framework and if both the apps use the same context root, for example 'ctmodelhouse', the SQLite database name for both Parent and Child App will be 'CTM' in the CTRIA framework. This will lead to overriding of Parent App metadata with the metadata of the Child Apps and vice versa due to which there will be inconsistency in the data loaded offline. To avoid this provide a different name instead of 'CTM' for the Child App SQLite database.

  • No labels