File tree 4 files changed +23
-2
lines changed
4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,8 @@ Mutual TLS authentication serves as a robust method for this purpose. Contrary t
299
299
mutual TLS requires both the webhook endpoint (acting as the client) and the webhook provider (acting as the server) to authenticate each other.
300
300
This is achieved through an exchange of certificates during the TLS handshake, ensuring that both parties confirm each other's identity.
301
301
302
+ > Note: If you need to include your own certificate authority, pass the certificate path to the ` verifySsl() ` method.
303
+
302
304
``` php
303
305
WebhookCall::create()
304
306
->mutualTls(
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ class CallWebhookJob implements ShouldQueue
47
47
48
48
public array $ headers = [];
49
49
50
- public bool $ verifySsl ;
50
+ public string | bool $ verifySsl ;
51
51
52
52
public bool $ throwExceptionOnFailure ;
53
53
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ public function withHeaders(array $headers): self
170
170
return $ this ;
171
171
}
172
172
173
- public function verifySsl (bool $ verifySsl = true ): self
173
+ public function verifySsl (bool | string $ verifySsl = true ): self
174
174
{
175
175
$ this ->callWebhookJob ->verifySsl = $ verifySsl ;
176
176
Original file line number Diff line number Diff line change @@ -218,6 +218,25 @@ function baseGetRequest(array $overrides = []): array
218
218
->assertRequestsMade ([$ baseRequest ]);
219
219
});
220
220
221
+ it ('will use mutual TLS with certificate authority ' , function () {
222
+ baseWebhook ()
223
+ ->mutualTls ('foobar ' , 'barfoo ' )
224
+ ->verifySsl ('foofoo ' )
225
+ ->dispatch ();
226
+
227
+ $ baseRequest = baseRequest ();
228
+
229
+ $ baseRequest ['options ' ]['cert ' ] = ['foobar ' , null ];
230
+ $ baseRequest ['options ' ]['ssl_key ' ] = ['barfoo ' , null ];
231
+ $ baseRequest ['options ' ]['verify ' ] = 'foofoo ' ;
232
+
233
+ artisan ('queue:work --once ' );
234
+
235
+ $ this
236
+ ->testClient
237
+ ->assertRequestsMade ([$ baseRequest ]);
238
+ });
239
+
221
240
it ('will use a proxy ' , function () {
222
241
baseWebhook ()
223
242
->useProxy ('https://proxy.test ' )
You can’t perform that action at this time.
0 commit comments