Skip to content

Update form_login_setup.rst #11108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions security/form_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,50 @@ class that processes the login submit and 4) updates the main security config fi
}
}

Edit the security.yml file in order to allow access to the ``/login`` route:

.. configuration-block::

.. code-block:: yaml

# config/packages/security.yaml
security:
# ...

access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
# ...

.. code-block:: xml

<!-- config/packages/security.xml -->
<?xml version="1.0" charset="UTF-8" ?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<config>
<rule path="^/login" role="IS_AUTHENTICATED_ANONYMOUSLY" />
<!-- ... -->
</config>
</srv:container>

.. code-block:: php

// config/packages/security.php
$container->loadFromExtension('security', [
// ...
'access_control' => [
[
'path' => '^/login',
'roles' => 'IS_AUTHENTICATED_ANONYMOUSLY',
],
// ...
],
]);

**Step 2.** The template has very little to do with security: it just generates
a traditional HTML form that submits to ``/login``:

Expand Down