diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mailnews/base/public/msgIOAuth2Module.idl | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mailnews/base/public/msgIOAuth2Module.idl')
-rw-r--r-- | comm/mailnews/base/public/msgIOAuth2Module.idl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/comm/mailnews/base/public/msgIOAuth2Module.idl b/comm/mailnews/base/public/msgIOAuth2Module.idl new file mode 100644 index 0000000000..e3d1f8aa15 --- /dev/null +++ b/comm/mailnews/base/public/msgIOAuth2Module.idl @@ -0,0 +1,56 @@ +/* -*- 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 http://mozilla.org/MPL/2.0/. */ + +#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); +}; + +%{C++ +#define MSGIOAUTH2MODULE_CONTRACTID "@mozilla.org/mail/oauth2-module;1" +%} |