Skip to content

feat: Add support for custom authentication scheme and credentials in auth headers#430

Merged
bartek-gralewicz merged 3 commits into
epic/1.0_breaking_changesfrom
bgralewicz/push_notification_authentication_config
Apr 28, 2026
Merged

feat: Add support for custom authentication scheme and credentials in auth headers#430
bartek-gralewicz merged 3 commits into
epic/1.0_breaking_changesfrom
bgralewicz/push_notification_authentication_config

Conversation

@bartek-gralewicz

@bartek-gralewicz bartek-gralewicz commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Description

According to the protocol spec, the agent MUST include auth credentials per the push notification's config. This PR adds support for this.

Note: The old token behavior is still supported and the old tests pass without any need for updating.

@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown

🧪 Code Coverage

⬇️ Download Full Report

Base PR Delta
src/server/push_notification/default_push_notification_sender.ts 94.73% 94.94% 🟢 +0.21%
Total 85.25% 85.26% 🟢 +0.01%

Generated by coverage-comment.yml

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new authentication mechanism for push notifications, allowing for scheme-based credentials (e.g., Bearer or Basic) alongside the existing legacy token system. The changes include a new private method _buildAuthHeaders to manage header construction with proper precedence and a comprehensive suite of integration tests to verify various authentication scenarios. Feedback was provided to enhance the robustness of the header construction logic by using explicit null/undefined checks and improving code readability.

Comment thread src/server/push_notification/default_push_notification_sender.ts
bartek-gralewicz and others added 2 commits April 27, 2026 15:15
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@bartek-gralewicz bartek-gralewicz marked this pull request as ready for review April 27, 2026 13:19
@bartek-gralewicz bartek-gralewicz requested a review from a team as a code owner April 27, 2026 13:19
* 2. `pushConfig.token` (legacy) → sets the custom token header (deprecated)
*/
private _buildAuthHeaders(pushConfig: TaskPushNotificationConfig): Record<string, string> {
const headers: Record<string, string> = { 'Content-Type': 'application/json' };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe with #429 it should be

Suggested change
const headers: Record<string, string> = { 'Content-Type': 'application/json' };
const headers: Record<string, string> = { 'Content-Type': 'application/a2a+json' };

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I wanted to separate these changes as I was unsure what will be the merging order. It will use the global constant here.

@bartek-gralewicz bartek-gralewicz merged commit 5a4389b into epic/1.0_breaking_changes Apr 28, 2026
9 checks passed
@bartek-gralewicz bartek-gralewicz deleted the bgralewicz/push_notification_authentication_config branch April 28, 2026 08:20
ishymko added a commit that referenced this pull request May 11, 2026
🤖 I have created a release *beep* *boop*
---

## 1.0.0-alpha.0 (2026-05-11)

See the [v0.3 -> v1.0-alpha.0 migration
guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0-alpha.0/docs/migration-guide.md).

**Note**: Enabling backward compatibility with v0.3 is tracked in
[#452](#452).


### ⚠ BREAKING CHANGES

* Drop support for node 18
([#368](#368))
* Make ServerCallContext parameter mandatory across all places
([#405](#405))
* Remove JSON-RPC client
([#353](#353))
* Remove transport-specific exports
([#404](#404))
* Update codebase to use A2A 1.0.0 data model
([#375](#375))
* Remove A2AExpressApp
([#363](#363))

### Features

* Add A2A Version Header
([#422](#422))
([b5f3db7](b5f3db7))
* Add cache-headers logic to the agent card handler
([#435](#435))
([955b52b](955b52b))
* Add resource scoping
([#450](#450))
([c527086](c527086))
* Add support for custom authentication scheme and credentials in
auth-headers ([#430](#430))
([5a4389b](5a4389b))
* AgentCardSignature support
([#448](#448))
([4a41a8c](4a41a8c))
* Enforce events ordering
([#437](#437))
([157cf48](157cf48))
* Enriched Error Model
([#427](#427))
([c130778](c130778))
* Implement listTasks method
([#383](#383))
([7d4c472](7d4c472))
* Send current task as the first event after subscribing to it
([#418](#418))
([4bfcf5f](4bfcf5f))
* Support multi-tenancy
([#419](#419))
([1877877](1877877))

### Code Refactoring

* remove A2AExpressApp
([#363](#363))
([0b84728](0b84728))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: bartek-gralewicz <bgralewicz@google.com>
Co-authored-by: Ivan Shymko <ishymko@google.com>
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