@@ -63,7 +63,7 @@ You can add basic token configuration using ``config.yml`` and the parameters ke
63
63
// app/config/config.php
64
64
$container->setParameter('tokens', array(
65
65
'client1' => 'pass1',
66
- 'client2' => 'pass2'
66
+ 'client2' => 'pass2',
67
67
));
68
68
69
69
Tag Controllers to be checked
@@ -87,7 +87,7 @@ A controller that implements this interface simply looks like this::
87
87
88
88
class FooController implements TokenAuthenticatedController
89
89
{
90
- // Your actions that need authentication
90
+ // ... Your actions that need authentication
91
91
}
92
92
93
93
Creating an Event Listener
@@ -97,6 +97,7 @@ Next, you'll need to create an event listener, which will hold the logic
97
97
that you want executed before your controllers. If you're not familiar with
98
98
event listeners, you can learn more about them at :doc: `/cookbook/service_container/event_listener `::
99
99
100
+ // src/Acme/DemoBundle/EventListener/BeforeListener.php
100
101
namespace Acme\DemoBundle\EventListener;
101
102
102
103
use Acme\DemoBundle\Controller\TokenAuthenticatedController;
@@ -144,7 +145,7 @@ your listener to be called just before any controller is executed:
144
145
145
146
.. code-block :: yaml
146
147
147
- # app/config/config.yml (or inside or your services.yml)
148
+ # app/config/config.yml (or inside your services.yml)
148
149
services :
149
150
demo.tokens.action_listener :
150
151
class : Acme\DemoBundle\EventListener\BeforeListener
@@ -154,13 +155,15 @@ your listener to be called just before any controller is executed:
154
155
155
156
.. code-block :: xml
156
157
158
+ <!-- app/config/config.xml (or inside your services.xml) -->
157
159
<service id =" demo.tokens.action_listener" class =" Acme\DemoBundle\EventListener\BeforeListener" >
158
160
<argument >%tokens%</argument >
159
161
<tag name =" kernel.event_listener" event =" kernel.controller" method =" onKernelController" />
160
162
</service >
161
163
162
164
.. code-block :: php
163
165
166
+ // app/config/config.php (or inside your services.php)
164
167
use Symfony\Component\DependencyInjection\Definition;
165
168
166
169
$listener = new Definition('Acme\DemoBundle\EventListener\BeforeListener', array('%tokens%'));
0 commit comments