Skip to content

Commit 71fd24a

Browse files
authored
Merge pull request #339 from ndm2/master
Quick start guide improvements
2 parents c391854 + ad17426 commit 71fd24a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/en/index.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Example of configuring the authentication middleware using ``authentication`` ap
4545
public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface
4646
{
4747
$service = new AuthenticationService();
48+
$service->setConfig([
49+
'unauthenticatedRedirect' => '/users/login',
50+
'queryParam' => 'redirect',
51+
]);
4852

4953
$fields = [
5054
'username' => 'email',
@@ -128,7 +132,18 @@ like::
128132
}
129133
}
130134

131-
Then add a simple logout action::
135+
Make sure that you whitelist the ``login`` action in your controller's
136+
``beforeFilter()`` callback as mentioned in the previous section, so that
137+
unauthenticated users are able to access it::
138+
139+
public function beforeFilter(\Cake\Event\EventInterface $event)
140+
{
141+
parent::beforeFilter($event);
142+
143+
$this->Authentication->allowUnauthenticated(['login']);
144+
}
145+
146+
and then add a simple logout action::
132147

133148
public function logout()
134149
{

0 commit comments

Comments
 (0)