1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace kalanis\kw_auth; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use kalanis\kw_auth\Interfaces; |
7
|
|
|
use kalanis\kw_accounts\Interfaces as acc_interfaces; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class Auth |
12
|
|
|
* @package kalanis\kw_auth |
13
|
|
|
* Authenticate the user with predefined methods - pass auth tree into module |
14
|
|
|
*/ |
15
|
|
|
class Auth |
16
|
|
|
{ |
17
|
|
|
/** @var acc_interfaces\IUser|acc_interfaces\IUserCert|null */ |
18
|
|
|
protected static $authenticator = null; |
19
|
|
|
protected static ?acc_interfaces\IAuth $auth = null; |
20
|
|
|
protected static ?acc_interfaces\IProcessGroups $groups = null; |
21
|
|
|
protected static ?acc_interfaces\IProcessClasses $classes = null; |
22
|
|
|
protected static ?acc_interfaces\IProcessAccounts $accounts = null; |
23
|
|
|
|
24
|
|
|
protected static ?AuthTree $authTree = null; |
25
|
|
|
|
26
|
1 |
|
static public function fill(Methods\AMethods $authMethods): void |
27
|
|
|
{ |
28
|
1 |
|
static::$authTree = new AuthTree(); |
29
|
1 |
|
static::$authTree->setTree($authMethods); |
30
|
1 |
|
} |
31
|
|
|
|
32
|
1 |
|
static public function getTree(): ?Interfaces\IAuthTree |
33
|
|
|
{ |
34
|
1 |
|
return static::$authTree; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param acc_interfaces\IUser|acc_interfaces\IUserCert|null $authenticator |
39
|
|
|
*/ |
40
|
1 |
|
static public function setAuthenticator($authenticator): void |
41
|
|
|
{ |
42
|
1 |
|
static::$authenticator = $authenticator; |
43
|
1 |
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return acc_interfaces\IUser|acc_interfaces\IUserCert|null |
47
|
|
|
*/ |
48
|
1 |
|
static public function getAuthenticator() |
49
|
|
|
{ |
50
|
1 |
|
return static::$authenticator; |
51
|
|
|
} |
52
|
|
|
|
53
|
1 |
|
static public function setAuth(?acc_interfaces\IAuth $auth): void |
54
|
|
|
{ |
55
|
1 |
|
static::$auth = $auth; |
56
|
1 |
|
} |
57
|
|
|
|
58
|
1 |
|
static public function getAuth(): ?acc_interfaces\IAuth |
59
|
|
|
{ |
60
|
1 |
|
return static::$auth; |
61
|
|
|
} |
62
|
|
|
|
63
|
1 |
|
static public function setGroups(?acc_interfaces\IProcessGroups $groups): void |
64
|
|
|
{ |
65
|
1 |
|
static::$groups = $groups; |
66
|
1 |
|
} |
67
|
|
|
|
68
|
1 |
|
static public function getGroups(): ?acc_interfaces\IProcessGroups |
69
|
|
|
{ |
70
|
1 |
|
return static::$groups; |
71
|
|
|
} |
72
|
|
|
|
73
|
1 |
|
static public function setClasses(?acc_interfaces\IProcessClasses $classes): void |
74
|
|
|
{ |
75
|
1 |
|
static::$classes = $classes; |
76
|
1 |
|
} |
77
|
|
|
|
78
|
1 |
|
static public function getClasses(): ?acc_interfaces\IProcessClasses |
79
|
|
|
{ |
80
|
1 |
|
return static::$classes; |
81
|
|
|
} |
82
|
|
|
|
83
|
1 |
|
static public function setAccounts(?acc_interfaces\IProcessAccounts $accounts): void |
84
|
|
|
{ |
85
|
1 |
|
static::$accounts = $accounts; |
86
|
1 |
|
} |
87
|
|
|
|
88
|
1 |
|
static public function getAccounts(): ?acc_interfaces\IProcessAccounts |
89
|
|
|
{ |
90
|
1 |
|
return static::$accounts; |
91
|
|
|
} |
92
|
|
|
} |
93
|
|
|
|