Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1 KB

File metadata and controls

52 lines (36 loc) · 1 KB

Proxy-Wasm plugin example: gRPC auth (random)

Proxy-Wasm plugin that grants access based on a result of gRPC callout.

Building

$ cargo build --target wasm32-wasip1 --release

Using in Envoy

This example can be run with docker compose and has a matching Envoy configuration.

$ docker compose up

Access granted.

Send gRPC request to localhost:10000 service hello.HelloService:

$ grpcurl -d '{"greeting": "Rust"}' -plaintext localhost:10000 hello.HelloService/SayHello
{
  "reply": "hello Rust"
}

Expected Envoy logs:

[...] wasm log grpc_auth_random: Access granted.

Access forbidden.

Send gRPC request to localhost:10000 service hello.HelloService:

$ grpcurl -d '{"greeting": "Rust"}' -plaintext localhost:10000 hello.HelloService/SayHello
ERROR:
  Code: Aborted
  Message: Aborted by Proxy-Wasm!

Expected Envoy logs:

[...] wasm log grpc_auth_random: Access forbidden.