An open API service indexing awesome lists of open source software.

https://github.com/dmathieu/gatewayauth


https://github.com/dmathieu/gatewayauth

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

          

# Gateway Auth

| Status | |
| ------------- |-----------|
| Stability | [development] |
| Distributions | [] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aextension%2Fgatewayauth%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aextension%2Fgatewayauth) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aextension%2Fgatewayauth%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aextension%2Fgatewayauth) |
| Code coverage | [![codecov](https://codecov.io/github/open-telemetry/opentelemetry-collector-contrib/graph/main/badge.svg?component=extension_gatewayauth)](https://app.codecov.io/gh/open-telemetry/opentelemetry-collector-contrib/tree/main/?components%5B0%5D=extension_gatewayauth&displayType=list) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@dmathieu](https://www.github.com/dmathieu) |

[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development

This extension enables untrusted clients — such as browsers or mobile apps — to send telemetry directly to the OpenTelemetry Collector without embedding long-lived credentials. Instead of trusting the client directly, the Collector delegates authorization to an existing auth service you control: each incoming request's `Authorization` header is forwarded to a configurable HTTP endpoint, and access is granted only when that endpoint returns a 2xx response.

This makes it practical to expose a Collector endpoint to the public internet or to end-user devices, while keeping your authorization logic centralized in a backend system (e.g. an API gateway, an identity provider, or a custom auth service).

The authenticator type has to be set to `gatewayauth`.

## Configuration

- `endpoint` (required): URL of the authentication endpoint. The `Authorization` header from the incoming request is forwarded as-is. A 2xx response grants access.

- `cache_ttl`: How long to cache authentication results. Successful (2xx) and denied (non-5xx) responses are both cached. Service errors (5xx) are never cached. Defaults to `0` (no caching).

- `cache_size`: Maximum number of entries in the authentication result cache. Required and must be greater than 0 when `cache_ttl` is set. Defaults to `1000`.

- `http_client`: HTTP client configuration for requests to the authentication endpoint. Supports `timeout`, TLS settings, proxy configuration, and all other fields from [confighttp](https://github.com/open-telemetry/opentelemetry-collector/tree/main/config/confighttp). Defaults to a 5-second timeout.

```yaml
extensions:
gatewayauth:
endpoint: https://auth.example.com/validate

gatewayauth/withcache:
endpoint: https://auth.example.com/validate
cache_ttl: 5m
cache_size: 5000

gatewayauth/withtls:
endpoint: https://auth.example.com/validate
cache_ttl: 1m
http_client:
timeout: 2s
tls:
ca_file: /etc/ssl/certs/ca.pem

receivers:
otlp:
protocols:
http:
auth:
authenticator: gatewayauth
grpc:
auth:
authenticator: gatewayauth/withcache

service:
extensions: [gatewayauth, gatewayauth/withcache, gatewayauth/withtls]
pipelines:
traces:
receivers: [otlp]
processors: []
exporters: []
```