Guides
Filter EF queries with FGA
Apply authorization filters in LINQ so access checks run in SQL.
You'll learn how to build an FGA filter and apply it in EF Core queries for list and detail endpoints.
ISqlOSFgaAuthService available in your APIList endpoints return only rows the current subject may read — in one SQL round-trip.
Inject ISqlOSFgaAuthService in your endpoint or service.
Build a filter for the entity type:
var filter = await fgaAuth.GetAuthorizationFilterAsync<Project>(
subjectId: userId,
permissionKey: "project.read");
var projects = await db.Projects
.Where(filter)
.Where(p => p.IsActive)
.OrderBy(p => p.Name)
.Take(20)
.ToListAsync();Point checks for single-resource actions use CheckAccessAsync (see Checking a permission).
Verify with the access tester in /sqlos/admin/fga/.
PagedSpec