1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 00:15:51 +02:00

Added CSRF Extender (#2095)

This commit is contained in:
Alexander Skvortsov
2020-04-03 15:32:18 -04:00
committed by GitHub
parent ecdd7a2b49
commit 0d57820b50
6 changed files with 193 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace Flarum\Http;
use Flarum\Foundation\AbstractServiceProvider;
class HttpServiceProvider extends AbstractServiceProvider
{
/**
* {@inheritdoc}
*/
public function register()
{
$this->app->singleton('flarum.http.csrfExemptPaths', function () {
return ['/api/token'];
});
$this->app->bind(Middleware\CheckCsrfToken::class, function ($app) {
return new Middleware\CheckCsrfToken($app->make('flarum.http.csrfExemptPaths'));
});
}
}