Skip to content

Latest commit

Β 

History

History
42 lines (34 loc) Β· 1.69 KB

File metadata and controls

42 lines (34 loc) Β· 1.69 KB

Ext AuthZ Token Exchange Plugin Implementation Guide

This document describes the architecture and technical decisions.

πŸ“ Project Structure

The project follows the standard Go project layout and keeps runtime behavior split across server, policy, exchange, and configuration packages:

.
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ server/
β”‚   β”‚   β”œβ”€β”€ grpc_authz.go  # Envoy ext-authz decisions and responses
β”‚   β”‚   └── logging.go     # gRPC request logging interceptor
β”‚   β”œβ”€β”€ policy/            # ConfigMap policy parsing and request matching
β”‚   β”œβ”€β”€ exchange/          # RFC 8693 token exchange client
β”‚   └── config/            # Runtime configuration parsing and validation
β”œβ”€β”€ cmd/
β”‚   └── ext-authz-token-exchange-service/
β”‚       └── main.go        # Application bootstrap
β”œβ”€β”€ charts/                # Helm charts for plugin and e2e/demo stack
β”œβ”€β”€ devspace.yaml
β”œβ”€β”€ Dockerfile
└── go.mod

Technical Stack

  • Service API: Envoy external authorization gRPC service
  • Transport: google.golang.org/grpc
  • Generated API source: Envoy protobufs from github.com/envoyproxy/go-control-plane
  • Policy source: Kubernetes ConfigMaps selected by label and namespace selectors
  • Token exchange: OAuth 2.0 Token Exchange (urn:ietf:params:oauth:grant-type:token-exchange)

🎯 Design Principles

  • Idiomatic Go: Follow effectivego.dev guidelines
  • Single Responsibility: Each handler handles one resource type
  • Interface Segregation: Define focused interfaces
  • Dependency Inversion: Depend on abstractions, not concretions
  • Testability: All business logic must be unit testable