generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
di-web.php
46 lines (38 loc) · 1.26 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
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
use Yiisoft\Auth\AuthenticationMethodInterface;
use Yiisoft\User\CurrentUser;
use Yiisoft\User\Guest\GuestIdentityFactory;
use Yiisoft\User\Guest\GuestIdentityFactoryInterface;
use Yiisoft\User\Login\Cookie\CookieLogin;
use Yiisoft\User\Login\Cookie\CookieLoginMiddleware;
use Yiisoft\User\Method\WebAuth;
use Yiisoft\User\UserAuth;
/** @var array $params */
return [
CurrentUser::class => [
'reset' => function () {
$this->clear();
},
],
UserAuth::class => [
'withAuthUrl()' => [$params['yiisoft/user']['authUrl']],
],
WebAuth::class => [
'withAuthUrl()' => [$params['yiisoft/user']['authUrl']],
],
AuthenticationMethodInterface::class => WebAuth::class,
GuestIdentityFactoryInterface::class => GuestIdentityFactory::class,
CookieLoginMiddleware::class => [
'__construct()' => [
'forceAddCookie' => $params['yiisoft/user']['cookieLogin']['forceAddCookie'],
],
],
CookieLogin::class => [
'__construct()' => [
'duration' => $params['yiisoft/user']['cookieLogin']['duration'] !== null ?
new DateInterval($params['yiisoft/user']['cookieLogin']['duration']) :
null,
],
],
];