From 20f232840b2c772a8d353e7474e3a864bfe33485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolf-Martell=20Montw=C3=A9?= Date: Tue, 30 Jul 2024 18:09:55 +0200 Subject: [PATCH] Add Office365 OAuth config --- .../auth/TbOAuthConfigurationFactory.kt | 18 ++++++++++++++++++ .../auth/TbOAuthConfigurationFactory.kt | 18 ++++++++++++++++++ .../auth/TbOAuthConfigurationFactory.kt | 18 ++++++++++++++++++ .../auth/TbOAuthConfigurationFactory.kt | 18 ++++++++++++++++++ 4 files changed, 72 insertions(+) diff --git a/app-thunderbird/src/beta/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt b/app-thunderbird/src/beta/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt index 9c49908425b..d60ea6dd459 100644 --- a/app-thunderbird/src/beta/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt +++ b/app-thunderbird/src/beta/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { return mapOf( createAolConfiguration(), createGmailConfiguration(), + createMicrosoftConfiguration(), createYahooConfiguration(), ) } @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createMicrosoftConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "outlook.office365.com", + "smtp.office365.com", + ) to OAuthConfiguration( + clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5", + scopes = listOf( + "https://outlook.office.com/IMAP.AccessAsUser.All", + "https://outlook.office.com/SMTP.Send", + "offline_access", + ), + authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token", + redirectUri = "msauth://net.thunderbird.android.beta/oXQR8QkspkdQCotvApfiBQiPQBU%3D", + ) + } + private fun createYahooConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.mail.yahoo.com", diff --git a/app-thunderbird/src/daily/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt b/app-thunderbird/src/daily/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt index 77805750936..0558dfc6051 100644 --- a/app-thunderbird/src/daily/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt +++ b/app-thunderbird/src/daily/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { return mapOf( createAolConfiguration(), createGmailConfiguration(), + createMicrosoftConfiguration(), createYahooConfiguration(), ) } @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createMicrosoftConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "outlook.office365.com", + "smtp.office365.com", + ) to OAuthConfiguration( + clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5", + scopes = listOf( + "https://outlook.office.com/IMAP.AccessAsUser.All", + "https://outlook.office.com/SMTP.Send", + "offline_access", + ), + authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token", + redirectUri = "msauth://net.thunderbird.android.daily/KUkL9b7kcXs%2FtgmDCGD54ka8Bow%3D", + ) + } + private fun createYahooConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.mail.yahoo.com", diff --git a/app-thunderbird/src/debug/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt b/app-thunderbird/src/debug/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt index d31bb3b0fee..1bd5dee39c2 100644 --- a/app-thunderbird/src/debug/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt +++ b/app-thunderbird/src/debug/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { return mapOf( createAolConfiguration(), createGmailConfiguration(), + createMicrosoftConfiguration(), createYahooConfiguration(), ) } @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createMicrosoftConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "outlook.office365.com", + "smtp.office365.com", + ) to OAuthConfiguration( + clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5", + scopes = listOf( + "https://outlook.office.com/IMAP.AccessAsUser.All", + "https://outlook.office.com/SMTP.Send", + "offline_access", + ), + authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token", + redirectUri = "msauth://net.thunderbird.android.debug/eaXDuh6T3KFWjcJhsoaObT9OayU%3D", + ) + } + private fun createYahooConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.mail.yahoo.com", diff --git a/app-thunderbird/src/release/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt b/app-thunderbird/src/release/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt index 8c2bd59c4ab..ca16073d8fa 100644 --- a/app-thunderbird/src/release/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt +++ b/app-thunderbird/src/release/kotlin/net/thunderbird/android/auth/TbOAuthConfigurationFactory.kt @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { return mapOf( createAolConfiguration(), createGmailConfiguration(), + createMicrosoftConfiguration(), createYahooConfiguration(), ) } @@ -42,6 +43,23 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createMicrosoftConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "outlook.office365.com", + "smtp.office365.com", + ) to OAuthConfiguration( + clientId = "e6f8716e-299d-4ed9-bbf3-453f192f44e5", + scopes = listOf( + "https://outlook.office.com/IMAP.AccessAsUser.All", + "https://outlook.office.com/SMTP.Send", + "offline_access", + ), + authorizationEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", + tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/v2.0/token", + redirectUri = "msauth://net.thunderbird.android/S9nqeF27sTJcEfaInpC%2BDHzHuCY%3D", + ) + } + private fun createYahooConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.mail.yahoo.com",