curl -G \
--data-urlencode "subject=john" \
--data-urlencode "relation=access" \
--data-urlencode "namespace=files" \
--data-urlencode "object=file_a" \
http://keto-read-api/check
import ...
const checkClient = new checkService.CheckServiceClient('keto-read-api')
const checkRequest = new checkData.CheckRequest()
checkRequest.setNamespace('files')
checkRequest.setObject('file_a')
checkRequest.setRelation('access')
const sub = new acl.Subject()
sub.setId('john')
checkRequest.setSubject(sub)
checkClient.check(checkRequest, (error, resp) => {
if (error) {
console.log('Encountered error:', error)
} else {
console.log(resp.getAllowed() ? 'Allowed' : 'Denied')
}
})
package main
import (...)
func main() {
conn, err := grpc.Dial("keto-read-api")
if err != nil {
panic(err.Error())
}
client := acl.NewCheckServiceClient(conn)
res, err := client.Check(context.Background(),
&acl.CheckRequest{
Namespace: "files",
Object: "file_a",
Relation: "access",
Subject: &acl.Subject{Ref: &acl.Subject_Id{
Id: "john",
}},
},
})
if err != nil {
panic(err.Error())
}
if res.Allowed {
fmt.Println("Allowed")
return
}
fmt.Println("Denied")
}