@@ -33,18 +33,18 @@ public function isHttpAuthenticated() : bool
33
33
if ( $ this ->applyFilter ('basic-authentication ' , true ) ) {
34
34
if ( $ this ->isBasicAuth () ) {
35
35
36
- $ username = $ this ->getBasicAuthUser ();
37
- $ password = $ this ->getBasicAuthPwd ();
36
+ $ user = $ this ->getBasicAuthUser ();
37
+ $ pswd = $ this ->getBasicAuthPwd ();
38
38
39
39
// API authenticate override
40
40
$ this ->doAction ('api-authenticate ' , [
41
- 'username ' => $ username ,
41
+ 'username ' => $ user ,
42
42
'address ' => $ this ->getServerIp (),
43
43
'method ' => 'basic '
44
44
]);
45
45
46
- if ( $ username == $ this ->getApiUsername ()
47
- && $ password == $ this ->getApiPassword () ) {
46
+ if ( $ user == $ this ->getApiUsername ()
47
+ && $ pswd == $ this ->getApiPassword () ) {
48
48
return true ;
49
49
}
50
50
}
@@ -74,22 +74,22 @@ public function isHttpAuthenticated() : bool
74
74
*/
75
75
protected function isGranted (string $ token ) : bool
76
76
{
77
- $ access = $ this ->getTokenAccess ($ token , $ this ->getSecret (true ));
78
- $ username = $ this -> matchString ( $ this -> getTokenPattern (), $ access, 1 ) ;
79
- $ password = $ this -> matchString ( $ this -> getTokenPattern (), $ access, 2 ) ;
77
+ $ access = $ this ->getTokenAccess ($ token , $ this ->getSecret (true ));
78
+ $ user = $ access[ ' user ' ] ?? false ;
79
+ $ pswd = $ access[ ' pswd ' ] ?? false ;
80
80
81
- if ( $ username && $ password ) {
81
+ if ( $ user && $ pswd ) {
82
82
83
83
// API authenticate override
84
84
$ this ->doAction ('api-authenticate ' , [
85
- 'username ' => $ username ,
85
+ 'username ' => $ user ,
86
86
'address ' => $ this ->getServerIp (),
87
87
'method ' => 'token '
88
88
]);
89
89
90
90
// Match authentication
91
- if ( $ username == $ this ->getApiUsername ()
92
- && $ password == $ this ->getApiPassword () ) {
91
+ if ( $ user == $ this ->getApiUsername ()
92
+ && $ pswd == $ this ->getApiPassword () ) {
93
93
return true ;
94
94
}
95
95
}
0 commit comments