parameters:
    nelmio_security.external_redirects.whitelist: ~

services:
    nelmio_security.external_redirect_listener:
        class: Nelmio\SecurityBundle\EventListener\ExternalRedirectListener
        arguments:
            - '%nelmio_security.external_redirects.abort%'
            - '%nelmio_security.external_redirects.override%'
            - '%nelmio_security.external_redirects.forward_as%'
            - '@?nelmio_security.external_redirect.target_validator'
            - '@?logger'
            - '@?router'
        tags:
            - { name: kernel.event_listener, event: kernel.response, method: onKernelResponse }
            - { name: monolog.logger, channel: security }

    nelmio_security.external_redirect.target_validator:
        alias: nelmio_security.external_redirect.target_validator.whitelist

    nelmio_security.external_redirect.target_validator.whitelist:
        public: false
        class: Nelmio\SecurityBundle\ExternalRedirect\WhitelistBasedTargetValidator
        arguments:
            - '%nelmio_security.external_redirects.whitelist%'
