Move casajar files to common
This commit is contained in:
43
extensions/common/casajar/content/about.xul
Normal file
43
extensions/common/casajar/content/about.xul
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<window class="dialog"
|
||||
title="Novell CASA"
|
||||
orient="vertical"
|
||||
autostretch="always"
|
||||
onload="sizeToContent()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Original template -->
|
||||
|
||||
<groupbox align="center" orient="horizontal">
|
||||
<vbox>
|
||||
<image src="chrome://casa/skin/casa-logo.png"/>
|
||||
<separator class="thin"/>
|
||||
<separator class="thin"/>
|
||||
<separator class="thin"/>
|
||||
<hbox>
|
||||
<text value="Created By:" style="font-weight: bold;"/>
|
||||
<vbox>
|
||||
<text value=" CSL Manojna [smanojna@novell.com]"/>
|
||||
<text value=" Jim Norman [jnorman@novell.com]"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<hbox>
|
||||
<text value="Home Page:" style="font-weight: bold;"/>
|
||||
<text value=" www.novell.com" class="url"
|
||||
onclick="window.open('http://www.novell.com/'); window.close();"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
</vbox>
|
||||
<!--
|
||||
<spring flex="1"/>
|
||||
-->
|
||||
</groupbox>
|
||||
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<button label="Close" oncommand="window.close();"/>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
370
extensions/common/casajar/content/casaOverlay.js
Normal file
370
extensions/common/casajar/content/casaOverlay.js
Normal file
@@ -0,0 +1,370 @@
|
||||
// This is our javascript, which will pop up our message
|
||||
// in an alert box.
|
||||
|
||||
var bGlobalPrompt = 'true';
|
||||
var consoleService = null;
|
||||
|
||||
function logMessage(message)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (consoleService == null)
|
||||
{
|
||||
consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
||||
.getService(Components.interfaces.nsIConsoleService);
|
||||
}
|
||||
|
||||
consoleService.logStringMessage("CASA: " + message +"\n");
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function websso()
|
||||
{
|
||||
logMessage("PAGE LOADED");
|
||||
var url = window._content.location.host;
|
||||
var enabledsite = "no";
|
||||
var ssosite = "no";
|
||||
var fileindex = 0;
|
||||
var obj = null;
|
||||
|
||||
if (url == null || url.length < 1)
|
||||
{
|
||||
logMessage("Host URL not found");
|
||||
return;
|
||||
}
|
||||
|
||||
// reset loginprompt
|
||||
bGlobalPrompt = 'true';
|
||||
|
||||
var para=window._content.document.getElementsByTagName("input");
|
||||
|
||||
for (var j = 0; !(j >= para.length) ; j++)
|
||||
{
|
||||
if((para.item(j).type == "password"))
|
||||
{
|
||||
ssosite = "yes";
|
||||
}
|
||||
}
|
||||
|
||||
if (ssosite == "yes")
|
||||
{
|
||||
//alert('password field found');
|
||||
var secretId = url;
|
||||
var sKey = "";
|
||||
//var theValue;
|
||||
var bAutoLogin = false;
|
||||
|
||||
//bGlobalPrompt = false;
|
||||
try {
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
//alert('test2');
|
||||
const cid = "@novell.com/CASA/MiCASAKeys;1";
|
||||
if (obj == null)
|
||||
{
|
||||
obj = Components.classes[cid].createInstance();
|
||||
//alert('test3');
|
||||
obj = obj.QueryInterface(Components.interfaces.IMiCASAKeys);
|
||||
//alert(obj);
|
||||
}
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
logMessage(err);
|
||||
}
|
||||
|
||||
var theValue = new String;
|
||||
var res;
|
||||
|
||||
// does config allow sso for this site?
|
||||
|
||||
try
|
||||
{
|
||||
res = obj.miCASAReadKey(secretId, 'Config.DoNotSave', theValue);
|
||||
if (res == 0)
|
||||
{
|
||||
if (theValue.value == 'true')
|
||||
{
|
||||
logMessage('Config does not allow SSO for this url');
|
||||
window.removeEventListener("submit",promptuser,true) ;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
logMessage(err);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// looping for inputs and setting the correct values
|
||||
for (var j = 0; !(j >= para.length) ; j++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if((para.item(j).type == "text") || (para.item(j).type == "password"))
|
||||
{
|
||||
//alert(test);
|
||||
sKey = para.item(j).name;
|
||||
logMessage('Getting: ' + secretId + ':' + sKey);
|
||||
|
||||
theValue = new String;
|
||||
res = obj.miCASAReadKey(secretId, sKey, theValue);
|
||||
|
||||
if (res == 0)
|
||||
{
|
||||
var ele = window._content.document.getElementsByName(sKey);
|
||||
if (ele != null)
|
||||
{
|
||||
ele[0].value = theValue.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
//alert(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
res = obj.miCASAReadKey(secretId, 'autologin', theValue);
|
||||
if (theValue.value == 'true')
|
||||
{
|
||||
logMessage('Autologin begins');
|
||||
window._content.document.forms[0].submit();
|
||||
}
|
||||
}
|
||||
catch (err1)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function promptuser()
|
||||
{
|
||||
var username = "";
|
||||
var password = "";
|
||||
var bIsLogin = 'false';
|
||||
var sPromptURL = "chrome://casa/content/prompt.xul?";
|
||||
var ele=window._content.document.getElementsByTagName("input");
|
||||
var secretID = window._content.location.host;
|
||||
|
||||
if (bGlobalPrompt != 'true')
|
||||
{
|
||||
bGlobalPrompt = 'true';
|
||||
return;
|
||||
}
|
||||
|
||||
sPromptURL = sPromptURL + "secretid=" + secretID;
|
||||
|
||||
for (i = 0; !(i>= ele.length); i++)
|
||||
{
|
||||
|
||||
if((ele.item(i).type == "password"))
|
||||
{
|
||||
bIsLogin = 'true';
|
||||
password = ele.item(i).value;
|
||||
sPromptURL = sPromptURL + "&" + ele.item(i).name + "=" + ele.item(i).value;
|
||||
|
||||
// don't prompt user if password field is the same
|
||||
try
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const cid = "@novell.com/CASA/MiCASAKeys;1";
|
||||
|
||||
//if (obj == null)
|
||||
{
|
||||
obj = Components.classes[cid].createInstance();
|
||||
obj = obj.QueryInterface(Components.interfaces.IMiCASAKeys);
|
||||
}
|
||||
|
||||
//alert("Reading");
|
||||
var theValue = new String;
|
||||
var res;
|
||||
try
|
||||
{
|
||||
res = obj.miCASAReadKey(secretID, ele.item(i).name, theValue);
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
res = -803;
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
{
|
||||
if (theValue.value == ele.item(i).value)
|
||||
{
|
||||
bIsLogin = 'false';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (err) {
|
||||
bIsLogin = 'false';
|
||||
}
|
||||
|
||||
//bIsLogin = 'true';
|
||||
}
|
||||
else if((ele.item(i).type == "text"))
|
||||
{
|
||||
username = ele.item(i).value;
|
||||
sPromptURL = sPromptURL + "&" + ele.item(i).name + "=" + ele.item(i).value;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsLogin == 'true')
|
||||
{
|
||||
//if (confirm("Save credentials in CASA?"))
|
||||
{
|
||||
var properties = "modal=yes,status=no,titlebar=no,toolbar=no,menubar=no,location=no,height=100,width=100";
|
||||
var win = window.open(sPromptURL, null, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function centerPrompt()
|
||||
{
|
||||
var sh = screen.height;
|
||||
var sw = screen.width;
|
||||
|
||||
sizeToContent();
|
||||
|
||||
var contentheight = window.innerHeight;
|
||||
var contentwidth = window.innerWidth;
|
||||
|
||||
window.moveTo((sw-contentwidth)/2 , (sh-contentheight)/2);
|
||||
}
|
||||
|
||||
|
||||
function closeWin()
|
||||
{
|
||||
var secretID = "";
|
||||
var sKey = "";
|
||||
var sValue = "";
|
||||
|
||||
var url = document.location.toString();
|
||||
var params = url.substring(url.indexOf('?')+1).split('&');
|
||||
|
||||
var remember = document.getElementById("CASA.RememberMe");
|
||||
var autologin = document.getElementById("CASA.RemAndLogin");
|
||||
var never = document.getElementById("CASA.Never");
|
||||
|
||||
try
|
||||
{
|
||||
//alert('test1');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
//alert('test2');
|
||||
const cid = "@novell.com/CASA/MiCASAKeys;1";
|
||||
//if (obj == null)
|
||||
{
|
||||
obj = Components.classes[cid].createInstance();
|
||||
//alert(obj);
|
||||
obj = obj.QueryInterface(Components.interfaces.IMiCASAKeys);
|
||||
//alert(obj);
|
||||
}
|
||||
|
||||
} catch (err)
|
||||
{
|
||||
logMessage(err);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the secretID (url host)
|
||||
for (var i = 0; !(i > params.length - 1); i++)
|
||||
{
|
||||
sKey = params[i].substring(0, params[i].indexOf('='));
|
||||
sValue = params[i].substring(params[i].indexOf('=')+1);
|
||||
|
||||
if (sKey == "secretid")
|
||||
{
|
||||
secretID = sValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//alert(never.selected);
|
||||
|
||||
if (never.selected)
|
||||
{
|
||||
try
|
||||
{
|
||||
res = obj.miCASAWriteKey(secretID, 'Config.DoNotSave', 'true');
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
//alert(err);
|
||||
}
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (remember.selected || autologin.selected)
|
||||
{
|
||||
// save each key-value
|
||||
var res;
|
||||
for (i = 0; !(i > params.length - 1); i++)
|
||||
{
|
||||
sKey = params[i].substring(0, params[i].indexOf('='));
|
||||
sValue = params[i].substring(params[i].indexOf('=')+1);
|
||||
|
||||
if (sKey == "secretid")
|
||||
{
|
||||
//alert('do nothing');
|
||||
}
|
||||
else
|
||||
{
|
||||
logMessage('Writing ' + secretID + ' : ' + sKey + ' : xxxxxxx');
|
||||
try {
|
||||
res = obj.miCASAWriteKey(secretID, sKey, sValue);
|
||||
if (res != 0)
|
||||
logMessage('Error saving key');
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
logMessage(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (autologin.selected)
|
||||
{
|
||||
//alert(" set autologin flag ");
|
||||
res = obj.miCASAWriteKey(secretID, 'autologin', 'true');
|
||||
}
|
||||
else
|
||||
{
|
||||
res = obj.miCASAWriteKey(secretID, 'autologin', 'false');
|
||||
}
|
||||
}
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
function cancelWin()
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
logMessage('adding event listener');
|
||||
window.addEventListener("load",websso,true) ;
|
||||
window.addEventListener("submit",promptuser,true) ;
|
||||
|
||||
13
extensions/common/casajar/content/casaOverlay.xul
Normal file
13
extensions/common/casajar/content/casaOverlay.xul
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<overlay id="nslwebssoOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
// This imports our javascript.
|
||||
|
||||
<script type="application/x-javascript" src="chrome://casa/content/casaOverlay.js">
|
||||
|
||||
</script>
|
||||
|
||||
</overlay>
|
||||
|
||||
32
extensions/common/casajar/content/contents.rdf
Normal file
32
extensions/common/casajar/content/contents.rdf
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<RDF:Seq RDF:about="urn:mozilla:package:root">
|
||||
<RDF:li RDF:resource="urn:mozilla:package:casa"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq RDF:about="urn:mozilla:overlays">
|
||||
<RDF:li RDF:resource="chrome://browser/content/browser.xul"/>
|
||||
<RDF:li RDF:resource="chrome://navigator/content/navigator.xul"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq RDF:about="chrome://browser/content/browser.xul">
|
||||
<RDF:li>chrome://casa/content/casaOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Seq about="chrome://navigator/content/navigator.xul">
|
||||
<RDF:li>chrome://casa/content/casaOverlay.xul</RDF:li>
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Description RDF:about="urn:mozilla:package:casa"
|
||||
chrome:displayName="Novell CASA v1.0"
|
||||
chrome:author="CSL.Manojna"
|
||||
chrome:authorURL="mailto:smanojna@novell.com"
|
||||
chrome:name="casa"
|
||||
chrome:extension="true"
|
||||
chrome:description="Common Authentication Service Adapter">
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
||||
80
extensions/common/casajar/content/encode.js
Normal file
80
extensions/common/casajar/content/encode.js
Normal file
@@ -0,0 +1,80 @@
|
||||
// This code was written by Tyler Akins and has been placed in the
|
||||
// public domain. It would be nice if you left this header intact.
|
||||
// Base64 code from Tyler Akins -- http://rumkin.com
|
||||
|
||||
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
function getBaseFilePath()
|
||||
{
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (userAgent.indexOf("windows") > 0)
|
||||
{
|
||||
return "c:\\";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "/media/CASA/CASA/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function encode64(input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
do {
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
|
||||
keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
||||
} while (i < input.length);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
function decode64(input) {
|
||||
var output = "";
|
||||
var chr1, chr2, chr3;
|
||||
var enc1, enc2, enc3, enc4;
|
||||
var i = 0;
|
||||
|
||||
// remove all characters that are not A-Z, a-z, 0-9, +, /, or =
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||
|
||||
do {
|
||||
enc1 = keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 != 64) {
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
if (enc4 != 64) {
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
} while (i < input.length);
|
||||
|
||||
return output;
|
||||
}
|
||||
52
extensions/common/casajar/content/prompt.xul
Normal file
52
extensions/common/casajar/content/prompt.xul
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<window class="dialog"
|
||||
title="CASA"
|
||||
id="casawindow"
|
||||
orient="vertical"
|
||||
autostretch="always"
|
||||
onload="centerPrompt()"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
|
||||
|
||||
<script language="JavaScript" type="text/javascript" src="encode.js"></script>
|
||||
<script language="JavaScript" type="text/javascript" src="casaOverlay.js"></script>
|
||||
|
||||
<script>
|
||||
var button = document.getElementById("ok");
|
||||
button.addEventListener('command', closeWin, true);
|
||||
|
||||
button = document.getElementById("notnow");
|
||||
button.addEventListener('command', cancelWin, true);
|
||||
</script>
|
||||
|
||||
<!-- <radiogroup onclick="alert('test');">-->
|
||||
|
||||
<vbox color="red">
|
||||
<image src="chrome://casa/skin/casa-logo.png"/>
|
||||
<separator class="thin"/>
|
||||
<separator class="thin"/>
|
||||
<separator class="thin"/>
|
||||
<groupbox align="center" orient="horizontal">
|
||||
<hbox>
|
||||
<vbox>
|
||||
<radiogroup>
|
||||
<radio id="CASA.RememberMe" selected="true" label="Remember my login"/>
|
||||
<radio id="CASA.RemAndLogin" label="Remember and login me in automatically"/>
|
||||
<radio id="CASA.Never" label="Never for this site"/>
|
||||
</radiogroup>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<button id="notnow" label="Not now" onclick="cancelWin()"/>
|
||||
<button id="ok" label="Ok" onclick="closeWin()"/>
|
||||
</hbox>
|
||||
|
||||
<spacer flex="1"/>
|
||||
|
||||
</window>
|
||||
BIN
extensions/common/casajar/skin/classic/CASA_48.png
Normal file
BIN
extensions/common/casajar/skin/classic/CASA_48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
BIN
extensions/common/casajar/skin/classic/casa-logo.png
Normal file
BIN
extensions/common/casajar/skin/classic/casa-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
17
extensions/common/casajar/skin/classic/contents.rdf
Normal file
17
extensions/common/casajar/skin/classic/contents.rdf
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<RDF:Seq about="urn:mozilla:skin:root">
|
||||
<RDF:li resource="urn:mozilla:skin:classic/1.0" />
|
||||
</RDF:Seq>
|
||||
|
||||
<RDF:Description about="urn:mozilla:skin:classic/1.0">
|
||||
<chrome:packages>
|
||||
<RDF:Seq about="urn:mozilla:skin:classic/1.0:packages">
|
||||
<RDF:li resource="urn:mozilla:skin:classic/1.0:casa" />
|
||||
</RDF:Seq>
|
||||
</chrome:packages>
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
||||
Reference in New Issue
Block a user