core/ppl: add groups criterion (#4916)

* core/ppl: add groups criterion

* remove dead code

* add additional test
This commit is contained in:
Caleb Doxsey 2024-01-30 09:40:15 -07:00 committed by GitHub
parent 3ca2f2462d
commit 6a833b365a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 268 additions and 109 deletions

View file

@ -4,6 +4,8 @@ import (
"testing"
"github.com/stretchr/testify/require"
"github.com/pomerium/pomerium/pkg/grpc/databroker"
)
func TestHTTPPath(t *testing.T) {
@ -13,7 +15,7 @@ allow:
and:
- http_path:
is: /test
`, []dataBrokerRecord{}, Input{HTTP: InputHTTP{Path: "/test"}})
`, []*databroker.Record{}, Input{HTTP: InputHTTP{Path: "/test"}})
require.NoError(t, err)
require.Equal(t, A{true, A{ReasonHTTPPathOK}, M{}}, res["allow"])
require.Equal(t, A{false, A{}}, res["deny"])
@ -24,7 +26,7 @@ allow:
and:
- http_path:
is: /test
`, []dataBrokerRecord{}, Input{HTTP: InputHTTP{Path: "/not-test"}})
`, []*databroker.Record{}, Input{HTTP: InputHTTP{Path: "/not-test"}})
require.NoError(t, err)
require.Equal(t, A{false, A{ReasonHTTPPathUnauthorized}, M{}}, res["allow"])
require.Equal(t, A{false, A{}}, res["deny"])