Loading app/autodiscovery/providersxml/src/main/java/com/fsck/k9/autodiscovery/providersxml/ProvidersXmlDiscovery.kt +3 −3 Original line number Diff line number Diff line Loading @@ -8,10 +8,10 @@ import com.fsck.k9.autodiscovery.api.DiscoveryResults import com.fsck.k9.autodiscovery.api.DiscoveryTarget import com.fsck.k9.helper.EmailHelper import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.oauth.OAuth2Provider import java.net.URI import com.fsck.k9.mail.ConnectionSecurity import com.fsck.k9.mail.oauth.OAuth2Provider import com.fsck.k9.preferences.Protocols import java.net.URI import org.xmlpull.v1.XmlPullParser import timber.log.Timber Loading mail/common/src/main/java/com/fsck/k9/mail/oauth/AuthorizationException.java +1 −0 Original line number Diff line number Diff line package com.fsck.k9.mail.oauth; public class AuthorizationException extends Exception { public AuthorizationException(String detailMessage, Throwable throwable) { super(detailMessage, throwable); Loading mail/common/src/main/java/com/fsck/k9/mail/oauth/OAuth2Provider.kt +19 −11 Original line number Diff line number Diff line Loading @@ -13,17 +13,25 @@ enum class OAuth2Provider( val isInDomain: (String) -> Boolean, val webViewClient: (String, OAuth2CodeGrantFlowManager) -> OAuth2WebViewClient ) { GMAIL(GmailAuthorizationServer(), { GMAIL( GmailAuthorizationServer(), { it in listOf("gmail.com", "android.com", "google.com", "googlemail.com") }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> GmailWebViewClient(email, codeGrantFlowManager) }), OUTLOOK(OutlookAuthorizationServer(), { } ), OUTLOOK( OutlookAuthorizationServer(), { val domainWoExt = it.split('.')[0] domainWoExt in listOf("hotmail", "live", "msn", "outlook") }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> OutlookWebViewClient(email, codeGrantFlowManager) }); } ); companion object { private fun getTypeFromDomain(domain: String): OAuth2Provider? { Loading mail/common/src/main/java/com/fsck/k9/mail/oauth/OAuth2TokenProvider.java +6 −3 Original line number Diff line number Diff line package com.fsck.k9.mail.oauth; import com.fsck.k9.mail.AuthenticationFailedException; import com.fsck.k9.mail.oauth.authorizationserver.codegrantflow.OAuth2NeedUserPromptException; public interface OAuth2TokenProvider { /** * A default timeout value to use when fetching tokens. Loading @@ -12,14 +14,15 @@ public interface OAuth2TokenProvider { /** * Fetch a token. No guarantees are provided for validity. */ String getToken(String email, long timeoutMillis) throws AuthenticationFailedException, OAuth2NeedUserPromptException; String getToken(String email, long timeoutMillis) throws AuthenticationFailedException, OAuth2NeedUserPromptException; /** * Invalidate the token for this email. * * <p> * Note that the token should always be invalidated on credential failure. However invalidating a token every * single time is not recommended. * Note that the token should always be invalidated on credential failure. However invalidating a token every single * time is not recommended. * <p> * Invalidating a token and then failure with a new token should be treated as a permanent failure. */ Loading mail/common/src/main/java/com/fsck/k9/mail/oauth/XOAuth2ChallengeParser.java +1 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,7 @@ import timber.log.Timber; /** * Parses Google's Error/Challenge responses * See: https://developers.google.com/gmail/xoauth2_protocol#error_response * Parses Google's Error/Challenge responses See: https://developers.google.com/gmail/xoauth2_protocol#error_response */ public class XOAuth2ChallengeParser { public static final String BAD_RESPONSE = "400"; Loading Loading
app/autodiscovery/providersxml/src/main/java/com/fsck/k9/autodiscovery/providersxml/ProvidersXmlDiscovery.kt +3 −3 Original line number Diff line number Diff line Loading @@ -8,10 +8,10 @@ import com.fsck.k9.autodiscovery.api.DiscoveryResults import com.fsck.k9.autodiscovery.api.DiscoveryTarget import com.fsck.k9.helper.EmailHelper import com.fsck.k9.mail.AuthType import com.fsck.k9.mail.oauth.OAuth2Provider import java.net.URI import com.fsck.k9.mail.ConnectionSecurity import com.fsck.k9.mail.oauth.OAuth2Provider import com.fsck.k9.preferences.Protocols import java.net.URI import org.xmlpull.v1.XmlPullParser import timber.log.Timber Loading
mail/common/src/main/java/com/fsck/k9/mail/oauth/AuthorizationException.java +1 −0 Original line number Diff line number Diff line package com.fsck.k9.mail.oauth; public class AuthorizationException extends Exception { public AuthorizationException(String detailMessage, Throwable throwable) { super(detailMessage, throwable); Loading
mail/common/src/main/java/com/fsck/k9/mail/oauth/OAuth2Provider.kt +19 −11 Original line number Diff line number Diff line Loading @@ -13,17 +13,25 @@ enum class OAuth2Provider( val isInDomain: (String) -> Boolean, val webViewClient: (String, OAuth2CodeGrantFlowManager) -> OAuth2WebViewClient ) { GMAIL(GmailAuthorizationServer(), { GMAIL( GmailAuthorizationServer(), { it in listOf("gmail.com", "android.com", "google.com", "googlemail.com") }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> GmailWebViewClient(email, codeGrantFlowManager) }), OUTLOOK(OutlookAuthorizationServer(), { } ), OUTLOOK( OutlookAuthorizationServer(), { val domainWoExt = it.split('.')[0] domainWoExt in listOf("hotmail", "live", "msn", "outlook") }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> }, { email: String, codeGrantFlowManager: OAuth2CodeGrantFlowManager -> OutlookWebViewClient(email, codeGrantFlowManager) }); } ); companion object { private fun getTypeFromDomain(domain: String): OAuth2Provider? { Loading
mail/common/src/main/java/com/fsck/k9/mail/oauth/OAuth2TokenProvider.java +6 −3 Original line number Diff line number Diff line package com.fsck.k9.mail.oauth; import com.fsck.k9.mail.AuthenticationFailedException; import com.fsck.k9.mail.oauth.authorizationserver.codegrantflow.OAuth2NeedUserPromptException; public interface OAuth2TokenProvider { /** * A default timeout value to use when fetching tokens. Loading @@ -12,14 +14,15 @@ public interface OAuth2TokenProvider { /** * Fetch a token. No guarantees are provided for validity. */ String getToken(String email, long timeoutMillis) throws AuthenticationFailedException, OAuth2NeedUserPromptException; String getToken(String email, long timeoutMillis) throws AuthenticationFailedException, OAuth2NeedUserPromptException; /** * Invalidate the token for this email. * * <p> * Note that the token should always be invalidated on credential failure. However invalidating a token every * single time is not recommended. * Note that the token should always be invalidated on credential failure. However invalidating a token every single * time is not recommended. * <p> * Invalidating a token and then failure with a new token should be treated as a permanent failure. */ Loading
mail/common/src/main/java/com/fsck/k9/mail/oauth/XOAuth2ChallengeParser.java +1 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,7 @@ import timber.log.Timber; /** * Parses Google's Error/Challenge responses * See: https://developers.google.com/gmail/xoauth2_protocol#error_response * Parses Google's Error/Challenge responses See: https://developers.google.com/gmail/xoauth2_protocol#error_response */ public class XOAuth2ChallengeParser { public static final String BAD_RESPONSE = "400"; Loading