Various updates

- rebrand group to domain
- move IAM to the API (rest and graph) for enforcing "process:" rules
- add abstraction layer for restream store in order to decouple internal format from format on disk
- move playout handler into restreamHandler
- remove user from restream interface
- add TaskID type that includes the process id and its domain
This commit is contained in:
Ingo Oppermann
2023-05-23 15:47:06 +02:00
parent 6f831fd190
commit ccac2ffd5d
36 changed files with 1822 additions and 1001 deletions

View File

@@ -3,11 +3,14 @@ package api
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"testing"
"github.com/datarhei/core/v16/http/api"
"github.com/datarhei/core/v16/http/mock"
"github.com/datarhei/core/v16/iam"
"github.com/datarhei/core/v16/io/fs"
"github.com/labstack/echo/v4"
"github.com/stretchr/testify/require"
@@ -25,7 +28,29 @@ func getDummyRestreamHandler() (*RestreamHandler, error) {
return nil, err
}
handler := NewRestream(rs)
memfs, err := fs.NewMemFilesystem(fs.MemConfig{})
if err != nil {
return nil, fmt.Errorf("failed to create memory filesystem: %w", err)
}
iam, err := iam.NewIAM(iam.Config{
FS: memfs,
Superuser: iam.User{
Name: "foobar",
},
JWTRealm: "",
JWTSecret: "",
Logger: nil,
})
if err != nil {
return nil, err
}
iam.AddPolicy("$anon", "$none", "api:/**", []string{"ANY"})
iam.AddPolicy("$anon", "$none", "fs:/**", []string{"ANY"})
iam.AddPolicy("$anon", "$none", "process:**", []string{"ANY"})
handler := NewRestream(rs, iam)
return handler, nil
}