[evolution-data-server] ESoupSession: Avoid downgrade of Bearer (OAuth2) auth for authentication



commit b9e53da5d7d5c8dd64a4c76578de30c092e1e685
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 20 15:09:44 2022 +0200

    ESoupSession: Avoid downgrade of Bearer (OAuth2) auth for authentication
    
    When the OAuth2 token expires, the libsoup is notified about it and
    it can re-authenticate, but this time using a different SoupAuth,
    which is not desired here, because the OAuth2 is supposed to be used.

 src/libedataserver/e-soup-session.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/libedataserver/e-soup-session.c b/src/libedataserver/e-soup-session.c
index c8f02a85c..1a861c3f8 100644
--- a/src/libedataserver/e-soup-session.c
+++ b/src/libedataserver/e-soup-session.c
@@ -416,6 +416,11 @@ e_soup_session_authenticate_cb (SoupMessage *message,
                g_warn_if_fail ((gpointer) session->priv->using_bearer_auth == (gpointer) auth);
                g_clear_object (&session->priv->using_bearer_auth);
                session->priv->using_bearer_auth = E_SOUP_AUTH_BEARER (auth);
+       } else if (session->priv->using_bearer_auth) {
+               /* This can mean the bearer auth expired, then a Basic auth is used by the libsoup;
+                  that's not meant to be done here, thus fail early. */
+               g_mutex_unlock (&session->priv->property_lock);
+               return FALSE;
        }
 
        if (retrying && !session->priv->auth_prefilled) {


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