Skip to content

Commit 140c740

Browse files
committed
x-pack/filebeat/input/salesforce: Use new JWT provider to include optional token endpoint
1 parent 1c8215c commit 140c740

File tree

9 files changed

+49
-8
lines changed

9 files changed

+49
-8
lines changed

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13030,11 +13030,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-seccomp-bpf@
1303013030

1303113031
--------------------------------------------------------------------------------
1303213032
Dependency : github.com/elastic/go-sfdc
13033-
Version: v0.0.0-20241010131323-8e176480d727
13033+
Version: v0.0.0-20251207194532-c5aadd4a4e06
1303413034
Licence type (autodetected): MIT
1303513035
--------------------------------------------------------------------------------
1303613036

13037-
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]20241010131323-8e176480d727/LICENSE.txt:
13037+
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]20251207194532-c5aadd4a4e06/LICENSE.txt:
1303813038

1303913039
MIT License
1304013040

filebeat/docs/modules/salesforce.asciidoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Example config:
118118
client.username: "[email protected]"
119119
client.key_path: client_key.pem
120120
url: https://login.salesforce.com
121+
token_url: "https://[custom-domain].my.salesforce.com"
121122
user_password_flow:
122123
enabled: true
123124
client.id: "my-client-id"
@@ -168,6 +169,10 @@ Path to the client key file for JWT authentication.
168169

169170
The audience URL for JWT authentication.
170171

172+
*`var.authentication.jwt_bearer_flow.token_url`*::
173+
174+
The Salesforce OAuth token endpoint for JWT authentication. This endpoint is used for JWT Bearer flow and defaults to `var.authentication.jwt_bearer_flow.url` if empty. Only use a custom value if you have a custom domain and don't allow default endpoints such as `https://login.salesforce.com` or `https://test.salesforce.com`.
175+
171176
*`var.authentication.user_password_flow.enabled`*::
172177

173178
Set to true to use user-password authentication.
@@ -236,6 +241,7 @@ Example config:
236241
client.username: "[email protected]"
237242
client.key_path: client_key.pem
238243
url: https://login.salesforce.com
244+
token_url: "https://[custom-domain].my.salesforce.com"
239245
user_password_flow:
240246
enabled: true
241247
client.id: "my-client-id"
@@ -286,6 +292,10 @@ Path to the client key file for JWT authentication.
286292

287293
The audience URL for JWT authentication.
288294

295+
*`var.authentication.jwt_bearer_flow.token_url`*::
296+
297+
The Salesforce OAuth token endpoint for JWT authentication. This endpoint is used for JWT Bearer flow and defaults to `var.authentication.jwt_bearer_flow.url` if empty. Only use a custom value if you have a custom domain and don't allow default endpoints such as `https://login.salesforce.com` or `https://test.salesforce.com`.
298+
289299
*`var.authentication.user_password_flow.enabled`*::
290300

291301
Set to true to use user-password authentication.
@@ -354,6 +364,7 @@ Example config:
354364
client.username: "[email protected]"
355365
client.key_path: client_key.pem
356366
url: https://login.salesforce.com
367+
token_url: "https://[custom-domain].my.salesforce.com"
357368
user_password_flow:
358369
enabled: true
359370
client.id: "my-client-id"
@@ -400,6 +411,10 @@ Path to the client key file for JWT authentication.
400411

401412
The audience URL for JWT authentication.
402413

414+
*`var.authentication.jwt_bearer_flow.token_url`*::
415+
416+
The Salesforce OAuth token endpoint for JWT authentication. This endpoint is used for JWT Bearer flow and defaults to `var.authentication.jwt_bearer_flow.url` if empty. Only use a custom value if you have a custom domain and don't allow default endpoints such as `https://login.salesforce.com` or `https://test.salesforce.com`.
417+
403418
*`var.authentication.user_password_flow.enabled`*::
404419

405420
Set to true to use user-password authentication.
@@ -457,6 +472,7 @@ Example config:
457472
client.username: "[email protected]"
458473
client.key_path: client_key.pem
459474
url: https://login.salesforce.com
475+
token_url: "https://[custom-domain].my.salesforce.com"
460476
user_password_flow:
461477
enabled: true
462478
client.id: "my-client-id"
@@ -504,6 +520,10 @@ Path to the client key file for JWT authentication.
504520

505521
The audience URL for JWT authentication.
506522

523+
*`var.authentication.jwt_bearer_flow.token_url`*::
524+
525+
The Salesforce OAuth token endpoint for JWT authentication. This endpoint is used for JWT Bearer flow and defaults to `var.authentication.jwt_bearer_flow.url` if empty. Only use a custom value if you have a custom domain and don't allow default endpoints such as `https://login.salesforce.com` or `https://test.salesforce.com`.
526+
507527
*`var.authentication.user_password_flow.enabled`*::
508528

509529
Set to true to use user-password authentication.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ require (
177177
github.com/elastic/go-elasticsearch/v8 v8.19.0
178178
github.com/elastic/go-freelru v0.16.0
179179
github.com/elastic/go-quark v0.3.0
180-
github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727
180+
github.com/elastic/go-sfdc v0.0.0-20251207194532-c5aadd4a4e06
181181
github.com/elastic/mito v1.24.0
182182
github.com/elastic/mock-es v0.0.0-20250530054253-8c3b6053f9b6
183183
github.com/elastic/sarama v1.19.1-0.20250603175145-7672917f26b6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ github.com/elastic/go-quark v0.3.0 h1:d4vokx0psEJo+93fnhvWpTJMggPd9rfMJSleoLva4x
406406
github.com/elastic/go-quark v0.3.0/go.mod h1:bO/XIGZBUJGxyiJ9FTsSYn9YlfOTRJnmOP+iBE2FyjA=
407407
github.com/elastic/go-seccomp-bpf v1.5.0 h1:gJV+U1iP+YC70ySyGUUNk2YLJW5/IkEw4FZBJfW8ZZY=
408408
github.com/elastic/go-seccomp-bpf v1.5.0/go.mod h1:umdhQ/3aybliBF2jjiZwS492I/TOKz+ZRvsLT3hVe1o=
409-
github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727 h1:yuiN60oaQUz2PtNpNhDI2H6zrCdfiiptmNdwV5WUaKA=
410-
github.com/elastic/go-sfdc v0.0.0-20241010131323-8e176480d727/go.mod h1:sw1pzz4pIqzDQxFWt3dFoG2uIUFAfThxlMfWpjH590E=
409+
github.com/elastic/go-sfdc v0.0.0-20251207194532-c5aadd4a4e06 h1:TEeq+uvg9+B0f+8JdaqzAdtmhgz9KX/OGtKyQAKA4ac=
410+
github.com/elastic/go-sfdc v0.0.0-20251207194532-c5aadd4a4e06/go.mod h1:sw1pzz4pIqzDQxFWt3dFoG2uIUFAfThxlMfWpjH590E=
411411
github.com/elastic/go-structform v0.0.12 h1:HXpzlAKyej8T7LobqKDThUw7BMhwV6Db24VwxNtgxCs=
412412
github.com/elastic/go-structform v0.0.12/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
413413
github.com/elastic/go-sysinfo v1.15.3 h1:W+RnmhKFkqPTCRoFq2VCTmsT4p/fwpo+3gKNQsn1XU0=

x-pack/filebeat/filebeat.reference.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ filebeat.modules:
14941494
# - enabled: Set to true to enable ingestion of Salesforce module fileset
14951495
# - initial_interval: Initial interval for log collection. This setting determines the time period for which the logs will be initially collected when the ingestion process starts, i.e. 1d/h/m/s
14961496
# - api_version: API version for Salesforce, version should be greater than 46.0
1497+
# - url: URL for Salesforce instance
14971498

14981499
# Authentication Configurations:
14991500
# User-Password Authentication:
@@ -1510,6 +1511,7 @@ filebeat.modules:
15101511
# - client.username: Username for JWT authentication
15111512
# - client.key_path: Path to client key for JWT authentication
15121513
# - url: Audience URL for JWT authentication
1514+
# - token_url: Token URL for JWT authentication
15131515

15141516
# Event Monitoring:
15151517
# - real_time: Set to true to enable real-time logging using object type data collection
@@ -1541,6 +1543,7 @@ filebeat.modules:
15411543
client.username: "<YourClientUsernameHere>"
15421544
client.key_path: "<YourClientKeyPathHere>"
15431545
url: "https://login.salesforce.com"
1546+
# token_url: "<YourTokenURLHere>"
15441547

15451548
var.url: "https://instance_id.my.salesforce.com"
15461549

@@ -1567,6 +1570,7 @@ filebeat.modules:
15671570
client.username: "<YourClientUsernameHere>"
15681571
client.key_path: "<YourClientKeyPathHere>"
15691572
url: "https://login.salesforce.com"
1573+
# token_url: "<YourTokenURLHere>"
15701574

15711575
var.url: "https://instance_id.my.salesforce.com"
15721576

@@ -1596,6 +1600,7 @@ filebeat.modules:
15961600
client.username: "<YourClientUsernameHere>"
15971601
client.key_path: "<YourClientKeyPathHere>"
15981602
url: "https://login.salesforce.com"
1603+
# token_url: "<YourTokenURLHere>"
15991604

16001605
var.url: "https://instance_id.my.salesforce.com"
16011606

@@ -1625,11 +1630,13 @@ filebeat.modules:
16251630
client.username: "<YourClientUsernameHere>"
16261631
client.key_path: "<YourClientKeyPathHere>"
16271632
url: "https://login.salesforce.com"
1633+
# token_url: "<YourTokenURLHere>"
16281634

16291635
var.url: "https://instance_id.my.salesforce.com"
16301636

16311637
var.real_time: true
1632-
var.real_time_interval: 5m
1638+
var.real_time_interval: 5m
1639+
16331640
#----------------------------- Google Santa Module -----------------------------
16341641
- module: santa
16351642
log:

x-pack/filebeat/input/salesforce/config_auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type JWTBearerFlow struct {
3333
Enabled *bool `config:"enabled"`
3434

3535
URL string `config:"url"`
36+
TokenURL string `config:"token_url"` // If not provided, the URL will be used by go-sfdc package.
3637
ClientID string `config:"client.id"`
3738
ClientUsername string `config:"client.username"`
3839
ClientKeyPath string `config:"client.key_path"`

x-pack/filebeat/input/salesforce/input.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ func (s *salesforceInput) getSFDCConfig(cfg *config) (*sfdc.Configuration, error
465465

466466
passCreds := credentials.JwtCredentials{
467467
URL: cfg.Auth.OAuth2.JWTBearerFlow.URL,
468+
TokenURL: cfg.Auth.OAuth2.JWTBearerFlow.TokenURL,
468469
ClientId: cfg.Auth.OAuth2.JWTBearerFlow.ClientID,
469470
ClientUsername: cfg.Auth.OAuth2.JWTBearerFlow.ClientUsername,
470471
ClientKey: signKey,

x-pack/filebeat/module/salesforce/_meta/config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# - enabled: Set to true to enable ingestion of Salesforce module fileset
55
# - initial_interval: Initial interval for log collection. This setting determines the time period for which the logs will be initially collected when the ingestion process starts, i.e. 1d/h/m/s
66
# - api_version: API version for Salesforce, version should be greater than 46.0
7+
# - url: URL for Salesforce instance
78

89
# Authentication Configurations:
910
# User-Password Authentication:
@@ -20,6 +21,7 @@
2021
# - client.username: Username for JWT authentication
2122
# - client.key_path: Path to client key for JWT authentication
2223
# - url: Audience URL for JWT authentication
24+
# - token_url: Token URL for JWT authentication
2325

2426
# Event Monitoring:
2527
# - real_time: Set to true to enable real-time logging using object type data collection
@@ -51,6 +53,7 @@
5153
client.username: "<YourClientUsernameHere>"
5254
client.key_path: "<YourClientKeyPathHere>"
5355
url: "https://login.salesforce.com"
56+
# token_url: "<YourTokenURLHere>"
5457

5558
var.url: "https://instance_id.my.salesforce.com"
5659

@@ -77,6 +80,7 @@
7780
client.username: "<YourClientUsernameHere>"
7881
client.key_path: "<YourClientKeyPathHere>"
7982
url: "https://login.salesforce.com"
83+
# token_url: "<YourTokenURLHere>"
8084

8185
var.url: "https://instance_id.my.salesforce.com"
8286

@@ -106,6 +110,7 @@
106110
client.username: "<YourClientUsernameHere>"
107111
client.key_path: "<YourClientKeyPathHere>"
108112
url: "https://login.salesforce.com"
113+
# token_url: "<YourTokenURLHere>"
109114

110115
var.url: "https://instance_id.my.salesforce.com"
111116

@@ -135,8 +140,9 @@
135140
client.username: "<YourClientUsernameHere>"
136141
client.key_path: "<YourClientKeyPathHere>"
137142
url: "https://login.salesforce.com"
143+
# token_url: "<YourTokenURLHere>"
138144

139145
var.url: "https://instance_id.my.salesforce.com"
140146

141147
var.real_time: true
142-
var.real_time_interval: 5m
148+
var.real_time_interval: 5m

x-pack/filebeat/modules.d/salesforce.yml.disabled

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# - enabled: Set to true to enable ingestion of Salesforce module fileset
88
# - initial_interval: Initial interval for log collection. This setting determines the time period for which the logs will be initially collected when the ingestion process starts, i.e. 1d/h/m/s
99
# - api_version: API version for Salesforce, version should be greater than 46.0
10+
# - url: URL for Salesforce instance
1011

1112
# Authentication Configurations:
1213
# User-Password Authentication:
@@ -23,6 +24,7 @@
2324
# - client.username: Username for JWT authentication
2425
# - client.key_path: Path to client key for JWT authentication
2526
# - url: Audience URL for JWT authentication
27+
# - token_url: Token URL for JWT authentication
2628

2729
# Event Monitoring:
2830
# - real_time: Set to true to enable real-time logging using object type data collection
@@ -54,6 +56,7 @@
5456
client.username: "<YourClientUsernameHere>"
5557
client.key_path: "<YourClientKeyPathHere>"
5658
url: "https://login.salesforce.com"
59+
# token_url: "<YourTokenURLHere>"
5760

5861
var.url: "https://instance_id.my.salesforce.com"
5962

@@ -80,6 +83,7 @@
8083
client.username: "<YourClientUsernameHere>"
8184
client.key_path: "<YourClientKeyPathHere>"
8285
url: "https://login.salesforce.com"
86+
# token_url: "<YourTokenURLHere>"
8387

8488
var.url: "https://instance_id.my.salesforce.com"
8589

@@ -109,6 +113,7 @@
109113
client.username: "<YourClientUsernameHere>"
110114
client.key_path: "<YourClientKeyPathHere>"
111115
url: "https://login.salesforce.com"
116+
# token_url: "<YourTokenURLHere>"
112117

113118
var.url: "https://instance_id.my.salesforce.com"
114119

@@ -138,8 +143,9 @@
138143
client.username: "<YourClientUsernameHere>"
139144
client.key_path: "<YourClientKeyPathHere>"
140145
url: "https://login.salesforce.com"
146+
# token_url: "<YourTokenURLHere>"
141147

142148
var.url: "https://instance_id.my.salesforce.com"
143149

144150
var.real_time: true
145-
var.real_time_interval: 5m
151+
var.real_time_interval: 5m

0 commit comments

Comments
 (0)