Bug 849540, part 1: Add an OAuth2 authentication type, r=rkent
authorJoshua Cranmer <Pidgeot18@gmail.com>
Mon, 23 Feb 2015 01:01:03 -0600
changeset 17556 47051fbe6edd
parent 17555 710080f9a4af
child 17557 bdc11668c7ab
push id10804
push userPidgeot18@gmail.com
push dateMon, 23 Feb 2015 07:03:52 +0000
treeherdercomm-central@bdc11668c7ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent
bugs849540
Bug 849540, part 1: Add an OAuth2 authentication type, r=rkent IGNORE IDL for MailNewsTypes2.idl changes, as the ABI of the interface has not changed at all.
mail/locales/en-US/chrome/messenger/messenger.properties
mailnews/base/prefs/content/am-server.js
mailnews/base/prefs/content/am-server.xul
mailnews/base/prefs/content/am-smtp.js
mailnews/base/prefs/content/smtpEditOverlay.js
mailnews/base/prefs/content/smtpEditOverlay.xul
mailnews/base/public/MailNewsTypes2.idl
suite/locales/en-US/chrome/mailnews/messenger.properties
--- a/mail/locales/en-US/chrome/messenger/messenger.properties
+++ b/mail/locales/en-US/chrome/messenger/messenger.properties
@@ -121,16 +121,17 @@ smtpServers-confirmServerDeletion=Are yo
 authNo=No authentication
 authOld=Password, original method (insecure)
 authPasswordCleartextInsecurely=Password, transmitted insecurely
 authPasswordCleartextViaSSL=Normal password
 authPasswordEncrypted=Encrypted password
 authKerberos=Kerberos / GSSAPI
 authExternal=TLS Certificate
 authNTLM=NTLM
+authOAuth2=OAuth2
 authAnySecure=Any secure method (deprecated)
 authAny=Any method (insecure)
 
 # LOCALIZATION NOTE(serverType-nntp): Do not translate "NNTP" in the line below
 serverType-nntp=News Server (NNTP)
 # LOCALIZATION NOTE(serverType-pop3): Do not translate "POP" in the line below
 serverType-pop3=POP Mail Server
 # LOCALIZATION NOTE(serverType-imap): Do not translate "IMAP" in the line below
--- a/mailnews/base/prefs/content/am-server.js
+++ b/mailnews/base/prefs/content/am-server.js
@@ -73,16 +73,17 @@ function initServerType()
 
   secureSelect(true);
 
   setLabelFromStringBundle("authMethod-no", "authNo");
   setLabelFromStringBundle("authMethod-old", "authOld");
   setLabelFromStringBundle("authMethod-kerberos", "authKerberos");
   setLabelFromStringBundle("authMethod-external", "authExternal");
   setLabelFromStringBundle("authMethod-ntlm", "authNTLM");
+  setLabelFromStringBundle("authMethod-oauth2", "authOAuth2");
   setLabelFromStringBundle("authMethod-anysecure", "authAnySecure");
   setLabelFromStringBundle("authMethod-any", "authAny");
   setLabelFromStringBundle("authMethod-password-encrypted",
       "authPasswordEncrypted");
   //authMethod-password-cleartext already set in selectSelect()
 
   // Hide deprecated/hidden auth options, unless selected
   hideUnlessSelected(document.getElementById("authMethod-no"));
--- a/mailnews/base/prefs/content/am-server.xul
+++ b/mailnews/base/prefs/content/am-server.xul
@@ -134,16 +134,17 @@
               <menupopup id="server.authMethodPopup">
                 <menuitem id="authMethod-no" value="1"/>
                 <menuitem id="authMethod-old" value="2"/>
                 <menuitem id="authMethod-password-cleartext" value="3"/>
                 <menuitem id="authMethod-password-encrypted" value="4"/>
                 <menuitem id="authMethod-kerberos" value="5"/>
                 <menuitem id="authMethod-ntlm" value="6"/>
                 <menuitem id="authMethod-external" value="7"/>
+                <menuitem id="authMethod-oauth2" value="10"/>
                 <menuitem id="authMethod-anysecure" value="8"/>
                 <menuitem id="authMethod-any" value="9"/>
               </menupopup>
             </menulist>
           </row>
         </rows>
       </grid>
     </groupbox>
--- a/mailnews/base/prefs/content/am-smtp.js
+++ b/mailnews/base/prefs/content/am-smtp.js
@@ -135,16 +135,19 @@ var gSmtpServerListWindow =
         authStr = "authAnySecure";
         break;
       case AuthMethod.passwordCleartext:
         authStr = (aServer.socketType == SocketType.SSL ||
                    aServer.socketType == SocketType.alwaysSTARTTLS)
                   ? "authPasswordCleartextViaSSL"
                   : "authPasswordCleartextInsecurely";
         break;
+      case AuthMethod.OAuth2:
+        authStr = "authOAuth2";
+        break;
       default:
         // leave empty
         Components.utils.reportError("Warning: unknown value for smtpserver... authMethod: " +
           aServer.authMethod);
     }
     if (authStr)
       document.getElementById("authMethodValue").value =
           this.mBundle.getString(authStr);
--- a/mailnews/base/prefs/content/smtpEditOverlay.js
+++ b/mailnews/base/prefs/content/smtpEditOverlay.js
@@ -48,16 +48,17 @@ function initSmtpSettings(server) {
     // we need to use the long label so that we can size the dialog.
     setLabelFromStringBundle("authMethod-no", "authNo");
     setLabelFromStringBundle("authMethod-password-encrypted",
         "authPasswordEncrypted");
     setLabelFromStringBundle("authMethod-password-cleartext",
         "authPasswordCleartextInsecurely");
     setLabelFromStringBundle("authMethod-kerberos", "authKerberos");
     setLabelFromStringBundle("authMethod-ntlm", "authNTLM");
+    setLabelFromStringBundle("authMethod-oauth2", "authOAuth2");
     setLabelFromStringBundle("authMethod-anysecure", "authAnySecure");
     setLabelFromStringBundle("authMethod-any", "authAny");
 
     sizeToContent();
 
     sslChanged(false);
     authMethodChanged(false);
 
--- a/mailnews/base/prefs/content/smtpEditOverlay.xul
+++ b/mailnews/base/prefs/content/smtpEditOverlay.xul
@@ -98,16 +98,17 @@
                       preftype="int" type="number"
                       prefstring="mail.smtpserver.%serverkey%.authMethod">
               <menupopup id="smtp.authMethodPopup">
                 <menuitem id="authMethod-no" value="1"/>
                 <menuitem id="authMethod-password-cleartext" value="3"/>
                 <menuitem id="authMethod-password-encrypted" value="4"/>
                 <menuitem id="authMethod-kerberos" value="5"/>
                 <menuitem id="authMethod-ntlm" value="6"/>
+                <menuitem id="authMethod-oauth2" value="10"/>
                 <menuitem id="authMethod-anysecure" value="8"/>
                 <menuitem id="authMethod-any" value="9"/>
               </menupopup>
             </menulist>
           </row>
           <row id="smtp.username.box" align="center">
             <label id="smtp.username.label" value="&userName.label;"
                    accesskey="&userName.accesskey;"
--- a/mailnews/base/public/MailNewsTypes2.idl
+++ b/mailnews/base/public/MailNewsTypes2.idl
@@ -75,16 +75,19 @@ interface nsMsgAuthMethod {
     /// Auth External is cert-based authentication
     const nsMsgAuthMethodValue External = 7;
     /// Encrypted password or Kerberos / GSSAPI or NTLM.
     /// @deprecated - for migration only.
     const nsMsgAuthMethodValue secure = 8;
     /// Let us pick any of the auth types supported by the server.
     /// Discouraged, because vulnerable to MITM attacks, even if server offers secure auth.
     const nsMsgAuthMethodValue anything = 9;
+
+    /// Use OAuth2 to authenticate.
+    const nsMsgAuthMethodValue OAuth2 = 10;
 };
 
 typedef unsigned long nsMsgLabelValue;
 
 typedef long nsMsgViewSortOrderValue;
 typedef long nsMsgViewSortTypeValue;
 typedef long nsMsgViewTypeValue;
 typedef long nsMsgViewFlagsTypeValue;
--- a/suite/locales/en-US/chrome/mailnews/messenger.properties
+++ b/suite/locales/en-US/chrome/mailnews/messenger.properties
@@ -119,16 +119,17 @@ smtpServers-confirmServerDeletion=Are yo
 authNo=No authentication
 authOld=Password, original method (insecure)
 authPasswordCleartextInsecurely=Password, transmitted insecurely
 authPasswordCleartextViaSSL=Normal password
 authPasswordEncrypted=Encrypted password
 authKerberos=Kerberos / GSSAPI
 authExternal=TLS Certificate
 authNTLM=NTLM
+authOAuth2=OAuth2
 authAnySecure=Any secure method (deprecated)
 authAny=Any method (insecure)
 
 # LOCALIZATION NOTE(serverType-nntp): Do not translate "NNTP" in the line below
 serverType-nntp=News Server (NNTP)
 # LOCALIZATION NOTE(serverType-pop3): Do not translate "POP" in the line below
 serverType-pop3=POP Mail Server
 # LOCALIZATION NOTE(serverType-imap): Do not translate "IMAP" in the line below