cloud-auth: Add generic OAuth2 authentication module#5570
Merged
HofiOne merged 1 commit intosyslog-ng:developfrom Dec 1, 2025
Merged
cloud-auth: Add generic OAuth2 authentication module#5570HofiOne merged 1 commit intosyslog-ng:developfrom
HofiOne merged 1 commit intosyslog-ng:developfrom
Conversation
Contributor
|
Can one of the admins verify this patch? |
1 similar comment
Contributor
|
Can one of the admins verify this patch? |
Collaborator
|
@davidtosovic-db thank you, we will review this in the near future! |
Contributor
This Pull Request introduces config grammar changessyslog-ng/d23664dcae6d4c070fb0801f20d4118202716e73 -> davidtosovic-db/oauth2_support 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>)
+ )
)
)
|
Collaborator
|
@davidtosovic-db: could you please fix the style check and switch issues? |
HofiOne
requested changes
Nov 28, 2025
HofiOne
requested changes
Nov 28, 2025
Collaborator
HofiOne
left a comment
There was a problem hiding this comment.
One last tiny request, otherwise LGTM.
Collaborator
|
@davidtosovic-db please correct the commit-check issue |
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 <[email protected]>
1e0fb7a to
8291dff
Compare
HofiOne
approved these changes
Dec 1, 2025
Collaborator
HofiOne
left a comment
There was a problem hiding this comment.
I love this, thank you for your contribution!
Contributor
Author
And thank you for the quick review! Glad I could contribute! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Enable clients to specify a destination with an
oauth2cloud-auth module that handles OAuth token fetching and refresh logic.Currently, the only OAuth2 support in syslog-ng is inside the
azure-authmodule, which is Azure-specific and cannot be used with other cloud providers. This limits the destinations syslog-ng can target with OAuth2 tokens.Apart from that, if new cloud-provider specific implementations were needed, we'd have code duplication when adding new OAuth2-based authenticators.
Changes
This PR 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:
auth-method()parameterscope,resource, andauthorization_detailsparametersImplementation Details:
New generic OAuth2 module (
oauth2-auth.{h,hpp,cpp}):Refactored Azure module (
azure-auth.{h,hpp,cpp}):OAuth2AuthenticatorConfiguration
Using the new generic OAuth2 module:
Existing Azure configuration (unchanged):
Testing
Notes
news/feature-5571.mdSolves: Generic OAuth cloud module #5571