symfony - FOS Rest Bundle AccessDeniedListener not called -
i've been scratching head while. looking @ symfony's exception handling , checking listeners configured. saw fos rest bundle provides accessdeniedlistener
defined in services definition
<service id="fos_rest.access_denied_listener" class="%fos_rest.access_denied_listener.class%"> <tag name="kernel.event_subscriber" /> <tag name="monolog.logger" channel="request" /> <argument>%fos_rest.access_denied_listener.formats%</argument> <argument>%fos_rest.access_denied_listener.unauthorized_challenge%</argument> <argument>%twig.exception_listener.controller%</argument> <argument type="service" id="logger" on-invalid="null" /> </service>
however putting die()
inside getsubscribedevents
of has no effect i'm guessing it's being ignored reason. thought getsubscribedevents
method of class kernel.event_subscriber
tag called, wrong?
i tried putting service definition inside own bundle, didn't work.
just looking @ symfony symfony\component\httpkernel\eventlistener\exceptionlistener
can see adding kernel.event_subscriber
tag , works, subscriber called expected. putting breakpoint on addsubscriber
method in symfony eventdispatcher shows me no subscribers being added @ all. i'm confused , maybe have misunderstood how subscribers / listeners work.
just case of not reading docs enough, wasn't called because has enabled
config.yml
unauthorized_challenge: "basic realm=\"restricted area\"" access_denied_listener: json: true
Comments
Post a Comment