Skip to content

Commit c2f2593

Browse files
authored
Update webhooks.md
1 parent b696c3f commit c2f2593

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docs/features/webhooks.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,24 @@ curl -X POST "https://example.com/webhooks/start/order-workflow" \
148148
```
149149

150150
### Custom Authentication
151-
To use a custom authenticator, create a class that implements the following interface:
151+
To use a custom authenticator, create a class that implements the `WebhookAuthenticator` interface:
152152

153153
```php
154154
use Illuminate\Http\Request;
155+
use Workflow\Auth\WebhookAuthenticator;
155156

156-
interface WebhookAuthenticator {
157-
public function validate(Request $request): Request;
157+
class CustomAuthenticator implements WebhookAuthenticator
158+
{
159+
public function validate(Request $request): Request
160+
{
161+
$allow = true;
162+
163+
if ($allow) {
164+
return $request;
165+
} else {
166+
abort(401, 'Unauthorized');
167+
}
168+
}
158169
}
159170
```
160171

0 commit comments

Comments
 (0)