prakashchokalingam / envoy_ext_auth_grpc_go

Working example of envoy external auth filter with go lang grpc service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Screenshot 2023-06-20 at 10 16 03 PM

Example repo to demonstrate Envoy External Authorization with Golang GRPC service

This repository provides an envoy configuration file with an external auth filter activated for all incoming routes at port 8080

The envoy is configured with two clusters,

go_grpc_filter

The filter envoy.filters.http.ext_authz in envoy is pointed at this go grpc cluster. All incoming requests will be forwarded to this cluster.

The Check method will be called during a request; it then adds a custom header to all other requests and rejects requests with the path '/private'.

Request grpc_filter status http_server_response
/ x-custom-header = "Hello World" 200 Hello World
/ private 403 - -

go_simple_http

It is a straightforward Golang HTTP server that merely emits the custom header value x-custom-header added via the go_grpc_filter cluster.

To run this example

  1. Start the envoy server
envoy -c envoy.yml
  1. start the go_grpc_filter & go_simple_http servers by navigating to the cluster root.
go run main.go
  1. Go to http://localhost:8080

About

Working example of envoy external auth filter with go lang grpc service


Languages

Language:Go 100.0%