Auth: Add CLI command to create access tokens for apps #782 #808 #3943

You can now run "photoprism auth add" to create new client access tokens
that allow external applications to use the built-in REST API.

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2024-01-05 16:31:07 +01:00
parent d6ec8c069e
commit 713593da4e
117 changed files with 2528 additions and 938 deletions

View File

@@ -11,7 +11,7 @@ func TestPhotoUnstack(t *testing.T) {
t.Run("unstack xmp sidecar file", func(t *testing.T) {
app, router, _ := NewApiTest()
PhotoUnstack(router)
r := PerformRequest(app, "POST", "/api/v1/photos/pt9jtdre2lvl0yh7/files/ft1es39w45bnlqdw/unstack")
r := PerformRequest(app, "POST", "/api/v1/photos/ps6sg6be2lvl0yh7/files/fs6sg6bw45bnlqdw/unstack")
// Sidecar files can not be unstacked.
assert.Equal(t, http.StatusBadRequest, r.Code)
// t.Logf("RESP: %s", r.Body.String())
@@ -20,7 +20,7 @@ func TestPhotoUnstack(t *testing.T) {
t.Run("unstack bridge3.jpg", func(t *testing.T) {
app, router, _ := NewApiTest()
PhotoUnstack(router)
r := PerformRequest(app, "POST", "/api/v1/photos/pt9jtdre2lvl0yh7/files/ft2es49whhbnlqdn/unstack")
r := PerformRequest(app, "POST", "/api/v1/photos/ps6sg6be2lvl0yh7/files/fs6sg6bwhhbnlqdn/unstack")
// TODO: Have a real file in place for testing the success case. This file does not exist, so it cannot be unstacked.
assert.Equal(t, http.StatusNotFound, r.Code)
// t.Logf("RESP: %s", r.Body.String())
@@ -29,7 +29,7 @@ func TestPhotoUnstack(t *testing.T) {
t.Run("not existing file", func(t *testing.T) {
app, router, _ := NewApiTest()
PhotoUnstack(router)
r := PerformRequest(app, "POST", "/api/v1/photos/pt9jtdre2lvl0yh7/files/xxx/unstack")
r := PerformRequest(app, "POST", "/api/v1/photos/ps6sg6be2lvl0yh7/files/xxx/unstack")
assert.Equal(t, http.StatusNotFound, r.Code)
// t.Logf("RESP: %s", r.Body.String())
})