Loading k9mail-library/src/main/java/foundation/e/mail/mail/oauth/OAuth2AuthorizationCodeFlowTokenProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public abstract class OAuth2AuthorizationCodeFlowTokenProvider { return authTokens.get(email); } protected abstract void showAuthDialog(String email); protected abstract void showAuthDialog(String email) throws AuthenticationFailedException; /** * get refresh token got before Loading k9mail-library/src/main/java/foundation/e/mail/mail/oauth/SpecificOAuth2TokenProvider.java +3 −1 Original line number Diff line number Diff line package foundation.e.mail.mail.oauth; import foundation.e.mail.mail.AuthenticationFailedException; import foundation.e.mail.mail.MessagingException; public abstract class SpecificOAuth2TokenProvider { public abstract OAuth2AuthorizationCodeFlowTokenProvider.Tokens exchangeCode(String username, String code) throws AuthenticationFailedException; public abstract String refreshToken(String username, String refreshToken) throws AuthenticationFailedException; public abstract void showAuthDialog(); public abstract void showAuthDialog() throws AuthenticationFailedException; } k9mail-library/src/main/java/foundation/e/mail/mail/store/imap/ImapConnection.java +2 −1 Original line number Diff line number Diff line Loading @@ -397,8 +397,9 @@ class ImapConnection { return attemptXOAuth2(); } catch (NegativeImapResponseException e) { //TODO: Check response code so we don't needlessly invalidate the token. if(e.getMessage().contains("Too many simultaneous connections")) throw new MessagingException("Too many simultaneous connections"); oauthTokenProvider.invalidateToken(settings.getUsername()); if (!retryXoauth2WithNewToken) { throw handlePermanentXoauth2Failure(e); } else { Loading k9mail/src/main/java/foundation/e/mail/account/GmailOAuth2TokenStore.java +4 −1 Original line number Diff line number Diff line package foundation.e.mail.account; import foundation.e.mail.mail.AuthenticationFailedException; import retrofit2.Call; import retrofit2.GsonConverterFactory; import retrofit2.Retrofit; Loading Loading @@ -30,7 +31,9 @@ public class GmailOAuth2TokenStore extends AndroidSpecificOAuth2TokenProvider { } @Override public void showAuthDialog() { public void showAuthDialog() throws AuthenticationFailedException { if(promptRequestHandler == null) throw new AuthenticationFailedException("No handler available"); promptRequestHandler.handleGmailRedirectUrl(AUTHORIZATION_URL); } Loading k9mail/src/main/java/foundation/e/mail/account/K9OAuth2AuthorizationCodeFlowTokenProvider.java +2 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package foundation.e.mail.account; import android.content.Context; import android.content.SharedPreferences; import foundation.e.mail.mail.AuthenticationFailedException; import foundation.e.mail.mail.oauth.OAuth2AuthorizationCodeFlowTokenProvider; import foundation.e.mail.mail.oauth.SpecificOAuth2TokenProvider; Loading Loading @@ -35,7 +36,7 @@ public class K9OAuth2AuthorizationCodeFlowTokenProvider extends OAuth2Authorizat } @Override public void showAuthDialog(String email) { public void showAuthDialog(String email) throws AuthenticationFailedException { SpecificOAuth2TokenProvider provider = getSpecificProviderFromEmail(email); if (provider == null) return; provider.showAuthDialog(); Loading Loading
k9mail-library/src/main/java/foundation/e/mail/mail/oauth/OAuth2AuthorizationCodeFlowTokenProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ public abstract class OAuth2AuthorizationCodeFlowTokenProvider { return authTokens.get(email); } protected abstract void showAuthDialog(String email); protected abstract void showAuthDialog(String email) throws AuthenticationFailedException; /** * get refresh token got before Loading
k9mail-library/src/main/java/foundation/e/mail/mail/oauth/SpecificOAuth2TokenProvider.java +3 −1 Original line number Diff line number Diff line package foundation.e.mail.mail.oauth; import foundation.e.mail.mail.AuthenticationFailedException; import foundation.e.mail.mail.MessagingException; public abstract class SpecificOAuth2TokenProvider { public abstract OAuth2AuthorizationCodeFlowTokenProvider.Tokens exchangeCode(String username, String code) throws AuthenticationFailedException; public abstract String refreshToken(String username, String refreshToken) throws AuthenticationFailedException; public abstract void showAuthDialog(); public abstract void showAuthDialog() throws AuthenticationFailedException; }
k9mail-library/src/main/java/foundation/e/mail/mail/store/imap/ImapConnection.java +2 −1 Original line number Diff line number Diff line Loading @@ -397,8 +397,9 @@ class ImapConnection { return attemptXOAuth2(); } catch (NegativeImapResponseException e) { //TODO: Check response code so we don't needlessly invalidate the token. if(e.getMessage().contains("Too many simultaneous connections")) throw new MessagingException("Too many simultaneous connections"); oauthTokenProvider.invalidateToken(settings.getUsername()); if (!retryXoauth2WithNewToken) { throw handlePermanentXoauth2Failure(e); } else { Loading
k9mail/src/main/java/foundation/e/mail/account/GmailOAuth2TokenStore.java +4 −1 Original line number Diff line number Diff line package foundation.e.mail.account; import foundation.e.mail.mail.AuthenticationFailedException; import retrofit2.Call; import retrofit2.GsonConverterFactory; import retrofit2.Retrofit; Loading Loading @@ -30,7 +31,9 @@ public class GmailOAuth2TokenStore extends AndroidSpecificOAuth2TokenProvider { } @Override public void showAuthDialog() { public void showAuthDialog() throws AuthenticationFailedException { if(promptRequestHandler == null) throw new AuthenticationFailedException("No handler available"); promptRequestHandler.handleGmailRedirectUrl(AUTHORIZATION_URL); } Loading
k9mail/src/main/java/foundation/e/mail/account/K9OAuth2AuthorizationCodeFlowTokenProvider.java +2 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package foundation.e.mail.account; import android.content.Context; import android.content.SharedPreferences; import foundation.e.mail.mail.AuthenticationFailedException; import foundation.e.mail.mail.oauth.OAuth2AuthorizationCodeFlowTokenProvider; import foundation.e.mail.mail.oauth.SpecificOAuth2TokenProvider; Loading Loading @@ -35,7 +36,7 @@ public class K9OAuth2AuthorizationCodeFlowTokenProvider extends OAuth2Authorizat } @Override public void showAuthDialog(String email) { public void showAuthDialog(String email) throws AuthenticationFailedException { SpecificOAuth2TokenProvider provider = getSpecificProviderFromEmail(email); if (provider == null) return; provider.showAuthDialog(); Loading