Authn: Sync authlib and update how we construct authn client interceptor (#101124)

* Sync authlib and update how we construct authn client interceptor

* Remove namespace from checker
This commit is contained in:
Karl Persson
2025-02-26 09:22:09 +01:00
committed by GitHub
parent a7ecb19c31
commit fa74d1c36d
25 changed files with 105 additions and 107 deletions
+4 -1
View File
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/assert"
authlib "github.com/grafana/authlib/types"
"github.com/grafana/grafana/pkg/apimachinery/utils"
)
func TestAuthzLimitedClient_Check(t *testing.T) {
@@ -27,6 +28,7 @@ func TestAuthzLimitedClient_Check(t *testing.T) {
req := authlib.CheckRequest{
Group: test.group,
Resource: test.resource,
Verb: utils.VerbGet,
}
resp, err := client.Check(context.Background(), nil, req)
assert.NoError(t, err)
@@ -52,12 +54,13 @@ func TestAuthzLimitedClient_Compile(t *testing.T) {
req := authlib.ListRequest{
Group: test.group,
Resource: test.resource,
Verb: utils.VerbGet,
}
checker, err := client.Compile(context.Background(), nil, req)
assert.NoError(t, err)
assert.NotNil(t, checker)
result := checker("namespace", "name", "folder")
result := checker("name", "folder")
assert.Equal(t, test.expected, result)
}
}