From a807776cb1574a3a9ffbff9550b7cbf4a82846c5 Mon Sep 17 00:00:00 2001 From: Alexey Berezhok Date: Mon, 15 Apr 2024 13:56:33 +0300 Subject: [PATCH] Removed deprecated code form yandex provider --- configure.ac | 4 ++-- src/goabackend/goaoauth2handler.c | 6 ++++++ src/goabackend/goayandexprovider.c | 19 +++++-------------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 02c84a6..a8184e0 100644 --- a/configure.ac +++ b/configure.ac @@ -280,10 +280,10 @@ AC_ARG_WITH(yandex-client-secret, [], []) if test "$with_yandex_client_id" = ""; then - with_yandex_client_id=8ef866ab7a1f4d3b8fcb58510d422fbc + with_yandex_client_id=aab3f89a0d504003bfa3bb5326f68575 fi if test "$with_yandex_client_secret" = ""; then - with_yandex_client_secret=aa8be6b692dc4465b1fa40ae6ec7a377 + with_yandex_client_secret=4e6f4755f2ec457e9a80f0f43683fc32 fi AC_DEFINE_UNQUOTED(GOA_YANDEX_CLIENT_ID, ["$with_yandex_client_id"], [Yandex OAuth 2.0 client id]) AC_DEFINE_UNQUOTED(GOA_YANDEX_CLIENT_SECRET, ["$with_yandex_client_secret"], [Yandex OAuth 2.0 client secret]) diff --git a/src/goabackend/goaoauth2handler.c b/src/goabackend/goaoauth2handler.c index c5a86cb..20c89bc 100644 --- a/src/goabackend/goaoauth2handler.c +++ b/src/goabackend/goaoauth2handler.c @@ -59,6 +59,12 @@ oauth2_providers[] = .client_id = GOA_WINDOWS_LIVE_CLIENT_ID, .provider = GOA_WINDOWS_LIVE_NAME, }, +#endif +#ifdef GOA_YANDEX_ENABLED + { + .client_id = GOA_YANDEX_CLIENT_ID, + .provider = GOA_YANDEX_NAME, + }, #endif { NULL, NULL }, }; diff --git a/src/goabackend/goayandexprovider.c b/src/goabackend/goayandexprovider.c index fc78421..7f8ebdf 100644 --- a/src/goabackend/goayandexprovider.c +++ b/src/goabackend/goayandexprovider.c @@ -87,7 +87,7 @@ get_token_uri (GoaOAuth2Provider *oauth2_provider) static const gchar * get_redirect_uri (GoaOAuth2Provider *oauth2_provider) { - return "http://localhost"; + return "goa-oauth2://localhost/"GOA_YANDEX_CLIENT_ID; } static const gchar * @@ -99,7 +99,7 @@ get_scope (GoaOAuth2Provider *oauth2_provider) static guint get_credentials_generation (GoaProvider *provider) { - return 36; + return 37; } static const gchar * @@ -171,7 +171,7 @@ get_identity_sync (GoaOAuth2Provider *oauth2_provider, json_object = json_node_get_object (json_parser_get_root (parser)); if (!json_object_has_member (json_object, "default_email")) { - g_warning ("Did not find emails in JSON data"); + g_warning ("Did not find emails in JSON data (for yandex)"); g_set_error (error, GOA_ERROR, GOA_ERROR_FAILED, @@ -197,14 +197,6 @@ get_identity_sync (GoaOAuth2Provider *oauth2_provider, /* ---------------------------------------------------------------------------------------------------- */ -static gboolean -is_identity_node (GoaOAuth2Provider *oauth2_provider, WebKitDOMHTMLInputElement *element) -{ - return FALSE; -} - -/* ---------------------------------------------------------------------------------------------------- */ - static gboolean build_object (GoaProvider *provider, GoaObjectSkeleton *object, @@ -270,7 +262,7 @@ build_object (GoaProvider *provider, if (mail != NULL) goa_object_skeleton_set_mail (object, NULL); } - + /* Calendar */ calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL); uri_caldav = g_strconcat ("https://caldav.yandex.ru/", NULL); @@ -368,9 +360,8 @@ goa_yandex_provider_class_init (GoaYandexProviderClass *klass) oauth2_class->get_client_id = get_client_id; oauth2_class->get_client_secret = get_client_secret; oauth2_class->get_identity_sync = get_identity_sync; - oauth2_class->get_redirect_uri = get_redirect_uri; oauth2_class->get_scope = get_scope; - oauth2_class->is_identity_node = is_identity_node; oauth2_class->get_token_uri = get_token_uri; oauth2_class->add_account_key_values = add_account_key_values; + oauth2_class->get_redirect_uri = get_redirect_uri; } -- 2.43.0