Closed JK-Chung closed 1 year ago
The tests do so in a similar fashion here: https://github.com/authzed/authzed-java/blob/main/src/intTest/java/V1ClientTest.java#L54
What version of the client and of Java are you using?
Yes, the test code matches up with the README and my understanding of using the stub.
I'm using Java 17 and the 0.3.0 version of the JAR. Is the issue with PermissionsServiceBlockingStub class? On inspection, there is no withCallCredentials() method
public static final class PermissionsServiceBlockingStub extends AbstractBlockingStub<PermissionsServiceBlockingStub> {
private PermissionsServiceBlockingStub(Channel channel, CallOptions callOptions) {
super(channel, callOptions);
}
protected PermissionsServiceBlockingStub build(Channel channel, CallOptions callOptions) {
return new PermissionsServiceBlockingStub(channel, callOptions);
}
public Iterator<PermissionService.ReadRelationshipsResponse> readRelationships(PermissionService.ReadRelationshipsRequest request) {
return ClientCalls.blockingServerStreamingCall(this.getChannel(), PermissionsServiceGrpc.getReadRelationshipsMethod(), this.getCallOptions(), request);
}
public PermissionService.WriteRelationshipsResponse writeRelationships(PermissionService.WriteRelationshipsRequest request) {
return (PermissionService.WriteRelationshipsResponse)ClientCalls.blockingUnaryCall(this.getChannel(), PermissionsServiceGrpc.getWriteRelationshipsMethod(), this.getCallOptions(), request);
}
public PermissionService.DeleteRelationshipsResponse deleteRelationships(PermissionService.DeleteRelationshipsRequest request) {
return (PermissionService.DeleteRelationshipsResponse)ClientCalls.blockingUnaryCall(this.getChannel(), PermissionsServiceGrpc.getDeleteRelationshipsMethod(), this.getCallOptions(), request);
}
public PermissionService.CheckPermissionResponse checkPermission(PermissionService.CheckPermissionRequest request) {
return (PermissionService.CheckPermissionResponse)ClientCalls.blockingUnaryCall(this.getChannel(), PermissionsServiceGrpc.getCheckPermissionMethod(), this.getCallOptions(), request);
}
public PermissionService.ExpandPermissionTreeResponse expandPermissionTree(PermissionService.ExpandPermissionTreeRequest request) {
return (PermissionService.ExpandPermissionTreeResponse)ClientCalls.blockingUnaryCall(this.getChannel(), PermissionsServiceGrpc.getExpandPermissionTreeMethod(), this.getCallOptions(), request);
}
public Iterator<PermissionService.LookupResourcesResponse> lookupResources(PermissionService.LookupResourcesRequest request) {
return ClientCalls.blockingServerStreamingCall(this.getChannel(), PermissionsServiceGrpc.getLookupResourcesMethod(), this.getCallOptions(), request);
}
public Iterator<PermissionService.LookupSubjectsResponse> lookupSubjects(PermissionService.LookupSubjectsRequest request) {
return ClientCalls.blockingServerStreamingCall(this.getChannel(), PermissionsServiceGrpc.getLookupSubjectsMethod(), this.getCallOptions(), request);
}
}
Same problem here.
To be able to use GRPC, additional imports are necessary (taken from GRPC Java example):
implementation "com.authzed.api:authzed:0.4.0"
implementation 'io.grpc:grpc-protobuf:1.54.0'
implementation 'io.grpc:grpc-stub:1.54.0'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53'
runtimeOnly 'io.grpc:grpc-netty-shaded:1.54.0'
Please update this example with a working one. When checking this code out, it does not compile as no Authzed classes are found (V1ClientTest.java
). After adding implementation "com.authzed.api:authzed:0.4.0"
to the build.gradle
file as dependency, this is fixed too.
Hello,
The README says that to provide Bearer Tokens to PermissionsServiceBlockingStub, the withCallCredentials() method is to be called on that object (as below):
However, on inspecting the code for PermissionsServiceBlockingStub, no such method exists. As such, there doesn't seem to be a way of providing this.
The same issue applies to similar classes like SchemaServiceBlockingStub