From f7567415ec050bfb11ac66b2efb42f654ed277f6 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 11 Oct 2024 11:58:18 +0200 Subject: [PATCH] Add Fastmail OAuth configuration --- .../app/k9mail/auth/K9OAuthConfigurationFactory.kt | 14 ++++++++++++++ .../app/k9mail/auth/K9OAuthConfigurationFactory.kt | 14 ++++++++++++++ .../android/auth/TbOAuthConfigurationFactory.kt | 14 ++++++++++++++ .../android/auth/TbOAuthConfigurationFactory.kt | 14 ++++++++++++++ .../android/auth/TbOAuthConfigurationFactory.kt | 14 ++++++++++++++ .../android/auth/TbOAuthConfigurationFactory.kt | 14 ++++++++++++++ 6 files changed, 84 insertions(+) diff --git a/app-k9mail/src/debug/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt b/app-k9mail/src/debug/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt index 2a9d5ab9a27..a34eaec6679 100644 --- a/app-k9mail/src/debug/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt +++ b/app-k9mail/src/debug/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt @@ -9,6 +9,7 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory { override fun createConfigurations(): Map, OAuthConfiguration> { return mapOf( createAolConfiguration(), + createFastmailConfiguration(), createGmailConfiguration(), createMicrosoftConfiguration(), createYahooConfiguration(), @@ -28,6 +29,19 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createFastmailConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "imap.fastmail.com", + "smtp.fastmail.com", + ) to OAuthConfiguration( + clientId = "353641ae", + scopes = listOf("https://www.fastmail.com/dev/protocol-imap", "https://www.fastmail.com/dev/protocol-smtp"), + authorizationEndpoint = "https://api.fastmail.com/oauth/authorize", + tokenEndpoint = "https://api.fastmail.com/oauth/refresh", + redirectUri = "${BuildConfig.APPLICATION_ID}://oauth2redirect", + ) + } + private fun createGmailConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.gmail.com", diff --git a/app-k9mail/src/release/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt b/app-k9mail/src/release/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt index 8c52a1a5cf3..f106d20f196 100644 --- a/app-k9mail/src/release/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt +++ b/app-k9mail/src/release/kotlin/app/k9mail/auth/K9OAuthConfigurationFactory.kt @@ -9,6 +9,7 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory { override fun createConfigurations(): Map, OAuthConfiguration> { return mapOf( createAolConfiguration(), + createFastmailConfiguration(), createGmailConfiguration(), createMicrosoftConfiguration(), createYahooConfiguration(), @@ -28,6 +29,19 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createFastmailConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "imap.fastmail.com", + "smtp.fastmail.com", + ) to OAuthConfiguration( + clientId = "353641ae", + scopes = listOf("https://www.fastmail.com/dev/protocol-imap", "https://www.fastmail.com/dev/protocol-smtp"), + authorizationEndpoint = "https://api.fastmail.com/oauth/authorize", + tokenEndpoint = "https://api.fastmail.com/oauth/refresh", + redirectUri = "${BuildConfig.APPLICATION_ID}://oauth2redirect", + ) + } + private fun createGmailConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.gmail.com", 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 d60ea6dd459..e2088bf9174 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 @@ -9,6 +9,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { override fun createConfigurations(): Map, OAuthConfiguration> { return mapOf( createAolConfiguration(), + createFastmailConfiguration(), createGmailConfiguration(), createMicrosoftConfiguration(), createYahooConfiguration(), @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createFastmailConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "imap.fastmail.com", + "smtp.fastmail.com", + ) to OAuthConfiguration( + clientId = "353e41ae", + scopes = listOf("https://www.fastmail.com/dev/protocol-imap", "https://www.fastmail.com/dev/protocol-smtp"), + authorizationEndpoint = "https://api.fastmail.com/oauth/authorize", + tokenEndpoint = "https://api.fastmail.com/oauth/refresh", + redirectUri = "${BuildConfig.APPLICATION_ID}://oauth2redirect", + ) + } + private fun createGmailConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.gmail.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 0558dfc6051..1e5994b2e7b 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(), + createFastmailConfiguration(), createMicrosoftConfiguration(), createYahooConfiguration(), ) @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createFastmailConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "imap.fastmail.com", + "smtp.fastmail.com", + ) to OAuthConfiguration( + clientId = "353e41ae", + scopes = listOf("https://www.fastmail.com/dev/protocol-imap", "https://www.fastmail.com/dev/protocol-smtp"), + authorizationEndpoint = "https://api.fastmail.com/oauth/authorize", + tokenEndpoint = "https://api.fastmail.com/oauth/refresh", + redirectUri = "${BuildConfig.APPLICATION_ID}://oauth2redirect", + ) + } + private fun createGmailConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.gmail.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 1bd5dee39c2..343994883b0 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 @@ -9,6 +9,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { override fun createConfigurations(): Map, OAuthConfiguration> { return mapOf( createAolConfiguration(), + createFastmailConfiguration(), createGmailConfiguration(), createMicrosoftConfiguration(), createYahooConfiguration(), @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createFastmailConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "imap.fastmail.com", + "smtp.fastmail.com", + ) to OAuthConfiguration( + clientId = "353e41ae", + scopes = listOf("https://www.fastmail.com/dev/protocol-imap", "https://www.fastmail.com/dev/protocol-smtp"), + authorizationEndpoint = "https://api.fastmail.com/oauth/authorize", + tokenEndpoint = "https://api.fastmail.com/oauth/refresh", + redirectUri = "${BuildConfig.APPLICATION_ID}://oauth2redirect", + ) + } + private fun createGmailConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.gmail.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 ca16073d8fa..03b231f7243 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(), + createFastmailConfiguration(), createMicrosoftConfiguration(), createYahooConfiguration(), ) @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory { ) } + private fun createFastmailConfiguration(): Pair, OAuthConfiguration> { + return listOf( + "imap.fastmail.com", + "smtp.fastmail.com", + ) to OAuthConfiguration( + clientId = "353e41ae", + scopes = listOf("https://www.fastmail.com/dev/protocol-imap", "https://www.fastmail.com/dev/protocol-smtp"), + authorizationEndpoint = "https://api.fastmail.com/oauth/authorize", + tokenEndpoint = "https://api.fastmail.com/oauth/refresh", + redirectUri = "${BuildConfig.APPLICATION_ID}://oauth2redirect", + ) + } + private fun createGmailConfiguration(): Pair, OAuthConfiguration> { return listOf( "imap.gmail.com",