Skip to content

Conversation

@shmsr
Copy link
Member

@shmsr shmsr commented Apr 15, 2025

Proposed commit message

This PR adds optional support for a separate token_url configuration in the Salesforce input's JWT Bearer Flow authentication.

Currently, when using JWT authentication in the Salesforce integration, the url configuration is used for both:

  1. The audience claim (aud) in the JWT
  2. The token endpoint to request the access token from

However, some users have custom Salesforce domains or have disabled logins for the default endpoints (https://login.salesforce.com or https://test.salesforce.com). In these cases, the audience URL and the token endpoint URL need to be different.

The new optional configuration is:

var.authentication:
  jwt_bearer_flow:
    enabled: true
    client.id: "my-client-id"
    client.username: "[email protected]"
    client.key_path: client_key.pem
    url: https://login.salesforce.com           # Audience URL for JWT claim
    token_url: "https://custom-domain.my.salesforce.com"  # Optional: Token endpoint URL**Behavior:**
- If `token_url` is **not provided**: The `url` value is used for both the JWT audience claim and the token endpoint (existing behavior)
- If `token_url` is **provided**: The `url` is used for the JWT audience claim, and `token_url` is used for the token endpoint

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Related issues

@shmsr shmsr self-assigned this Apr 15, 2025
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Apr 15, 2025
@mergify
Copy link
Contributor

mergify bot commented Apr 15, 2025

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @shmsr? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@shmsr shmsr force-pushed the jwt-token-endpoint-custom branch from d801a3c to 140c740 Compare December 7, 2025 20:02
@shmsr shmsr added the Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team label Dec 7, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 7, 2025
@shmsr shmsr marked this pull request as ready for review December 7, 2025 20:03
@shmsr shmsr requested review from a team as code owners December 7, 2025 20:03
@shmsr shmsr requested review from faec and orestisfl December 7, 2025 20:03
@shmsr shmsr changed the title x-pack/filebeat/input/salesforce: Use new JWT provider to include optional token endpoint x-pack/filebeat/input/salesforce: Add optional token_url support for JWT Bearer Flow authentication Dec 7, 2025
@shmsr shmsr removed request for faec and orestisfl December 7, 2025 20:08
@shmsr shmsr requested a review from Linu-Elias December 8, 2025 06:00
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Dec 8, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@shmsr shmsr requested a review from ishleenk17 December 12, 2025 11:22
@shmsr shmsr changed the title x-pack/filebeat/input/salesforce: Add optional token_url support for JWT Bearer Flow authentication x-pack/filebeat/input/salesforce: Add optional token_url support for JWT Bearer Flow authentication Dec 12, 2025
@shmsr
Copy link
Member Author

shmsr commented Dec 12, 2025

Can someone from @elastic/elastic-agent-data-plane please review this PR?

@pierrehilbert pierrehilbert requested a review from rdner December 12, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x-pack/filebeat/input/salesforce: Add optional support for Token URL for JWT provider

4 participants