appcenter-reviews
appcenter-reviews copied to clipboard
Configure Flatmanager to support authenticators
According to https://github.com/flatpak/flatpak/wiki/TestingPurchases, we need to specify that the things we build into the repo require a token
add this line to the example repo config here:
"require-auth-for-token-types": [2],
This will make flat-manager require a token matching the ref for all commits with token-type 2.
Now, build something we want to test, I'm using eye of gnome as an example here:
$ flatpak-builder --repo build-repo builddir org.gnome.eog.yml
Then import and publish the build into flat-manager with a token type of 2:
$ export REPO_TOKEN=$(echo -n "secret" | base64 | cargo run --bin gentoken -- --base64 --secret-file - --name test)
$ flat-manager-client push --publish --wait-update --token-type=2 $(flat-manager-client create http://127.0.0.1:8080 stable) build-repo
We can verify that this commit gets a 403 error: (replace with your commit ids)
$ cat repo/refs/heads/app/org.gnome.eog/x86_64/master 32820032f58cb1229edffdc66dc829b29a8cce9f8b6d9f36342d76a004b61d01
$ curl http://127.0.0.1:8080/repo/stable/objects/32/820032f58cb1229edffdc66dc829b29a8cce9f8b6d9f36342d76a004b61d01.commit
{"error-type":"token-insufficient","message":"Not enough permissions: No token specified","status":403}