@@ -14,6 +14,7 @@ import (
14
14
15
15
"github.com/cedar-policy/cedar-go"
16
16
"github.com/cedar-policy/cedar-go/internal/testutil"
17
+ "github.com/cedar-policy/cedar-go/types"
17
18
"github.com/cedar-policy/cedar-go/x/exp/batch"
18
19
)
19
20
@@ -244,6 +245,7 @@ func TestCorpusRelated(t *testing.T) {
244
245
tests := []struct {
245
246
name string
246
247
policy string
248
+ entities types.EntityGetter
247
249
request cedar.Request
248
250
decision cedar.Decision
249
251
reasons []cedar.PolicyID
@@ -258,6 +260,7 @@ func TestCorpusRelated(t *testing.T) {
258
260
) when {
259
261
(true && (((!870985681610) == principal) == principal)) && principal
260
262
};` ,
263
+ nil ,
261
264
cedar.Request {Principal : cedar .NewEntityUID ("a" , "\u0000 \u0000 " ), Action : cedar .NewEntityUID ("Action" , "action" ), Resource : cedar .NewEntityUID ("a" , "\u0000 \u0000 " )},
262
265
cedar .Deny ,
263
266
nil ,
@@ -273,6 +276,7 @@ func TestCorpusRelated(t *testing.T) {
273
276
) when {
274
277
(((!870985681610) == principal) == principal)
275
278
};` ,
279
+ nil ,
276
280
cedar.Request {Principal : cedar .NewEntityUID ("a" , "\u0000 \u0000 " ), Action : cedar .NewEntityUID ("Action" , "action" ), Resource : cedar .NewEntityUID ("a" , "\u0000 \u0000 " )},
277
281
cedar .Deny ,
278
282
nil ,
@@ -287,6 +291,7 @@ func TestCorpusRelated(t *testing.T) {
287
291
) when {
288
292
((!870985681610) == principal)
289
293
};` ,
294
+ nil ,
290
295
cedar.Request {Principal : cedar .NewEntityUID ("a" , "\u0000 \u0000 " ), Action : cedar .NewEntityUID ("Action" , "action" ), Resource : cedar .NewEntityUID ("a" , "\u0000 \u0000 " )},
291
296
cedar .Deny ,
292
297
nil ,
@@ -302,6 +307,7 @@ func TestCorpusRelated(t *testing.T) {
302
307
) when {
303
308
(!870985681610)
304
309
};` ,
310
+ nil ,
305
311
cedar.Request {Principal : cedar .NewEntityUID ("a" , "\u0000 \u0000 " ), Action : cedar .NewEntityUID ("Action" , "action" ), Resource : cedar .NewEntityUID ("a" , "\u0000 \u0000 " )},
306
312
cedar .Deny ,
307
313
nil ,
@@ -317,6 +323,7 @@ func TestCorpusRelated(t *testing.T) {
317
323
) when {
318
324
((!42) == principal)
319
325
};` ,
326
+ nil ,
320
327
cedar.Request {},
321
328
cedar .Deny ,
322
329
nil ,
@@ -332,6 +339,7 @@ func TestCorpusRelated(t *testing.T) {
332
339
) when {
333
340
(!42 == principal)
334
341
};` ,
342
+ nil ,
335
343
cedar.Request {},
336
344
cedar .Deny ,
337
345
nil ,
@@ -346,6 +354,7 @@ func TestCorpusRelated(t *testing.T) {
346
354
) when {
347
355
true && ((if (principal in action) then (ip("")) else (if true then (ip("6b6b:f00::32ff:ffff:6368/00")) else (ip("7265:6c69:706d:6f43:5f74:6f70:7374:6f68")))).isMulticast())
348
356
};` ,
357
+ nil ,
349
358
cedar.Request {Principal : cedar .NewEntityUID ("a" , "\u0000 \b \u0011 \u0000 R" ), Action : cedar .NewEntityUID ("Action" , "action" ), Resource : cedar .NewEntityUID ("a" , "\u0000 \b \u0011 \u0000 R" )},
350
359
cedar .Deny ,
351
360
nil ,
@@ -360,6 +369,7 @@ func TestCorpusRelated(t *testing.T) {
360
369
) when {
361
370
true && ip("6b6b:f00::32ff:ffff:6368/00").isMulticast()
362
371
};` ,
372
+ nil ,
363
373
cedar.Request {},
364
374
cedar .Deny ,
365
375
nil ,
@@ -386,7 +396,7 @@ func TestCorpusRelated(t *testing.T) {
386
396
t .Parallel ()
387
397
policy , err := cedar .NewPolicySetFromBytes ("" , []byte (tt .policy ))
388
398
testutil .OK (t , err )
389
- ok , diag := policy .IsAuthorized (cedar. EntityMap {} , tt .request )
399
+ ok , diag := policy .IsAuthorized (tt . entities , tt .request )
390
400
testutil .Equals (t , ok , tt .decision )
391
401
var reasons []cedar.PolicyID
392
402
for _ , n := range diag .Reasons {
0 commit comments