generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdi-web.php
39 lines (33 loc) · 1.27 KB
/
di-web.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
use Yiisoft\Csrf\MaskedCsrfToken;
use Yiisoft\Csrf\CsrfTokenInterface;
use Yiisoft\Csrf\Synchronizer\Generator\RandomCsrfTokenGenerator;
use Yiisoft\Csrf\Synchronizer\Storage\SessionCsrfTokenStorage;
use Yiisoft\Csrf\Synchronizer\SynchronizerCsrfToken;
use Yiisoft\Csrf\Hmac\IdentityGenerator\SessionCsrfTokenIdentityGenerator;
use Yiisoft\Csrf\Hmac\HmacCsrfToken;
use Yiisoft\Definitions\Reference;
/* @var array $params */
return [
CsrfTokenInterface::class => [
'class' => MaskedCsrfToken::class,
'__construct()' => [
'token' => Reference::to(SynchronizerCsrfToken::class),
],
],
SynchronizerCsrfToken::class => [
'__construct()' => [
'generator' => Reference::to(RandomCsrfTokenGenerator::class),
'storage' => Reference::to(SessionCsrfTokenStorage::class),
],
],
HmacCsrfToken::class => [
'__construct()' => [
'identityGenerator' => Reference::to(SessionCsrfTokenIdentityGenerator::class),
'secretKey' => $params['yiisoft/csrf']['hmacToken']['secretKey'],
'algorithm' => $params['yiisoft/csrf']['hmacToken']['algorithm'],
'lifetime' => $params['yiisoft/csrf']['hmacToken']['lifetime'],
],
],
];