author Philipp Kewisch <>
Thu, 24 Nov 2016 02:07:21 +0100
changeset 24504 749cb8eaaea27559c1f67e7280a54e926a69f7fd
parent 17557 bdc11668c7ab4930661a295e5510612bba53cc69
permissions -rw-r--r--
Bug 1176399 - Multiple requests for master password when GMail OAuth2 is enabled. r=mkmelin

/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "nsISupports.idl"

interface nsIMsgIncomingServer;
interface nsISmtpServer;

 * A listener callback for OAuth2 SASL authentication. This would be represented
 * as a promise, but this needs to be consumed by C++ code.
[scriptable, uuid(9a088b49-bc13-4f99-9478-053a6a43e370)]
interface msgIOAuth2ModuleListener : nsISupports {
   * Called on successful OAuth2 authentication with the base64-encoded
   * string to send as the client initial response for SASL XOAUTH2.
  void onSuccess(in ACString aBearerToken);

  /// Called on failed OAuth2 authentication.
  void onFailure(in nsresult aError);

 * An interface for managing the responsibilities of using OAuth2 to produce a
 * bearer token, for use in SASL steps.
[scriptable, uuid(68c275f8-cfa7-4622-b279-af290616cae6)]
interface msgIOAuth2Module : nsISupports {
   * Initialize the OAuth2 parameters from an SMTP server, and return whether or
   * not we can authenticate with OAuth2.
  bool initFromSmtp(in nsISmtpServer aSmtpServer);

   * Initialize the OAuth2 parameters from an incoming server, and return
   * whether or not we can authenticate with OAuth2.
  bool initFromMail(in nsIMsgIncomingServer aServer);

   * Connect to the OAuth2 server to get an access token.
   * @param aWithUI   If false, do not allow a dialog to be popped up to query
   *                  for a password.
   * @param aCallback Listener that handles the async response.
  void connect(in boolean aWithUI, in msgIOAuth2ModuleListener aCallback);