authenticator: Pass remote name to RequestRefTokens

This makes it very easy to reuse a single authenticator for several
remotes. This is useful for the a default authenticator implementation
that we can ship with flatpak and use for e.g. flathub.
This commit is contained in:
Alexander Larsson
2019-11-04 15:46:16 +01:00
committed by Alexander Larsson
parent 3411cf0336
commit b77f7c9383
5 changed files with 6 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ FlatpakAuthenticatorRequest *flatpak_auth_create_request (FlatpakAuth
GError **error);
gboolean flatpak_auth_request_ref_tokens (FlatpakAuthenticator *authenticator,
FlatpakAuthenticatorRequest *request,
const char *remote,
const char **refs,
GCancellable *cancellable,
GError **error);

View File

@@ -129,6 +129,7 @@ flatpak_auth_create_request (FlatpakAuthenticator *authenticator,
gboolean
flatpak_auth_request_ref_tokens (FlatpakAuthenticator *authenticator,
FlatpakAuthenticatorRequest *request,
const char *remote,
const char **refs,
GCancellable *cancellable,
GError **error)
@@ -141,7 +142,7 @@ flatpak_auth_request_ref_tokens (FlatpakAuthenticator *authenticator,
options = g_object_get_data (G_OBJECT (authenticator), "authenticator-options");
if (!flatpak_authenticator_call_request_ref_tokens_sync (authenticator, token, options, refs,
if (!flatpak_authenticator_call_request_ref_tokens_sync (authenticator, token, options, remote, refs,
&handle, cancellable, error))
return FALSE;

View File

@@ -2810,7 +2810,7 @@ request_tokens_for_remote (FlatpakTransaction *self,
priv->active_webflow = &data;
data.request = request;
if (!flatpak_auth_request_ref_tokens (authenticator, request, (const char **)refs->pdata, cancellable, error))
if (!flatpak_auth_request_ref_tokens (authenticator, request, remote, (const char **)refs->pdata, cancellable, error))
return FALSE;
while (!data.done)

View File

@@ -175,6 +175,7 @@
<method name="RequestRefTokens">
<arg type='s' name='handle_token' direction='in'/>
<arg type='a{sv}' name='authenticator_options' direction='in'/>
<arg type='s' name='remote' direction='in'/>
<arg type='as' name='refs' direction='in'/>
<arg type='o' name='handle' direction='out'/>
</method>

View File

@@ -172,6 +172,7 @@ handle_request_ref_tokens (FlatpakAuthenticator *authenticator,
GDBusMethodInvocation *invocation,
const gchar *arg_handle_token,
GVariant *arg_authenticator_option,
const gchar *arg_remote,
const gchar *const *arg_refs)
{
g_autoptr(GError) error = NULL;