A Traefik middleware plugin that authenticates requests using an internal authentication service and sets a token in the cookie header.
# traefik.ymlexperimental:plugins:authcookie:moduleName: "github.com/k8trust/authcookie"version: "v1.0.6"
# Dynamic configurationhttp:middlewares:auth-token:plugin:authcookie:authEndpoint: "http://k8s-service.namespace.svc.cluster.local/central/auth"
Option | Type | Default | Description |
---|---|---|---|
authEndpoint | String | http://localhost:9000/test/auth/api-key | Full URL of the Kubernetes authentication service |
Header | Description |
---|---|
x-api-key | API key for authentication |
x-account | Tenant identifier |
.
├── Dockerfile # Container build configuration
├── Makefile # Build automation
├── README.md # Documentation
├── authcookie.go # Main plugin implementation
├── authcookie_test.go # Plugin tests
├── cmd/
│ └── server/
│ └── main.go # Standalone server for testing
├── fake_auth_server.go # Mock auth server for testing
└── go.mod # Go module definition
go run fake_auth_server.go
go run cmd/server/main.go
# Test with authentication headerscurl -v \-H "x-api-key: test-key" \-H "x-account: test-account" \http://localhost:8080# Test unauthorized accesscurl -v http://localhost:8080
go test -v ./...
We welcome contributions! Please feel free to submit a Pull Request.
MIT License