1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

OAuth: support for shared mailboxes Outlook

This commit is contained in:
M66B 2021-08-16 17:27:13 +02:00
parent 39c10fb83a
commit 7eba0d82c0

View file

@ -344,8 +344,14 @@ public class FragmentOAuth extends FragmentBase {
.setState(provider.id)
.setAdditionalParameters(params);
if (askAccount)
authRequestBuilder.setLoginHint(etEmail.getText().toString().trim());
if (askAccount) {
String address = etEmail.getText().toString().trim();
int backslash = address.indexOf('\\');
if (backslash > 0)
authRequestBuilder.setLoginHint(address.substring(0, backslash));
else
authRequestBuilder.setLoginHint(address);
}
if (provider.oauth.pcke)
authRequestBuilder.setCodeVerifier(CodeVerifierUtil.generateRandomCodeVerifier());
@ -484,6 +490,12 @@ public class FragmentOAuth extends FragmentBase {
List<String> usernames = new ArrayList<>();
usernames.add(address);
// Outlook shared mailbox
// https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#sasl-xoauth2-authentication-for-shared-mailboxes-in-office-365
int backslash = address.indexOf('\\');
if (backslash > 0)
usernames.add(address.substring(backslash + 1));
if (token != null) {
// https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens
String[] segments = token.split("\\.");