Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI option to enable/disable Kerberos authentication #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions chrome/content/exchangeSettingsOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var exchWebServicesgMailbox = "";
var exchWebServicesgDisplayName = "";
var exchWebServicesgUser = "";
var exchWebServicesgDomain = "";
var exchWebServicesgUseKerberos = false;
var exchWebServicesgFolderIdOfShare = "";
var exchWebServicesgFolderBase = "calendar";
var exchWebServicesgFolderPath = "/";
Expand Down Expand Up @@ -211,6 +212,13 @@ function exchWebServicesAutodiscoverCheckbox(aCheckBox)
exchWebServicesCheckRequired();
}

function exchWebServicesUseKerberosCheckbox(aCheckBox)
{
exchWebServicesgUseKerberos = aCheckBox.checked;
gexchWebServicesDetailsChecked = false;
exchWebServicesCheckRequired();
}

function exchWebServicesInitMailbox(aNewValue)
{
exchWebServicesgMailbox = aNewValue;
Expand Down Expand Up @@ -328,13 +336,15 @@ function exchWebServicesDoCheckServerAndMailbox()
var tmpObject = new erConvertIDRequest(
{user: exchWebServicesGetUsername(),
mailbox: exchWebServicesgMailbox,
kerberos: exchWebServicesgUseKerberos,
serverUrl: exchWebServicesgServer,
folderId: folderIdOfShare}, exchWebServicesConvertIDOK, exchWebServicesConvertIDError);
}
else {
var tmpObject = new erPrimarySMTPCheckRequest(
{user: exchWebServicesGetUsername(),
mailbox: exchWebServicesgMailbox,
kerberos: exchWebServicesgUseKerberos,
serverUrl: exchWebServicesgServer,
folderBase: "calendar"}, exchWebServicesCheckServerAndMailboxOK, exchWebServicesCheckServerAndMailboxError);
}
Expand All @@ -354,6 +364,7 @@ function exchWebServicesConvertIDOK(aFolderID, aMailbox)
var tmpObject = new erGetFolderRequest(
{user: exchWebServicesGetUsername(),
mailbox: aMailbox,
kerberos: exchWebServicesgUseKerberos,
serverUrl: exchWebServicesgServer,
folderID: aFolderID}, exchWebServicesGetFolderOK, exchWebServicesGetFolderError);
}
Expand Down Expand Up @@ -529,7 +540,8 @@ function exchWebServicesDoAutodiscoverCheck()
window.setCursor("wait");
var tmpObject = new erAutoDiscoverRequest(
{user: exchWebServicesGetUsername(),
mailbox: exchWebServicesgMailbox},
mailbox: exchWebServicesgMailbox,
kerberos: exchWebServicesgUseKerberos},
exchWebServicesAutodiscoveryOK,
exchWebServicesAutodiscoveryError, null)
}
Expand Down Expand Up @@ -644,8 +656,9 @@ function exchWebServicesLoadExchangeSettingsByCalId(aCalId)
document.getElementById("menuitem.label.ecfolderbase.publicfoldersroot").disabled = false;
}

document.getElementById("exchWebService_usekerberos").checked = exchWebServicesCalPrefs.getBoolPref("ecUseKerberos");


exchWebServicesgUseKerberos = exchWebServicesCalPrefs.getBoolPref("ecUseKerberos");
exchWebServicesgServer = exchWebServicesCalPrefs.getCharPref("ecServer");
exchWebServicesgUser = exchWebServicesCalPrefs.getCharPref("ecUser");
exchWebServicesgDomain = exchWebServicesCalPrefs.getCharPref("ecDomain");
Expand Down Expand Up @@ -679,6 +692,7 @@ function exchWebServicesSaveExchangeSettingsByCalId(aCalId)

if (exchWebServicesCalPrefs) {
exchWebServicesCalPrefs.setCharPref("ecServer", exchWebServicesgServer);
exchWebServicesCalPrefs.setBoolPref("ecUseKerberos", exchWebServicesgUseKerberos);
exchWebServicesCalPrefs.setCharPref("ecUser", exchWebServicesgUser);
exchWebServicesCalPrefs.setCharPref("ecDomain", exchWebServicesgDomain);
exchWebServicesCalPrefs.setCharPref("ecFolderpath", exchWebServicesgFolderPath);
Expand Down Expand Up @@ -766,6 +780,7 @@ function exchWebServicesLoadExchangeSettingsByContactUUID(aUUID)
exchWebServicesgServer = exchWebServicesCalPrefs.getCharPref("server");
exchWebServicesgUser = exchWebServicesCalPrefs.getCharPref("user");
exchWebServicesgDomain = exchWebServicesCalPrefs.getCharPref("domain");
exchWebServicesgUseKerberos = exchWebServicesCalPrefs.getBoolPref("kerberos");

exchWebServicesgFolderBase = exchWebServicesCalPrefs.getCharPref("folderbase");
exchWebServicesgFolderPath = exchWebServicesCalPrefs.getCharPref("folderpath");
Expand Down Expand Up @@ -802,6 +817,7 @@ function exchWebServicesSaveExchangeSettingsByContactUUID(isNewDirectory, aUUID)
exchWebServicesCalPrefs.setCharPref("server", exchWebServicesgServer);
exchWebServicesCalPrefs.setCharPref("user", exchWebServicesgUser);
exchWebServicesCalPrefs.setCharPref("domain", exchWebServicesgDomain);
exchWebServicesCalPrefs.setBoolPref("kerberos", exchWebServicesgUseKerberos);
exchWebServicesCalPrefs.setCharPref("folderpath", exchWebServicesgFolderPath);
exchWebService.commonFunctions.LOG("exchWebServicesSaveExchangeSettingsByContactUUID: folderbase:"+exchWebServicesgFolderBase);
exchWebServicesCalPrefs.setCharPref("folderbase", exchWebServicesgFolderBase);
Expand All @@ -824,6 +840,7 @@ function exchWebServicesSaveExchangeSettingsByContactUUID(isNewDirectory, aUUID)
mailbox: exchWebServicesgMailbox,
user: exchWebServicesgUser,
domain: exchWebServicesgDomain,
kerberos: exchWebServicesgUseKerberos,
serverUrl: exchWebServicesgServer,
folderBase: exchWebServicesgFolderBase,
folderPath: exchWebServicesgFolderPath,
Expand Down
1 change: 1 addition & 0 deletions chrome/content/exchangeSettingsOverlay.xul
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

<vbox id="exchWebService-exchange-settings">
<checkbox label="&ecautodiscover;" id="exchWebService_autodiscover" oncommand="exchWebServicesAutodiscoverCheckbox(this);"/>
<checkbox label="&ecusekerberos;" id="exchWebService_usekerberos" oncommand="exchWebServicesUseKerberosCheckbox(this);"/>
<grid flex="1">
<columns>
<column/>
Expand Down
20 changes: 18 additions & 2 deletions chrome/content/manageEWSAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ exchWebService.manageEWSAccounts = {
{
document.getElementById("exchWebService_autodiscover").disabled = false;

document.getElementById("exchWebService_usekerberos").checked = aAccount.kerberos;
document.getElementById("exchWebService_usekerberos").disabled = false;

document.getElementById("exchWebService_manageEWSAccounts_account_name").value = aAccount.name;
document.getElementById("exchWebService_manageEWSAccounts_account_name").disabled = false;

Expand All @@ -137,6 +140,9 @@ exchWebService.manageEWSAccounts = {
{
document.getElementById("exchWebService_autodiscover").disabled = true;

document.getElementById("exchWebService_usekerberos").checked = false;
document.getElementById("exchWebService_usekerberos").disabled = true;

document.getElementById("exchWebService_manageEWSAccounts_account_name").value = "";
document.getElementById("exchWebService_manageEWSAccounts_account_name").disabled = true;

Expand Down Expand Up @@ -186,7 +192,8 @@ exchWebService.manageEWSAccounts = {
name: "new Account",
server: "",
user: "",
mailbox: "" };
mailbox: "",
kerberos: false };
exchWebService.accountFunctions.saveAccount(this.selectedAccount);
var listbox = document.getElementById("exchWebService-manageEWSAccounts-accounts-listbox");
if (listbox) {
Expand Down Expand Up @@ -278,6 +285,13 @@ exchWebService.manageEWSAccounts = {
this.selectedAccount.user = aTextBox.value;
},

doUseKerberosChanged: function _doUseKerberosChanged(aCheckBox)
{
this.detailsChecked = false;
this.detailsChanged = true;
this.selectedAccount.kerberos = aCheckBox.checked;
},

doAutodiscoverCheck: function _doAutodiscoverCheck()
{
document.getElementById("exchWebService_autodiscovercheckbutton").disabled = true;
Expand All @@ -286,9 +300,11 @@ exchWebService.manageEWSAccounts = {
window.setCursor("wait");
var user = document.getElementById("exchWebService_windowsuser").value;
var mailbox = document.getElementById("exchWebService_mailbox").value;
var kerberos = document.getElementById("exchWebService_usekerberos").checked;
var tmpObject = new erAutoDiscoverRequest(
{user: user,
mailbox: mailbox},
mailbox: mailbox,
kerberos: kerberos},
this.autodiscoveryOK,
this.autodiscoveryError, null);
}
Expand Down
1 change: 1 addition & 0 deletions chrome/content/manageEWSAccounts.xul
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
oninput="exchWebService.manageEWSAccounts.doNameChanged(this)"/>
</hbox>
<checkbox disabled="true" label="&exchWebService.manageEWSAccounts.autodiscover.label;" id="exchWebService_autodiscover" oncommand="exchWebService.manageEWSAccounts.doAutodiscoverChanged(this);"/>
<checkbox disabled="true" label="&exchWebService.manageEWSAccounts.usekerberos.label;" id="exchWebService_usekerberos" oncommand="exchWebService.manageEWSAccounts.doUsekerberosChanged(this);"/>
<grid flex="1">
<columns>
<column/>
Expand Down
3 changes: 3 additions & 0 deletions components/accountFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ exchWebService.accountFunctions = {
case "number":
this.prefs.setIntPref(aAccount.id+"."+index, aAccount[index]);
break;
case "boolean":
this.prefs.setBoolPref(aAccount.id+"."+index, aAccount[index]);
break;
default:
this.logInfo("Unknown object index:"+index);
}
Expand Down
55 changes: 36 additions & 19 deletions components/ecExchangeRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ function ExchangeRequest(aArgument, aCbOk, aCbError, aListener)

this.prePassword = "";

this.kerberos = true;

this.prefB = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);

Expand All @@ -95,6 +93,19 @@ function ExchangeRequest(aArgument, aCbOk, aCbError, aListener)
this.exchangeBadCertListener2 = Cc["@1st-setup.nl/exchange/badcertlistener2;1"]
.getService(Ci.mivExchangeBadCertListener2);


if (typeof(aArgument.kerberos)!=='undefined') {
// autodiscover / check server requests - no prefs stored yet.
this.kerberos = aArgument.kerberos;
} else {
// all others - calendar has it in prefs.
// this will slighty change the logic on extension upgrade:
// one should go and click 'Use Kerberos authentication' in settings to use Kerberos again
this.kerberos = exchWebService.commonFunctions.safeGetBoolPref(this.prefB,
"[email protected]."+aArgument["calendar"]["id"]+".ecUseKerberos",
false, false);
}

}

ExchangeRequest.prototype = {
Expand Down Expand Up @@ -216,23 +227,26 @@ ExchangeRequest.prototype = {
openUser = openUser.substr(openUser.indexOf("\\")+1);
}*/

var myAuthPrompt2 = Cc["@1st-setup.nl/exchange/authprompt2;1"].getService(Ci.mivExchangeAuthPrompt2);
if (myAuthPrompt2.getUserCanceled(this.currentUrl)) {

this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request.");
return;
}
if(!this.kerberos) {
var myAuthPrompt2 = Cc["@1st-setup.nl/exchange/authprompt2;1"].getService(Ci.mivExchangeAuthPrompt2);
if (myAuthPrompt2.getUserCanceled(this.currentUrl)) {

this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request.");
return;
}

try {
var password = myAuthPrompt2.getPassword(null, openUser, this.currentUrl);
// var password = myAuthPrompt2.getPassword(null, this.mArgument.user, this.currentUrl);
}
catch(err) {
this.logInfo(err);
this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request.");
return;
}

try {
var password = myAuthPrompt2.getPassword(null, openUser, this.currentUrl);

// var password = myAuthPrompt2.getPassword(null, this.mArgument.user, this.currentUrl);
}
catch(err) {
this.logInfo(err);
this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request.");
return;
}
}
this.xmlReq = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();

this.mXmlReq = this.xmlReq;
Expand All @@ -250,12 +264,15 @@ ExchangeRequest.prototype = {

if (this.debug) this.logInfo(": 1 ExchangeRequest.sendRequest : user="+this.mArgument.user+", url="+this.currentUrl);

this._notificationCallbacks = new ecnsIAuthPrompt2(this);
if(!this.kerberos) {
this._notificationCallbacks = new ecnsIAuthPrompt2(this);
}

try {

// this.xmlReq.open("POST", this.currentUrl, true);
if (password) {
if(!this.kerberos) {
// if (password) {
if (this.debug) this.logInfo("We have a prePassword: *******");
this.xmlReq.open("POST", this.currentUrl, true, openUser, password);
//this.xmlReq.open("POST", this.currentUrl, true, this.mArgument.user, password);
Expand Down
13 changes: 4 additions & 9 deletions interfaces/exchangeAuthPrompt2/mivExchangeAuthPrompt2.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,17 @@ mivExchangeAuthPrompt2.prototype = {

try {
if (!password) {

if (!this.details[aURL]) {
this.logInfo("getPassword: First request for a password. Not going to ask user for it because we want to see if we need a password. For Kerberos for example we do not need a password.");
return null;
}

/* if (!this.details[aURL]) this.details[aURL] = {
if (!this.details[aURL]) this.details[aURL] = {
showing: true,
canceled: false,
queue: new Array(),
ntlmCount: 0
};*/
};

this.logInfo("getPassword: Going to ask user to provide a new password.");

this.details[aURL].ntlmCount = 0;

var answer = this.getCredentials(username, aURL);

if (answer.result) {
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/de/exchangeSettingsOverlay.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!ENTITY ecautodiscover "Exchange's Autodiscovery Funktion nutzen.">
<!ENTITY ecusekerberos "Use Kerberos authentication.">
<!ENTITY ecfolderbase.label "Hauptordner:">
<!ENTITY ecfolderpath.label "Pfad unterhalb des Hauptordners:">
<!ENTITY ecfolderidofshare.label "Freigabeordner Id:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/de/manageEWSAccounts.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY exchWebService.manageEWSAccounts.saveAccount.button "Einstellungen speichern">

<!ENTITY exchWebService.manageEWSAccounts.autodiscover.label "Exchange's Autodiscovery Funktion nutzen.">
<!ENTITY exchWebService.manageEWSAccounts.usekerberos.label "Use Kerberos authentication.">
<!ENTITY exchWebService.manageEWSAccounts.mailbox.label "Postfachname:">
<!ENTITY exchWebService.manageEWSAccounts.windowsuser.label "Benutzername:">
<!ENTITY exchWebService.manageEWSAccounts.windowsdomain.label "Domainname:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/en-US/exchangeSettingsOverlay.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!ENTITY ecautodiscover "Use Exchange's autodiscovery function.">
<!ENTITY ecusekerberos "Use Kerberos authentication.">
<!ENTITY ecfolderbase.label "Folder base:">
<!ENTITY ecfolderpath.label "Path below folder base:">
<!ENTITY ecfolderidofshare.label "Share Folder Id:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/en-US/manageEWSAccounts.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY exchWebService.manageEWSAccounts.saveAccount.button "Save settings">

<!ENTITY exchWebService.manageEWSAccounts.autodiscover.label "Use Exchange's autodiscovery function.">
<!ENTITY exchWebService.manageEWSAccounts.usekerberos.label "Use Kerberos authentication.">
<!ENTITY exchWebService.manageEWSAccounts.mailbox.label "Mailbox name:">
<!ENTITY exchWebService.manageEWSAccounts.windowsuser.label "Username:">
<!ENTITY exchWebService.manageEWSAccounts.windowsdomain.label "Domain name:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/fr-FR/exchangeSettingsOverlay.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!ENTITY ecautodiscover "Utiliser la fonction de découverte automatique d'Exchange.">
<!ENTITY ecusekerberos "Utiliser authentification Kerberos.">
<!ENTITY ecfolderbase.label "Dossier racine:">
<!ENTITY ecfolderpath.label "Chemin sous le dossier racine:">
<!ENTITY ecfolderidofshare.label "Dossier partagé:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/fr-FR/manageEWSAccounts.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY exchWebService.manageEWSAccounts.saveAccount.button "Sauvegarder le compte">

<!ENTITY exchWebService.manageEWSAccounts.autodiscover.label "Utiliser la fonction de découverte automatique d'Exchange.">
<!ENTITY exchWebService.manageEWSAccounts.usekerberos.label "Utiliser authentification Kerberos.">
<!ENTITY exchWebService.manageEWSAccounts.mailbox.label "Nom de la boite aux lettres:">
<!ENTITY exchWebService.manageEWSAccounts.windowsuser.label "Utilisateur:">
<!ENTITY exchWebService.manageEWSAccounts.windowsdomain.label "Nom de Domaine:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/ja-JP/exchangeSettingsOverlay.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!ENTITY ecautodiscover "Use Exchange's autodiscovery function.">
<!ENTITY ecusekerberos "Use Kerberos authentication.">
<!ENTITY ecfolderbase.label "Folder base:">
<!ENTITY ecfolderpath.label "Path below folder base:">
<!ENTITY ecfolderidofshare.label "Share Folder Id:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/ja-JP/manageEWSAccounts.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY exchWebService.manageEWSAccounts.saveAccount.button "Save settings">

<!ENTITY exchWebService.manageEWSAccounts.autodiscover.label "Use Exchange's autodiscovery function.">
<!ENTITY exchWebService.manageEWSAccounts.usekerberos.label "Use Kerberos authentication.">
<!ENTITY exchWebService.manageEWSAccounts.mailbox.label "Mailbox name:">
<!ENTITY exchWebService.manageEWSAccounts.windowsuser.label "Username:">
<!ENTITY exchWebService.manageEWSAccounts.windowsdomain.label "Domain name:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/nl/exchangeSettingsOverlay.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!ENTITY ecautodiscover "Gebruik autodiscovery functie van Exchange.">
<!ENTITY ecusekerberos "Use Kerberos authentication.">
<!ENTITY ecfolderbase.label "Basisfolder:">
<!ENTITY ecfolderpath.label "Pad onder basis:">
<!ENTITY ecfolderidofshare.label "Share FolderId:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/nl/manageEWSAccounts.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY exchWebService.manageEWSAccounts.saveAccount.button "Bewaar gegevens">

<!ENTITY exchWebService.manageEWSAccounts.autodiscover.label "Gebruik autodiscovery functie van Exchange.">
<!ENTITY exchWebService.manageEWSAccounts.usekerberos.label "Use Kerberos authentication.">
<!ENTITY exchWebService.manageEWSAccounts.mailbox.label "Mailboxnaam:">
<!ENTITY exchWebService.manageEWSAccounts.windowsuser.label "Gerbuikersnaam:">
<!ENTITY exchWebService.manageEWSAccounts.windowsdomain.label "Domeinnaam:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/sv/exchangeSettingsOverlay.dtd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!ENTITY ecautodiscover "Använd Exchanges funktion för automatisk utforskning.">
<!ENTITY ecusekerberos "Use Kerberos authentication.">
<!ENTITY ecfolderbase.label "Basmapp:">
<!ENTITY ecfolderpath.label "Sökväg under basmapp:">
<!ENTITY ecfolderidofshare.label "Basmapps-ID:">
Expand Down
1 change: 1 addition & 0 deletions locale/exchangecalendar/sv/manageEWSAccounts.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!ENTITY exchWebService.manageEWSAccounts.saveAccount.button "Spara inställningar">

<!ENTITY exchWebService.manageEWSAccounts.autodiscover.label "Använd Exchanges funktion för automatisk utforskning.">
<!ENTITY exchWebService.manageEWSAccounts.usekerberos.label "Use Kerberos authentication.">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swedish translation: "Använd Kerberosinloggning"

<!ENTITY exchWebService.manageEWSAccounts.mailbox.label "Namn på postlåda:">
<!ENTITY exchWebService.manageEWSAccounts.windowsuser.label "Användarnamn:">
<!ENTITY exchWebService.manageEWSAccounts.windowsdomain.label "Domännamn:">
Expand Down