[epiphany/wip/sync-rebase: 16/74] sync-service: Add X-Client-State header to Token Server requests
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/sync-rebase: 16/74] sync-service: Add X-Client-State header to Token Server requests
- Date: Thu, 29 Sep 2016 17:44:09 +0000 (UTC)
commit 295fd6c9173a7f41d4e401e95ccda8624eff3b16
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Thu Jul 21 19:21:23 2016 +0300
sync-service: Add X-Client-State header to Token Server requests
src/ephy-sync-service.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/ephy-sync-service.c b/src/ephy-sync-service.c
index f3eabcf..eaab204 100644
--- a/src/ephy-sync-service.c
+++ b/src/ephy-sync-service.c
@@ -301,13 +301,24 @@ query_token_server (EphySyncService *self,
JsonParser *parser;
JsonNode *root;
JsonObject *object;
+ guint8 *kB;
+ gchar *hashed_kB;
+ gchar *client_state;
gchar *authorization;
gboolean retval = FALSE;
g_return_val_if_fail (assertion != NULL, FALSE);
- message = soup_message_new (SOUP_METHOD_GET, TOKEN_SERVER_URL);
+ kB = ephy_sync_utils_decode_hex (ephy_sync_service_get_token (self, EPHY_SYNC_TOKEN_KB));
+ hashed_kB = g_compute_checksum_for_data (G_CHECKSUM_SHA256, kB, EPHY_SYNC_TOKEN_LENGTH);
+ client_state = g_strndup (hashed_kB, EPHY_SYNC_TOKEN_LENGTH);
authorization = g_strdup_printf ("BrowserID %s", assertion);
+
+ message = soup_message_new (SOUP_METHOD_GET, TOKEN_SERVER_URL);
+ /* We need to add the X-Client-State header so that the Token Server will
+ * recognize accounts that were previously used to sync Firefox data too. */
+ soup_message_headers_append (message->request_headers,
+ "X-Client-State", client_state);
soup_message_headers_append (message->request_headers,
"authorization", authorization);
soup_session_send_message (self->soup_session, message);
@@ -359,6 +370,9 @@ query_token_server (EphySyncService *self,
retval = TRUE;
out:
+ g_free (kB);
+ g_free (hashed_kB);
+ g_free (client_state);
g_free (authorization);
g_object_unref (parser);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]