[virt-tools-list] [PATCH virt-viewer v3 2/2] ovirt: Allow to cancel authentication without showing error dialog
Christophe Fergeau
cfergeau at redhat.com
Thu Mar 19 14:27:50 UTC 2015
Hi,
On Thu, Mar 19, 2015 at 08:24:07AM -0400, Pavel Grunt wrote:
> >
> > 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));
> }
I commented in the bug that you filed for that:
https://bugzilla.gnome.org/show_bug.cgi?id=746455
« I think it could sometimes be valid to try to authenticate with no
username/password?
Maybe introducing rest_proxy_auth_cancel() in the public API would be
better? »
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20150319/8273e132/attachment.sig>
More information about the virt-tools-list
mailing list