Skip to content

cloud-auth, grpc: Add OAuth2 support for gRPC destinations#910

Open
MrAnno wants to merge 3 commits intoaxoflow:mainfrom
MrAnno:generic-oauth2
Open

cloud-auth, grpc: Add OAuth2 support for gRPC destinations#910
MrAnno wants to merge 3 commits intoaxoflow:mainfrom
MrAnno:generic-oauth2

Conversation

@MrAnno
Copy link
Contributor

@MrAnno MrAnno commented Jan 16, 2026

Cherry-picked from syslog-ng/syslog-ng#5570 and syslog-ng/syslog-ng#5584.

This is amazing work from @davidtosovic-db.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2026

This Pull Request introduces config grammar changes

axoflow/54416fbf21d92dce04676ed16c028f8eb4b7377e -> MrAnno/generic-oauth2

Details
--- a/destination
+++ b/destination

 http(
     cloud-auth(
+        oauth2(
+            <empty>
+            auth-method(
+                basic
+                post-body
+            )
+            authorization-details(<string>)
+            client-id(<string>)
+            client-secret(<string>)
+            refresh-offset(<number>)
+            resource(<string>)
+            scope(<string>)
+            token-url(<string>)
+        )
     )
 )

davidtosovic-db and others added 3 commits January 22, 2026 10:48
This change introduces a generic OAuth2 authentication module that implements
the client credentials flow with configurable authentication methods (HTTP Basic
Auth or POST body credentials). The module provides a reusable foundation for
cloud service authenticators that use OAuth2.

Key features:
- Token fetching, caching, and automatic refresh based on expiry
- Configurable authentication method via `auth-method()` parameter
- Support for optional `scope`, `resource`, and `authorization_details` parameters
- Extensible via virtual methods for service-specific customization

The existing `azure-auth` module has been refactored to inherit from the generic
OAuth2 authenticator, eliminating code duplication while maintaining full
backward compatibility with the existing user interface and configuration syntax.

Signed-off-by: David Tosovic <david.tosovic@databricks.com>
This change extends the cloud-auth module to support gRPC-based destinations
by introducing a signal/slot mechanism for metadata injection, mirroring the
existing HTTP header injection pattern.

Changes include:
- New grpc-signals.h header defining GrpcMetadataRequestSignalData for
  plugin communication
- Signal emission in grpc-dest-worker.cpp to collect metadata from plugins
- gRPC signal handlers in cloud-auth module for token injection
- Refactored oauth2-auth.cpp using template method pattern to eliminate
  code duplication between HTTP and gRPC implementations

This enables OAuth2 authentication for any gRPC destination (opentelemetry,
loki, bigquery, pubsub, clickhouse, etc.) using the same cloud-auth() syntax
as HTTP destinations.

Signed-off-by: David Tosovic <david.tosovic@databricks.com>
…ense

Signed-off-by: László Várady <laszlo.varady@anno.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants