[virt-tools-list] [PATCH virt-viewer v3 2/2] ovirt: Allow to cancel authentication without showing error dialog
Pavel Grunt
pgrunt at redhat.com
Thu Mar 19 12:24:07 UTC 2015
>
> Hey,
>
>
> librest merely wraps
> https://developer.gnome.org/libsoup/stable/SoupSession.html#SoupSession-authenticate
> It seems with libsoup, one would be able to use
> soup_session_cancel_message() from the authenticate callback to
> return
> an error code:
> https://developer.gnome.org/libsoup/stable/SoupSession.html#soup-session-cancel-message
>
> Christophe
>
Thank you Christophe, I am able to get CANCELLED from ovirt_proxy_fetch_api() using a patch:
diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index 81d487d..87b53e5 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -236,8 +236,12 @@ authenticate (RestProxy *self,
rest_auth = rest_proxy_auth_new (self, session, msg, soup_auth);
g_signal_emit(self, signals[AUTHENTICATE], 0, rest_auth, retrying, &try_auth);
- if (try_auth && !rest_proxy_auth_is_paused (rest_auth))
- soup_auth_authenticate (soup_auth, priv->username, priv->password);
+ if (try_auth && !rest_proxy_auth_is_paused (rest_auth)) {
+ if (priv->username != NULL && priv->password != NULL)
+ soup_auth_authenticate (soup_auth, priv->username, priv->password);
+ else
+ soup_session_cancel_message (session, msg, SOUP_STATUS_CANCELLED);
+ }
g_object_unref (G_OBJECT (rest_auth));
}
More information about the virt-tools-list
mailing list