Skip to content

Commit ec95e19

Browse files
committed
Docs update.
1 parent 6e75d68 commit ec95e19

File tree

1 file changed

+34
-31
lines changed

1 file changed

+34
-31
lines changed

docs/AuthenticationPlugin.md

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,34 @@ Now let's set up `getAuthenticationService()` and make sure to load all needed A
5757
AbstractIdentifier::CREDENTIAL_USERNAME => 'email',
5858
AbstractIdentifier::CREDENTIAL_PASSWORD => 'password',
5959
];
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+
],
7567
],
76-
]);
68+
];
7769

7870
// Load the authenticators. Session should be first.
7971
$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+
],
8082
'urlChecker' => 'Authentication.CakeRouter',
8183
]);
8284
$service->loadAuthenticator('Authentication.Form', [
83-
'urlChecker' => 'Authentication.CakeRouter',
85+
'identifier' => $passwordIdentifier,
8486
'fields' => $fields,
87+
'urlChecker' => 'Authentication.CakeRouter',
8588
'loginUrl' => [
8689
'prefix' => false,
8790
'plugin' => false,
@@ -90,12 +93,10 @@ Now let's set up `getAuthenticationService()` and make sure to load all needed A
9093
],
9194
]);
9295
$service->loadAuthenticator('Authentication.Cookie', [
93-
'urlChecker' => 'Authentication.CakeRouter',
96+
'identifier' => $passwordIdentifier,
9497
'rememberMeField' => 'remember_me',
95-
'fields' => [
96-
'username' => 'email',
97-
'password' => 'password',
98-
],
98+
'fields' => $fields,
99+
'urlChecker' => 'Authentication.CakeRouter',
99100
'loginUrl' => [
100101
'prefix' => false,
101102
'plugin' => false,
@@ -105,16 +106,18 @@ Now let's set up `getAuthenticationService()` and make sure to load all needed A
105106
]);
106107

107108
// 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-
]);
117109
$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+
],
118121
'urlChecker' => 'Authentication.CakeRouter',
119122
'loginUrl' => [
120123
'prefix' => false,

0 commit comments

Comments
 (0)