Difference between revisions of "Single Sign-on with Cookies"

From SDU
Jump to: navigation, search
m
m
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
[[Category:Customizations]]
 
[[Category:Customizations]]
 +
<div align='center'><font color="green">To make corrections or additions to this article, select the ''edit'' tab above.<br>
 +
To discuss or ask questions about this article, select the ''discussion'' tab above.</font></div>
 +
 +
== Overview ==
 
This article provides instructions for adding single sign-on capabilities when ''external authentication'' is not an option. This can be beneficial if PIN is the selected authentication method.
 
This article provides instructions for adding single sign-on capabilities when ''external authentication'' is not an option. This can be beneficial if PIN is the selected authentication method.
  
 
This customization was designed for the r11.x releases, and is untested in older releases.
 
This customization was designed for the r11.x releases, and is untested in older releases.
  
 
+
== Procedures ==
== Step 1. Edit the login.htmpl form ==
+
=== Step 1. Edit the login.htmpl form ===
 
In the login.htmpl file, the following additions are needed. [[Media:single Sign-on with Cookies.zip|Click here]] to download an example login.htmpl file containing all the code provided below.
 
In the login.htmpl file, the following additions are needed. [[Media:single Sign-on with Cookies.zip|Click here]] to download an example login.htmpl file containing all the code provided below.
  
Line 76: Line 80:
 
}
 
}
 
</PDM_IF></source>
 
</PDM_IF></source>
 
  
 
For r11.x releases it is recommended that you edit your pages via the [[Web Screen Painter]]. For older releases you must edit the files directly.
 
For r11.x releases it is recommended that you edit your pages via the [[Web Screen Painter]]. For older releases you must edit the files directly.
  
 
+
=== Step 2. Clear the web cache ===
== Step 2. Clear the web cache ==
+
 
The final step is to clear Service Desk's cache. Publish your changes via the [[Web Screen Painter]]. The process of publishing automatically initiates a [[pdm_webcache]].
 
The final step is to clear Service Desk's cache. Publish your changes via the [[Web Screen Painter]]. The process of publishing automatically initiates a [[pdm_webcache]].
 
 
 
 
 
 
 
 
----
 
<div align='center'><font color="green">To make corrections or additions to this article, select the ''edit'' tab above.<br>
 
To discuss or ask questions about this article, select the ''discussion'' tab above.</font></div>
 

Revision as of 05:06, 26 July 2008

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

This article provides instructions for adding single sign-on capabilities when external authentication is not an option. This can be beneficial if PIN is the selected authentication method.

This customization was designed for the r11.x releases, and is untested in older releases.

Procedures

Step 1. Edit the login.htmpl form

In the login.htmpl file, the following additions are needed. Click here to download an example login.htmpl file containing all the code provided below.

Add the following scripts near the top of the BODY where the other javascripts reside: <source lang="javascript">function createCookie(name,value,days){

if(value != ""){
 n_value=encodeURIComponent(value);
}else{
 n_value = "";
}
if(days){
 var date = new Date();
 date.setTime(date.getTime()+(days*24*60*60*1000));
 var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+n_value+expires+"; path=/";

}

function readCookie(name){

var nameEQ = name + "=";
var b = document.cookie.split(';');
for(var i=0;i < b.length;i++){
 var c = b[i];
 while (c.charAt(0)==' ') c = c.substring(1,c.length);
 if (c.indexOf(nameEQ) == 0){
  d = c.substring(nameEQ.length,c.length);
  if(name == c_name1) g_id = d;
  if(name == c_name2) g_pin = d;
 }
}

}

var c_name1 = "CA_USERNAME", c_name2 = "CA_PIN"; var g_id = "", g_pin = ""; var l_flag = 0; var url_string = String(document.location); var url_array = url_string.split('?'); if(url_array[1]){

f = url_array[1];
// if(f.indexOf("OP=LOGOUT") != -1) window.close(); //Closes window on LOGOUT

}else{

readCookie(c_name1);
readCookie(c_name2);
if(g_id != "" && g_pin != "") l_flag = 1;

} </source>

Replace the USERNAME and PIN input fields in the middle of the form with the two provided below: <source lang="javascript"><input type="text" id="USERNAME" name="USERNAME" size=20 onFocus="this.className='focusField';" onBlur="this.className=;if(this.value != ){createCookie('CA_USERNAME',this.value,1)};"> //ADDED createCookie</source> <source lang="javascript"><input type="password" id="PIN" name="PIN" size=20 onFocus="this.className='focusField';" onBlur="this.className=;if(this.value != ){createCookie('CA_PIN',this.value,1)};"> //ADDED createCookie</source>

Add the following near the bottom of the page: <source lang="javascript"><PDM_IF "$prop.WSPHOST" == "" && "$LoginErrMsg" == ""> if(l_flag == 1){

//If the l_flag is set to 1, USERNAME and PIN is set and a pdm_submit is initiated for an automatic logon
document.forms["login"].SID.value = "0";
document.getElementById("USERNAME").value = g_id;
document.getElementById("PIN").value = g_pin;
pdm_submit('login',);

} </PDM_IF></source>

For r11.x releases it is recommended that you edit your pages via the Web Screen Painter. For older releases you must edit the files directly.

Step 2. Clear the web cache

The final step is to clear Service Desk's cache. Publish your changes via the Web Screen Painter. The process of publishing automatically initiates a pdm_webcache.