[evolution-ews] Bug 775690 - Support OAuth2 for outlook.office365.com (final change)



commit a487e14d07a1a2a328e66b7082958da0622e2f31
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 7 19:04:44 2018 +0100

    Bug 775690 - Support OAuth2 for outlook.office365.com (final change)

 src/configuration/e-mail-config-ews-backend.c |   22 ++++++++++++++++++++++
 src/server/e-oauth2-service-office365.c       |    2 +-
 2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/configuration/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
index 9b52561..695502c 100644
--- a/src/configuration/e-mail-config-ews-backend.c
+++ b/src/configuration/e-mail-config-ews-backend.c
@@ -579,6 +579,28 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
 
        e_util_set_entry_issue_hint (priv->user_entry, correct ? NULL : _("User name cannot be empty"));
 
+       if (correct && camel_ews_settings_get_auth_mechanism (ews_settings) == EWS_AUTH_TYPE_OAUTH2) {
+               const gchar *tenant, *client_id;
+
+               if (camel_ews_settings_get_override_oauth2 (ews_settings)) {
+                       tenant = camel_ews_settings_get_oauth2_tenant (ews_settings);
+                       client_id = camel_ews_settings_get_oauth2_client_id (ews_settings);
+               } else {
+                       tenant = OFFICE365_TENANT;
+                       client_id = OFFICE365_CLIENT_ID;
+               }
+
+               correct = tenant && *tenant;
+               complete = complete && correct;
+
+               e_util_set_entry_issue_hint (priv->oauth2_tenant_entry, correct ? NULL : _("Tenant cannot be 
empty"));
+
+               correct = client_id && *client_id;
+               complete = complete && correct;
+
+               e_util_set_entry_issue_hint (priv->oauth2_client_id_entry, correct ? NULL : _("Application ID 
cannot be empty"));
+       }
+
        return complete;
 }
 
diff --git a/src/server/e-oauth2-service-office365.c b/src/server/e-oauth2-service-office365.c
index bdb6cd4..08ff198 100644
--- a/src/server/e-oauth2-service-office365.c
+++ b/src/server/e-oauth2-service-office365.c
@@ -104,7 +104,7 @@ eos_office365_guess_can_process (EOAuth2Service *service,
                                 const gchar *protocol,
                                 const gchar *hostname)
 {
-       return e_oauth2_services_is_supported () && g_getenv ("EWS_WITH_OAUTH2") &&
+       return e_oauth2_services_is_supported () &&
                protocol && g_ascii_strcasecmp (protocol, "ews") == 0 &&
                hostname && e_util_utf8_strstrcase (hostname, "outlook.office365.com");
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]