Skip to content

Commit f44c2a4

Browse files
committed
fix accessing the property Options of AntiForgery Service in ValidateAntiForgery filter
1 parent 37a6677 commit f44c2a4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Endpoint/Filters/ValidateAntiForgery.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @link https://github.com/DevNet-Framework
77
*/
88

9-
namespace DevNet\Core\Endpoint\Filters;
9+
namespace DevNet\Core\Endpoint\Filters;
1010

1111
use DevNet\System\Async\Task;
1212
use DevNet\Core\Endpoint\ActionContext;
@@ -31,10 +31,10 @@ public function __invoke(ActionContext $context, ActionDelegate $next): Task
3131
return next($context);
3232
}
3333

34-
$formToken = $context->HttpContext->Request->Form->getValue($antiForgery->options->FieldName);
35-
$headerToken = $context->HttpContext->Request->Headers->getValues($antiForgery->options->FieldName)[0] ?? null;
36-
$formResult = $antiForgery->validateToken($formToken);
37-
$headerResult = $antiForgery->validateToken($headerToken);
34+
$formToken = $context->HttpContext->Request->Form->getValue($antiForgery->Options->FieldName);
35+
$headerToken = $context->HttpContext->Request->Headers->getValues($antiForgery->Options->FieldName)[0] ?? null;
36+
$formResult = $antiForgery->validateToken((string)$formToken);
37+
$headerResult = $antiForgery->validateToken((string)$headerToken);
3838

3939
if (!$formResult && !$headerResult) {
4040
throw new AntiForgeryException("Invalid AntiForgery Token!", 403);

0 commit comments

Comments
 (0)