@@ -57,31 +57,34 @@ Now let's set up `getAuthenticationService()` and make sure to load all needed A
57
57
AbstractIdentifier::CREDENTIAL_USERNAME => 'email',
58
58
AbstractIdentifier::CREDENTIAL_PASSWORD => 'password',
59
59
];
60
-
61
- // Load identifiers
62
- $service->loadIdentifier('Authentication.Password', [
63
- 'fields' => $fields,
64
- 'resolver' => [
65
- 'className' => 'Authentication.Orm',
66
- 'finder' => 'active',
67
- ],
68
- ]);
69
- $service->loadIdentifier('Authentication.Token', [
70
- 'tokenField' => 'id',
71
- 'dataField' => 'key',
72
- 'resolver' => [
73
- 'className' => 'Authentication.Orm',
74
- 'finder' => 'active',
60
+ $passwordIdentifier = [
61
+ 'Authentication.Password' => [
62
+ 'fields' => $fields,
63
+ 'resolver' => [
64
+ 'className' => 'Authentication.Orm',
65
+ 'finder' => 'active',
66
+ ],
75
67
],
76
- ]) ;
68
+ ];
77
69
78
70
// Load the authenticators. Session should be first.
79
71
$service->loadAuthenticator('TinyAuth.PrimaryKeySession', [
72
+ 'identifier' => [
73
+ 'Authentication.Token' => [
74
+ 'tokenField' => 'id',
75
+ 'dataField' => 'key',
76
+ 'resolver' => [
77
+ 'className' => 'Authentication.Orm',
78
+ 'finder' => 'active',
79
+ ],
80
+ ],
81
+ ],
80
82
'urlChecker' => 'Authentication.CakeRouter',
81
83
]);
82
84
$service->loadAuthenticator('Authentication.Form', [
83
- 'urlChecker ' => 'Authentication.CakeRouter' ,
85
+ 'identifier ' => $passwordIdentifier ,
84
86
'fields' => $fields,
87
+ 'urlChecker' => 'Authentication.CakeRouter',
85
88
'loginUrl' => [
86
89
'prefix' => false,
87
90
'plugin' => false,
@@ -90,12 +93,10 @@ Now let's set up `getAuthenticationService()` and make sure to load all needed A
90
93
],
91
94
]);
92
95
$service->loadAuthenticator('Authentication.Cookie', [
93
- 'urlChecker ' => 'Authentication.CakeRouter' ,
96
+ 'identifier ' => $passwordIdentifier ,
94
97
'rememberMeField' => 'remember_me',
95
- 'fields' => [
96
- 'username' => 'email',
97
- 'password' => 'password',
98
- ],
98
+ 'fields' => $fields,
99
+ 'urlChecker' => 'Authentication.CakeRouter',
99
100
'loginUrl' => [
100
101
'prefix' => false,
101
102
'plugin' => false,
@@ -105,16 +106,18 @@ Now let's set up `getAuthenticationService()` and make sure to load all needed A
105
106
]);
106
107
107
108
// This is a one click token login as optional addition
108
- $service->loadIdentifier('Tools.LoginLink', [
109
- 'resolver' => [
110
- 'className' => 'Authentication.Orm',
111
- 'finder' => 'active',
112
- ],
113
- 'preCallback' => function (int $id) {
114
- TableRegistry::getTableLocator()->get('Users')->confirmEmail($id);
115
- },
116
- ]);
117
109
$service->loadAuthenticator('Tools.LoginLink', [
110
+ 'identifier' => [
111
+ 'Tools.LoginLink' => [
112
+ 'resolver' => [
113
+ 'className' => 'Authentication.Orm',
114
+ 'finder' => 'active',
115
+ ],
116
+ 'preCallback' => function (int $id) {
117
+ TableRegistry::getTableLocator()->get('Users')->confirmEmail($id);
118
+ },
119
+ ],
120
+ ],
118
121
'urlChecker' => 'Authentication.CakeRouter',
119
122
'loginUrl' => [
120
123
'prefix' => false,
0 commit comments