-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFgaExample.java
More file actions
24 lines (18 loc) · 774 Bytes
/
Copy pathFgaExample.java
File metadata and controls
24 lines (18 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package example;
import dev.openfga.sdk.api.client.OpenFgaClient;
import dev.openfga.sdk.api.client.model.ClientCheckRequest;
import dev.openfga.sdk.api.client.model.ClientTupleKey;
import dev.openfga.sdk.api.configuration.ClientConfiguration;
public class FgaExample {
public static void main(String[] args) throws Exception {
var config = new ClientConfiguration()
.apiUrl("http://localhost:8080");
var client = new OpenFgaClient(config);
var request = new ClientCheckRequest()
.user("user:anne")
.relation("viewer")
._object("document:roadmap");
Boolean allowed = client.check(request).get().getAllowed();
System.out.println("Allowed: " + allowed);
}
}