Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

    Note

    The procedure is explained by using a sample property file called ARXTicketValidationStatus.properties file as the ARX SSO provider.

    This property file contains the following details:

    Code Block
    languagebash
    #Mon Jun 12 11:54:34 IST 2017
    STATUS=SUCCESS
    SHOULDLOGINTOARX=true
    USERPIN=canvas
    ARMORTICKET=919874-RO9NL
    LOGINID=terrim

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


  2. Read the services offered by the SSO provider and select the services that you want for your Parent and Child Apps.
  3. Create a custom authentication provider by implementing the Java Interface, IAuthenticationServiceProvider.
  4. 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.

    Code Block
    languagebash
    # The following key indicates the default authentication provider that is to 
    # be used during log-in, log-out or re-authentication purposes.
    AUTH_SERV_PROV_CLASS=com.intellectdesign.modelhouse.CTAutoLoginAuthenticationProvider


    Note
    • 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.


  5. 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.

    1. 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.

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


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

        Code Block
        languagejs
        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);
        				});
        }


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

        Code Block
        languagejs
        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";
        	}
        }


    2. 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.

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


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

        Code Block
        languagejs
        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);
        				});
        }


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

        Code Block
        languagejs
        function launchParentApp()
        {
        	var strUrl ="http://172.19.32.38:9080/ctmodelhouse/";
        	localStorage.setItem("appUrl",strUrl);
        	setArmorTicket();
        	window.location ="../../www/CTHome.html";
        }


...