Skip to content

Latest commit

 

History

History

grpc_auth_random

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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.