Skip to content

Commit

Permalink
Merge pull request #8314 from cketti/add_fastmail_oauth
Browse files Browse the repository at this point in the history
Add Fastmail OAuth configuration
  • Loading branch information
cketti authored Oct 11, 2024
2 parents 7757b44 + f756741 commit 6887512
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory {
override fun createConfigurations(): Map<List<String>, OAuthConfiguration> {
return mapOf(
createAolConfiguration(),
createFastmailConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
Expand All @@ -28,6 +29,19 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createFastmailConfiguration(): Pair<List<String>, 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<List<String>, OAuthConfiguration> {
return listOf(
"imap.gmail.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory {
override fun createConfigurations(): Map<List<String>, OAuthConfiguration> {
return mapOf(
createAolConfiguration(),
createFastmailConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
Expand All @@ -28,6 +29,19 @@ class K9OAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createFastmailConfiguration(): Pair<List<String>, 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<List<String>, OAuthConfiguration> {
return listOf(
"imap.gmail.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
override fun createConfigurations(): Map<List<String>, OAuthConfiguration> {
return mapOf(
createAolConfiguration(),
createFastmailConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
Expand All @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createFastmailConfiguration(): Pair<List<String>, 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<List<String>, OAuthConfiguration> {
return listOf(
"imap.gmail.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
return mapOf(
createAolConfiguration(),
createGmailConfiguration(),
createFastmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
)
Expand All @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createFastmailConfiguration(): Pair<List<String>, 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<List<String>, OAuthConfiguration> {
return listOf(
"imap.gmail.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
override fun createConfigurations(): Map<List<String>, OAuthConfiguration> {
return mapOf(
createAolConfiguration(),
createFastmailConfiguration(),
createGmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
Expand All @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createFastmailConfiguration(): Pair<List<String>, 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<List<String>, OAuthConfiguration> {
return listOf(
"imap.gmail.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
return mapOf(
createAolConfiguration(),
createGmailConfiguration(),
createFastmailConfiguration(),
createMicrosoftConfiguration(),
createYahooConfiguration(),
)
Expand All @@ -28,6 +29,19 @@ class TbOAuthConfigurationFactory : OAuthConfigurationFactory {
)
}

private fun createFastmailConfiguration(): Pair<List<String>, 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<List<String>, OAuthConfiguration> {
return listOf(
"imap.gmail.com",
Expand Down

0 comments on commit 6887512

Please sign in to comment.