Skip to content

Commit

Permalink
OCI: Add an authenticator for OCI remotes
Browse files Browse the repository at this point in the history
Given a configuration like:

[remote "oci-remote"]
url=oci+http:https://some.server.com/api/v1/organization/foo?index=labels
xa.authenticator-name=org.flatpak.Authenticator.Oci
xa.default-token-type=1
xa.authenticator-options={"auth": <"a-token-here">}

I was able to install an app from an OCI remote that required a login
  • Loading branch information
alexlarsson committed Dec 12, 2019
1 parent 461a592 commit d25f65e
Show file tree
Hide file tree
Showing 6 changed files with 441 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ include app/Makefile.am.inc
include session-helper/Makefile.am.inc
include portal/Makefile.am.inc
include system-helper/Makefile.am.inc
include oci-authenticator/Makefile.am.inc
include icon-validator/Makefile.am.inc
include revokefs/Makefile.am.inc
include selinux/Makefile.am.inc
Expand Down
2 changes: 0 additions & 2 deletions common/flatpak-oci-registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,6 @@ flatpak_oci_registry_get_token (FlatpakOciRegistry *self,
{
g_autofree char *subpath = NULL;
g_autoptr(SoupURI) uri = NULL;
g_autoptr(GBytes) bytes = NULL;
g_autofree char *uri_s = NULL;
g_autoptr(GInputStream) stream = NULL;
g_autoptr(SoupMessage) msg = NULL;
g_autofree char *www_authenticate = NULL;
Expand Down
28 changes: 28 additions & 0 deletions oci-authenticator/Makefile.am.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
libexec_PROGRAMS += \
flatpak-oci-authenticator \
$(NULL)

service_in_files += oci-authenticator/flatpak-oci-authenticator.service.in
systemduserunit_DATA += oci-authenticator/flatpak-oci-authenticator.service

service_in_files += oci-authenticator/org.flatpak.Authenticator.Oci.service.in
dbus_service_DATA += oci-authenticator/org.flatpak.Authenticator.Oci.service

flatpak_oci_authenticator_SOURCES = \
oci-authenticator/flatpak-oci-authenticator.c \
$(NULL)

BUILT_SOURCES += $(nodist_flatpak_oci_authenticator_SOURCES)
CLEANFILES += $(nodist_flatpak_oci_authenticator_SOURCES)

flatpak_oci_authenticator_LDADD = $(AM_LDADD) $(BASE_LIBS) $(OSTREE_LIBS) libflatpak-common.la libflatpak-common-base.la libglnx.la
flatpak_oci_authenticator_CFLAGS = \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
$(OSTREE_CFLAGS) \
$(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
-DFLATPAK_COMPILATION \
-DDATADIR=\"$(datadir)\" \
$(NULL)
flatpak_oci_authenticator_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/oci-authenticator

0 comments on commit d25f65e

Please sign in to comment.