-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Describe the problem you'd like to have solved
In multitenant solutions it would be nice to have a single client instance and the possibility to set the store id for each request, this way the connection pool can be reused without the need to have multiple client instances.
Describe the ideal solution
The store id should available as a client option:
var request = new ClientCheckRequest()
.user("user:81684243-9356-4421-8fbf-a4f8d36aa31b")
.relation("writer")
._object("document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a");
var options = new ClientCheckOptions()
.additionalHeaders(Map.of("Some-Http-Header", "Some value"))
// You can rely on the model id set in the configuration or override it for this specific request
.authorizationModelId("01GXSA8YR785C4FYS3C0RTG7B1")
// SET THE STORE ID PER REQUEST
.storeId("01ARZ3NDEKTSV4RRFFQ69G5FAV");
var response = fgaClient.check(request, options).get();
// response.getAllowed() = trueAlternatives and current workarounds
There are two alternatives:
- Having one client for each store id
- Explicitly calling
fgaClient.setStoreId(store.getId());on each request, but my guess is there could be race condition issues
Additional context
N/A
MarcoChava
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
On deck