Add support for aggregator API keys - #17
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for sending API keys to the subscription proxy of aggregators, enabling authentication for protected endpoints. It also introduces new exception types for handling authorization and rate limiting errors.
Key changes:
- Adds API key support to AggregatorClient with optional authentication
- Introduces UnauthorizedException and RateLimitExceededException for error handling
- Updates JsonRpcHttpTransport to handle API key headers and HTTP error responses
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| TestApiKeyIntegration.java | Comprehensive test suite for API key authentication scenarios |
| MockAggregatorServer.java | Test mock server with API key validation and rate limiting simulation |
| UnauthorizedException.java | New exception for HTTP 401 unauthorized errors |
| RateLimitExceededException.java | New exception for HTTP 429 rate limit errors with retry information |
| JsonRpcHttpTransport.java | Enhanced transport layer with API key support and error handling |
| AggregatorClient.java | Updated client with optional API key constructor and authentication |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…eption.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…etwork/java-state-transition-sdk into aggregator-subscription-support
…like specific HTTP header names
|
Tested locally using Java SDK commit 548700e (HEAD, tag: 1.3.0) and locally running subscription service commit 125113e360cd0039ef1de3ebb36beba912ddf057 which is pointing to https://goggregator-test.unicity.network. Now if requests sent directly to subscription service without api key, then response would be 401 Unauthorized. Moving task to done. |

This adds support for sending API keys to the subscription proxy of aggregators. It also adds a couple of exceptions for error cases.