feat(module,auth): authentication module with arbitrary claims support

This commit is contained in:
2023-02-24 14:40:28 +01:00
parent 7f07e52ae0
commit 640f429580
25 changed files with 558 additions and 261 deletions

View File

@ -2,9 +2,9 @@ package util
import (
"context"
"fmt"
"github.com/dop251/goja"
"github.com/pkg/errors"
)
func AssertType[T any](v goja.Value, rt *goja.Runtime) T {
@ -12,7 +12,7 @@ func AssertType[T any](v goja.Value, rt *goja.Runtime) T {
return c
}
panic(rt.NewTypeError(fmt.Sprintf("expected value to be a '%T', got '%T'", new(T), v.Export())))
panic(rt.ToValue(errors.Errorf("expected value to be a '%T', got '%T'", *new(T), v.Export())))
}
func AssertContext(v goja.Value, r *goja.Runtime) context.Context {