Need help for gRPC sample implementation.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with AuthServer and ExtAuthService.check, then inspect the AuthorizationGrpc service entry point used by the sample. Run the provided curl request against the server and compare the requested path with the registered service and method. Done means the request reaches the intended check implementation instead of returning “Method not found: check”.
Written by the indexing model from the issue text.
Description
I have written the sample code for authorisation using gRPC service. I was unable to find an easy way to implement the service.
import io.grpc.Server;
import io.grpc.ServerBuilder;
public class AuthServer {
public static void main(String[] args) throws Exception {
// Create a new server to listen on port 8081
Server server = ServerBuilder.forPort(5051)
.addService(new ExtAuthService())
.build();
// Start the server
server.start();
// Server threads are running in the background.
System.out
.println("+++++++++++++++++++++++ gRPC server started ++++++++++++++++++++++++++++");
// Don't exit the main thread. Wait until server is terminated.
server.awaitTermination();
}
}
The external authorisation service is follows.
import com.google.rpc.Status;
import io.envoyproxy.envoy.service.auth.v3.AuthorizationGrpc;
import io.envoyproxy.envoy.service.auth.v3.CheckRequest;
import io.envoyproxy.envoy.service.auth.v3.CheckResponse;
import io.envoyproxy.envoy.service.auth.v3.OkHttpResponse;
import io.grpc.stub.StreamObserver;
public class ExtAuthService extends AuthorizationGrpc.AuthorizationImplBase {
@Override
public void check (CheckRequest request, StreamObserver<CheckResponse> responseObserver) {
System.out.println("++++++++++hit+++++++++++++++");
System.out.println(request);
CheckResponse response = CheckResponse.newBuilder()
.setStatus(Status.newBuilder().build())
.setOkResponse(OkHttpResponse.newBuilder().build())
.build();
// Use responseObserver to send a single response back
responseObserver.onNext(response);
// When you are done, you must call onCompleted.
responseObserver.onCompleted();
}
}
Request:
curl -X POST -vs -H "Authorization: Bearer foo" -H 'Content-Type: application/grpc' -H 'Accept: application/grpc' -H 'TE: trailers' -w "\n" --http2-prior-knowledge http://localhost:5051/check
Response:
* Connection state changed (MAX_CONCURRENT_STREAMS == 2147483647)!
< HTTP/2 200
< content-type: application/grpc
< grpc-status: 12
< grpc-message: Method not found: check
What am I missing?
- Dominant language
- Java
- Stars
- 312
- Forks
- 150
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from envoyproxy/java-control-plane
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
envoyproxy/java-control-plane#481 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
envoyproxy/java-control-plane#471 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
envoyproxy/java-control-plane#463 ·
-
help Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
envoyproxy/java-control-plane#432 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
envoyproxy/java-control-plane#411 ·
All issues in envoyproxy/java-control-plane
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100