authzed / authzed-java Goto Github PK
View Code? Open in Web Editor NEWOfficial SpiceDB client library for JVM languages
Home Page: https://docs.authzed.com/reference/api
License: Apache License 2.0
Official SpiceDB client library for JVM languages
Home Page: https://docs.authzed.com/reference/api
License: Apache License 2.0
LookupSubjectsRequest in the v1 api schema describes the field optional_concrete_limit
that was not included in the generated java classes when v0.5.0 was published.
Interestingly, the similarly named optional_limit
field in the LookupResourcesRequest counterpart was included in the respective generated code.
I've attached PermissionService.zip with the generated code in case it helps.
At the time of writing, it seems the only way to get the Javadoc for the generated bindings from the protobuf API -- that is, everything from the com.authzed.api.v1
package -- is to check out the repo and build them locally. While this works, it's a somewhat tedious flow for users who do not intend to make changes and only want to use the published library from public repos (i.e. Maven).
It would make transitioning from the provided examples to self-written code a little smoother if the Javadoc were more readily available.
Hi, thanks for making this great repo.
The readme instructions say to add the following maven dependency:
<dependency>
<groupId>com.authzed.api</groupId>
<artifactId>authzed</artifactId>
<version>0.0.1</version>
</dependency>
and to import the following libraries:
import com.authzed.api.v0.ACLServiceGrpc;
import com.authzed.grpcutil.BearerToken;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
As far as I can tell, com.authzed.grpcutil.BearerToken
is not present in the com.authzed.api
jar so the only option is to get the source code and add it to the project manually.
If I have missed something please let me know, but otherwise I think it would be a lot more convenient if BearerToken
was included in either com.authzed.api
or its own maven dependency. I also looked for a com.authzed.grpcutil
on maven but could not find anything.
How do I disable noisy DEBUG logs like these:
│ 11:33:51.444 [grpc-nio-worker-ELG-1-2] DEBUG i.g.n.s.i.g.netty.NettyClientHandler - [id: 0x4ecdf329, L:/127.0.0.1:62354 - R:localhost/127.0.0.1:50051] INBOUND HEADERS: streamId=109 headers=GrpcHttp2ResponseHeaders[grpc-status: 0, grpc-message: , io.spicedb.respmeta.cachedoperationscount: 0, io.spicedb.respmeta.dispatchedoperationscount: 7] padding=0 endStream=true
│ 11:33:51.446 [grpc-nio-worker-ELG-1-2] DEBUG i.g.n.s.i.g.netty.NettyClientHandler - [id: 0x4ecdf329, L:/127.0.0.1:62354 - R:localhost/127.0.0.1:50051] OUTBOUND HEADERS: streamId=111 headers=GrpcHttp2OutboundHeaders[:authority: localhost:50051, :path: /authzed.api.v1.PermissionsService/ExpandPermissionTree, :method: POST, :scheme: http, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.55.1, grpc-accept-encoding: gzip, authorization: Bearer spicedb] streamDependency=0 weight=16 exclusive=false padding=0 endStream=false
│ 11:33:51.446 [grpc-nio-worker-ELG-1-2] DEBUG i.g.n.s.i.g.netty.NettyClientHandler - [id: 0x4ecdf329, L:/127.0.0.1:62354 - R:localhost/127.0.0.1:50051] OUTBOUND DATA: streamId=111 padding=0 endStream=true length=42 bytes=00000000250a02200112170a06736572766572120d6e6f742d6d792d7365727665721a067265626f6f74
│ 11:33:51.447 [grpc-nio-worker-ELG-1-2] DEBUG i.g.n.s.i.g.netty.NettyClientHandler - [id: 0x4ecdf329, L:/127.0.0.1:62354 - R:localhost/127.0.0.1:50051] INBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=42
I'm using the Java AuthZed client from Clojure. I see that authzed-java uses java.util.logging.Logger
, which according to this answer on SO supports a logging.properties
file, but then you have to pass an argument to the Java call. I'm not sure how to do this.
Every initialized Java client will require setting up a Bearer Token with an API Token.
This is a bunch of boilerplate that we take care of in other languages, so we should also do so for Java.
Hello,
The README says that to provide Bearer Tokens to PermissionsServiceBlockingStub, the withCallCredentials() method is to be called on that object (as below):
import com.authzed.api.v1.PermissionsServiceGrpc;
import com.authzed.grpcutil.BearerToken;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
...
ManagedChannel channel = ManagedChannelBuilder
.forTarget("grpc.authzed.com:443")
.useTransportSecurity()
.build();
PermissionsServiceGrpc.PermissionsServiceBlockingStub permissionsService = PermissionsServiceGrpc.newBlockingStub(channel)
.withCallCredentials(new BearerToken("t_your_token_here_1234567deadbeef"));
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
Examples that are not just in java, but also Clojure or Scala will be very helpful for those ecosystems.
Java client shows me that
io.grpc.stub.StreamObserver<com.authzed.api.v1.ExperimentalServiceOuterClass.BulkImportRelationshipsResponse>
Response object required for request.
That's confusing me.
Doesn't request object should be?
Any answer appreciated
When pulling in the library versions described in the README.md
file, trying to make rpcs will result in errors that look like the following:
java.lang.NoSuchFieldError: NAME_RESOLUTION_DELAYED
at io.grpc.internal.ManagedChannelImpl$RealChannel$PendingCall.reprocess(ManagedChannelImpl.java:1089) ~[grpc-core-1.55.1.jar:1.55.1]
at io.grpc.internal.ManagedChannelImpl$RealChannel.updateConfigSelector(ManagedChannelImpl.java:1019) ~[grpc-core-1.55.1.jar:1.55.1]
at io.grpc.internal.ManagedChannelImpl$NameResolverListener$1NamesResolved.run(ManagedChannelImpl.java:1816) ~[grpc-core-1.55.1.jar:1.55.1]
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95) ~[grpc-api-1.54.1.jar:1.54.1]
at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127) ~[grpc-api-1.54.1.jar:1.54.1]
at io.grpc.internal.ManagedChannelImpl$NameResolverListener.onResult(ManagedChannelImpl.java:1868) ~[grpc-core-1.55.1.jar:1.55.1]
at io.grpc.internal.RetryingNameResolver$RetryingListener.onResult(RetryingNameResolver.java:98) ~[grpc-core-1.55.1.jar:1.55.1]
at io.grpc.internal.DnsNameResolver$Resolve.run(DnsNameResolver.java:333) ~[grpc-core-1.55.1.jar:1.55.1]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:1589) ~[na:na]
dependencies {
implementation "com.authzed.api:authzed:0.5.0"
implementation 'io.grpc:grpc-protobuf:1.54.1'
implementation 'io.grpc:grpc-stub:1.54.1'
}
CheckPermissionRequest
rpcUpdate the README.md
to point to the grpc version in https://github.com/authzed/authzed-java/blob/main/build.gradle#L80-L97 from the above to the following:
dependencies {
implementation "com.authzed.api:authzed:0.5.0"
implementation 'io.grpc:grpc-protobuf:1.55.1'
implementation 'io.grpc:grpc-stub:1.55.1'
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.