Skip to content

Commit

Permalink
fix: add middleware if it's not already declared
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Dec 22, 2020
1 parent 6009075 commit a4ae7fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Http/Middleware/VerifySignature.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@
use Aws\Sns\Message;
use Aws\Sns\MessageValidator;
use Closure;
use Illuminate\Http\Client\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class VerifySignature
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next)
{
try {
// Create a message from the post data and validate its signature
$message = Message::fromRawPostData();

// Validate the message
$validator = new MessageValidator();

Expand Down
2 changes: 1 addition & 1 deletion src/Providers/MediaConverterServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function boot()

$router = $this->app->make(Router::class);

if (in_array('verify-signature', $router->getMiddleware())) {
if (! in_array('verify-signature', $router->getMiddleware())) {
$router->aliasMiddleware('verify-signature', VerifySignature::class);
}
}
Expand Down

0 comments on commit a4ae7fc

Please sign in to comment.