[evolution-ews/wip/mcrha/office365] Split Office365 and Microsoft365 OAuth2 settings
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/wip/mcrha/office365] Split Office365 and Microsoft365 OAuth2 settings
- Date: Tue, 4 Aug 2020 11:51:51 +0000 (UTC)
commit 0bfed951b21c852dcd4e54fae418478bd475b989
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 4 13:51:06 2020 +0200
Split Office365 and Microsoft365 OAuth2 settings
CMakeLists.txt | 24 +++++++++++++++++++++++-
config.h.in | 9 +++++++++
src/configuration/e-mail-config-ews-backend.c | 14 +++++++-------
src/server/e-oauth2-service-office365.c | 12 ++++++------
4 files changed, 45 insertions(+), 14 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d009c22..2791a9c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,7 +179,29 @@ if(ENABLE_TESTS)
endif(ENABLE_TESTS)
# ******************************
-# Microsoft365 OAuth2 support
+# Office365 OAuth2 support
+# ******************************
+
+add_printable_variable(WITH_OFFICE365_TENANT "Office365.com OAuth 2.0 tenant" "")
+
+if(WITH_OFFICE365_TENANT STREQUAL "")
+ set(WITH_OFFICE365_TENANT "common")
+endif(WITH_OFFICE365_TENANT STREQUAL "")
+
+add_printable_variable(WITH_OFFICE365_CLIENT_ID "Office365.com OAuth 2.0 client ID" "")
+
+if(WITH_OFFICE365_CLIENT_ID STREQUAL "")
+ set(WITH_OFFICE365_CLIENT_ID "")
+endif(WITH_OFFICE365_CLIENT_ID STREQUAL "")
+
+add_printable_variable(WITH_OFFICE365_REDIRECT_URI "Office365.com OAuth 2.0 redirect URI" "")
+
+if(WITH_OFFICE365_REDIRECT_URI STREQUAL "")
+ set(WITH_OFFICE365_REDIRECT_URI "https://login.microsoftonline.com/common/oauth2/nativeclient")
+endif(WITH_OFFICE365_REDIRECT_URI STREQUAL "")
+
+# ******************************
+# Microsoft365 OAuth2 support (v2.0)
# ******************************
add_printable_variable(WITH_MICROSOFT365_TENANT "Microsoft 365 OAuth 2.0 tenant" "")
diff --git a/config.h.in b/config.h.in
index e20d5c96..ae8ae20e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -24,6 +24,15 @@
/* libmspack has OAB support */
#cmakedefine WITH_MSPACK 1
+/* Define Office365 OAuth 2.0 default Tenant to use */
+#define OFFICE365_TENANT "@WITH_OFFICE365_TENANT@"
+
+/* Define Office365 OAuth 2.0 default Client ID to use */
+#define OFFICE365_CLIENT_ID "@WITH_OFFICE365_CLIENT_ID@"
+
+/* Define Office365 OAuth 2.0 default Redirect URI to use */
+#define OFFICE365_REDIRECT_URI "@WITH_OFFICE365_REDIRECT_URI@"
+
/* Define Microsoft 365 OAuth 2.0 default Tenant to use */
#define MICROSOFT365_TENANT "@WITH_MICROSOFT365_TENANT@"
diff --git a/src/configuration/e-mail-config-ews-backend.c b/src/configuration/e-mail-config-ews-backend.c
index 366e8978..8c9d081b 100644
--- a/src/configuration/e-mail-config-ews-backend.c
+++ b/src/configuration/e-mail-config-ews-backend.c
@@ -335,13 +335,13 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
widget, "sensitive",
G_BINDING_SYNC_CREATE);
- mail_config_ews_backend_set_oauth2_tooltip (widget, MICROSOFT365_TENANT,
+ mail_config_ews_backend_set_oauth2_tooltip (widget, OFFICE365_TENANT,
/* Translators: 'Tenant' here means a term used by Microsoft to identify a company or
organization in an Office 365 world. Same for 'common', it's a default URL path.
You probably do not want to translate it. More for example here:
https://powerbi.microsoft.com/en-us/blog/what-is-a-tenant/ */
_("Default tenant is “common“"),
/* Translators: 'Tenant' here means a term used by Microsoft to identify a company or
organization in an Office 365 world.
You probably do not want to translate it. More for example here:
https://powerbi.microsoft.com/en-us/blog/what-is-a-tenant/ */
- g_strdup_printf (_("Default tenant is “%s”"), MICROSOFT365_TENANT));
+ g_strdup_printf (_("Default tenant is “%s”"), OFFICE365_TENANT));
widget = gtk_label_new_with_mnemonic (_("Application I_D:"));
gtk_widget_set_margin_left (widget, 12);
@@ -365,9 +365,9 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
widget, "sensitive",
G_BINDING_SYNC_CREATE);
- mail_config_ews_backend_set_oauth2_tooltip (widget, MICROSOFT365_CLIENT_ID,
+ mail_config_ews_backend_set_oauth2_tooltip (widget, OFFICE365_CLIENT_ID,
_("There is not set any default application ID"),
- g_strdup_printf (_("Default application ID is “%s”"), MICROSOFT365_CLIENT_ID));
+ g_strdup_printf (_("Default application ID is “%s”"), OFFICE365_CLIENT_ID));
widget = gtk_label_new_with_mnemonic (_("_Redirect URI:"));
gtk_widget_set_margin_left (widget, 12);
@@ -392,9 +392,9 @@ mail_config_ews_backend_insert_widgets (EMailConfigServiceBackend *backend,
G_BINDING_SYNC_CREATE);
markup = g_strdup_printf (_("Default redirect URI is “%s”"),
"https://login.microsoftonline.com/common/oauth2/nativeclient");
- mail_config_ews_backend_set_oauth2_tooltip (widget, MICROSOFT365_REDIRECT_URI,
+ mail_config_ews_backend_set_oauth2_tooltip (widget, OFFICE365_REDIRECT_URI,
markup,
- g_strdup_printf (_("Default redirect URI is “%s”"), MICROSOFT365_REDIRECT_URI));
+ g_strdup_printf (_("Default redirect URI is “%s”"), OFFICE365_REDIRECT_URI));
g_free (markup);
gtk_widget_show_all (GTK_WIDGET (priv->oauth2_settings_grid));
@@ -610,7 +610,7 @@ mail_config_ews_backend_check_complete (EMailConfigServiceBackend *backend)
if (camel_ews_settings_get_override_oauth2 (ews_settings)) {
client_id = camel_ews_settings_get_oauth2_client_id (ews_settings);
} else {
- client_id = MICROSOFT365_CLIENT_ID;
+ client_id = OFFICE365_CLIENT_ID;
}
correct = client_id && *client_id;
diff --git a/src/server/e-oauth2-service-office365.c b/src/server/e-oauth2-service-office365.c
index 9dcfc46e..8f3a3d8f 100644
--- a/src/server/e-oauth2-service-office365.c
+++ b/src/server/e-oauth2-service-office365.c
@@ -119,7 +119,7 @@ eos_office365_get_client_id (EOAuth2Service *service,
return eos_office365_cache_string (oauth2_office365, client_id);
}
- return MICROSOFT365_CLIENT_ID;
+ return OFFICE365_CLIENT_ID;
}
static const gchar *
@@ -149,14 +149,14 @@ eos_office365_get_authentication_uri (EOAuth2Service *service,
res = eos_office365_cache_string (oauth2_office365,
g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/authorize",
- tenant ? tenant : MICROSOFT365_TENANT));
+ tenant ? tenant : OFFICE365_TENANT));
g_free (tenant);
return res;
}
- return "https://login.microsoftonline.com/" MICROSOFT365_TENANT "/oauth2/authorize";
+ return "https://login.microsoftonline.com/" OFFICE365_TENANT "/oauth2/authorize";
}
static const gchar *
@@ -179,14 +179,14 @@ eos_office365_get_refresh_uri (EOAuth2Service *service,
res = eos_office365_cache_string (oauth2_office365,
g_strdup_printf ("https://login.microsoftonline.com/%s/oauth2/token",
- tenant ? tenant : MICROSOFT365_TENANT));
+ tenant ? tenant : OFFICE365_TENANT));
g_free (tenant);
return res;
}
- return "https://login.microsoftonline.com/" MICROSOFT365_TENANT "/oauth2/token";
+ return "https://login.microsoftonline.com/" OFFICE365_TENANT "/oauth2/token";
}
static const gchar *
@@ -212,7 +212,7 @@ eos_office365_get_redirect_uri (EOAuth2Service *service,
return eos_office365_cache_string (oauth2_office365, redirect_uri);
}
- res = MICROSOFT365_REDIRECT_URI;
+ res = OFFICE365_REDIRECT_URI;
if (res && *res)
return res;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]