Skip to content

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

Merged
HofiOne merged 1 commit intosyslog-ng:developfrom
davidtosovic-db:grpc_oauth2_support
Dec 15, 2025
Merged

cloud-auth, grpc: Add OAuth2 support for gRPC destinations#5584
HofiOne merged 1 commit intosyslog-ng:developfrom
davidtosovic-db:grpc_oauth2_support

Conversation

@davidtosovic-db
Copy link
Contributor

Motivation

With PR #5570, OAuth2 authentication is available to HTTP based destinations. Currently, OAuth2 authentication is not available for gRPC-based destinations.

Changes

This change extends the OAuth2 authentication support introduced in PR #5570 to gRPC-based destinations (opentelemetry, loki, bigquery, pubsub, clickhouse, etc.).

The implementation mirrors the existing HTTP pattern by introducing a signal/slot mechanism for gRPC metadata injection, allowing the cloud-auth module to inject OAuth2 tokens into gRPC requests.

Key Features

  • New grpc-signals.h header defining GrpcMetadataRequestSignalData for plugin communication.
  • Signal emission in grpc-dest-worker.cpp to collect metadata from authentication plugins.
  • gRPC signal handlers in cloud-auth module for token injection.

Configuration

destination d_grpc {
  opentelemetry(
    url("example.com:443")
    cloud-auth(
      oauth2(
        client_id("client-id")
        client_secret("client-secret")
        token_url("https://auth.example.com/token")
        scope("api-scope")
      )
    )
  );
};

Testing

  • Verified the OAuth2 module works with existing HTTP destinations to verify no regressions are introduced.
  • Verified the OAuth2 module works with gRPC destinations to verify the newly added functionality works.

Notes

  • The signal/slot mechanism enables future extensibility for gRPC destinations.
  • All existing and future gRPC destinations automatically gain OAuth2 support.
  • Google authentication (google-auth) can be extended to support gRPC destinations using the same pattern if needed.
  • No breaking changes to existing configurations.
  • Follows the design pattern established in PR #5570.

@kira-syslogng
Copy link
Contributor

Can one of the admins verify this patch?

1 similar comment
@kira-syslogng
Copy link
Contributor

Can one of the admins verify this patch?

@HofiOne HofiOne self-requested a review December 13, 2025 08:31
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 <[email protected]>
Copy link
Collaborator

@HofiOne HofiOne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidtosovic-db, thank you once again for these great contributions!

@HofiOne HofiOne merged commit c4a9f93 into syslog-ng:develop Dec 15, 2025
118 checks passed
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.

3 participants