mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 14:17:03 +02:00
Pre expire tokens
This commit is contained in:
@@ -306,8 +306,9 @@ public class EmailService implements AutoCloseable {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void connect(EntityAccount account) throws MessagingException {
|
||||
connect(
|
||||
@NonNull
|
||||
public ServiceAuthenticator connect(EntityAccount account) throws MessagingException {
|
||||
return connect(
|
||||
account.host, account.port,
|
||||
account.auth_type, account.provider,
|
||||
account.user, account.password,
|
||||
@@ -323,8 +324,9 @@ public class EmailService implements AutoCloseable {
|
||||
account.certificate_alias, account.fingerprint);
|
||||
}
|
||||
|
||||
public void connect(EntityIdentity identity) throws MessagingException {
|
||||
connect(
|
||||
@NonNull
|
||||
public ServiceAuthenticator connect(EntityIdentity identity) throws MessagingException {
|
||||
return connect(
|
||||
identity.host, identity.port,
|
||||
identity.auth_type, identity.provider,
|
||||
identity.user, identity.password,
|
||||
@@ -340,14 +342,16 @@ public class EmailService implements AutoCloseable {
|
||||
identity.certificate_alias, identity.fingerprint);
|
||||
}
|
||||
|
||||
public void connect(
|
||||
@NonNull
|
||||
public ServiceAuthenticator connect(
|
||||
String host, int port,
|
||||
int auth, String provider, String user, String password,
|
||||
String certificate, String fingerprint) throws MessagingException {
|
||||
connect(host, port, auth, provider, user, password, null, certificate, fingerprint);
|
||||
return connect(host, port, auth, provider, user, password, null, certificate, fingerprint);
|
||||
}
|
||||
|
||||
private void connect(
|
||||
@NonNull
|
||||
private ServiceAuthenticator connect(
|
||||
String host, int port,
|
||||
int auth, String provider, String user, String password,
|
||||
ServiceAuthenticator.IAuthenticated intf,
|
||||
@@ -391,11 +395,13 @@ public class EmailService implements AutoCloseable {
|
||||
properties.put("mail." + protocol + ".yahoo.guid", "FAIRMAIL_V1");
|
||||
|
||||
connect(host, port, auth, user, authenticator, factory);
|
||||
return authenticator;
|
||||
} catch (AuthenticationFailedException ex) {
|
||||
if (auth == AUTH_TYPE_GMAIL || auth == AUTH_TYPE_OAUTH) {
|
||||
try {
|
||||
authenticator.refreshToken(true);
|
||||
connect(host, port, auth, user, authenticator, factory);
|
||||
return authenticator;
|
||||
} catch (Exception ex1) {
|
||||
Log.e(ex1);
|
||||
throw new AuthenticationFailedException(
|
||||
|
||||
Reference in New Issue
Block a user