-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathServices.php
More file actions
62 lines (51 loc) · 1.37 KB
/
Services.php
File metadata and controls
62 lines (51 loc) · 1.37 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter Shield.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Shield\Config;
use CodeIgniter\Config\BaseService;
use CodeIgniter\Shield\Auth;
use CodeIgniter\Shield\Authentication\JWTManager;
use CodeIgniter\Shield\Authentication\Passwords;
use CodeIgniter\Shield\Config\Auth as AuthConfig;
class Services extends BaseService
{
/**
* The base auth class
*/
public static function auth(bool $getShared = true): Auth
{
if ($getShared) {
return self::getSharedInstance('auth');
}
/** @var AuthConfig $config */
$config = config('Auth');
return new Auth($config);
}
/**
* Password utilities.
*/
public static function passwords(bool $getShared = true): Passwords
{
if ($getShared) {
return self::getSharedInstance('passwords');
}
return new Passwords(config('Auth'));
}
/**
* JWT Manager.
*/
public static function jwtmanager(bool $getShared = true): JWTManager
{
if ($getShared) {
return self::getSharedInstance('jwtmanager');
}
return new JWTManager();
}
}