rudder-server
rudder-server copied to clipboard
feat: update oauth module in server to interception pattern
Description
We are updating our OAuth module to the new format. We are moving it to an interception pattern. As of now if anyone wants to use the OAuth module they need to augment the accessToken to the payload and along with that they need to parse the response and call refershToken if required. We are omitting those by introducing an HTTP client to do the augmentation and response parsing and send the request.
Linear Ticket
Resolves INT-1012 Resolves INT-956
Security
- [ ] The code changed/added as part of this pull request won't create any security issues with how the software is being used.
Summary by CodeRabbit
- New Features
- Introduced OAuth V2 support across various components, enhancing authentication and authorization capabilities.
- Added new OAuth V2 related functionality, including token fetching, refreshing, and authorization status management.
- Implemented OAuth V2 enabled HTTP client and transport layer for improved security and efficiency in handling OAuth requests.
- Enhanced destination management with OAuth V2 support for Bing Ads, including token generation and authentication handling.
- Enhancements
- Updated HTTP client setup and API manager initialization to support OAuth V2 configurations.
- Improved error handling and response processing for OAuth V2 scenarios in regulation worker and router components.
- Introduced cache interface and implementation for efficient OAuth V2 token and status management.
- Bug Fixes
- Adjusted async upload timeout configuration for better reliability in data processing.
- Tests
- Added extensive test coverage for OAuth V2 functionality, including mock implementations, unit tests, and integration tests across services and components.
- Documentation
- Enhanced inline documentation and summaries for better understanding of OAuth V2 integration and its impact on the system.
[!IMPORTANT]
Auto Review Skipped
Auto reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository.To trigger a single review, invoke the
@coderabbitai reviewcommand.
Walkthrough
The recent updates introduce comprehensive support for OAuth v2 across various components, focusing on mock implementations for testing, enhanced OAuth v2 functionality, and improved error handling. Significant changes include the addition of OAuth v2 client and authorization capabilities, mock services for interface testing, and updates to the regulation-worker and router components to support OAuth v2. These changes aim to modernize authentication mechanisms, streamline testing processes, and refine error management for OAuth-related operations.
Changes
| File Path | Change Summary |
|---|---|
mocks/services/oauthV2/... |
Introduced mock implementations for OAuth v2 interfaces including TokenProvider, Authorizer, and RoundTripper. |
regulation-worker/cmd/main.go regulation-worker/internal/delete/api/api.go |
Added OAuth v2 support with new imports, variables, and updated HTTP client setup. Introduced IsOAuthV2Enabled field and enhanced error handling in APIManager. |
router/batchrouter/asyncdestinationmanager/bing-ads/... |
Updated bing-ads package to support OAuth v2 with new parameters and OAuth client initialization. |
router/batchrouter/handle_lifecycle.go router/handle_lifecycle.go router/transformer/... router/types.go router/worker.go |
Enhanced router and transformer components for OAuth v2 support, including new imports, configuration variables, and OAuth v2 client handling. |
runner/runner.go |
Initialized OAuth v2 support in the runner component. |
services/oauth/v2/... |
Added new files for OAuth v2 service implementation, including cache management, control plane connector, HTTP client, and utility functions. Implemented tests for these functionalities. |
This table summarizes the key changes, grouping files with similar modifications to streamline the overview of the update's scope.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>.Generate unit-tests for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit tests for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit tests.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - The JSON schema for the configuration file is available here.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json
CodeRabbit Discord Community
Join our Discord Community to get help, request features, and share feedback.
@ItsSudip Let's use non-sugared structured logging for logs. More about it in here.
@coderabbitai review
Codecov Report
Attention: Patch coverage is 83.28009% with 157 lines in your changes are missing coverage. Please review.
Project coverage is 75.52%. Comparing base (
559d701) to head (35889e8). Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #4329 +/- ##
==========================================
+ Coverage 75.24% 75.52% +0.28%
==========================================
Files 381 392 +11
Lines 46469 47361 +892
==========================================
+ Hits 34965 35771 +806
- Misses 9215 9277 +62
- Partials 2289 2313 +24
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.