Dynamic settings in security.yml

Explores what I'm trying to access is to automatically redirect my application to the user-entered URL after logging in. Since I have a centralized authentication server, I cannot use the user's HTTP_REFERER, because it always returns null when I pass the authentication server.

My solution is to use an application security.ymlon my server to pass the redirect URL as a url parameter. I implemented this as follows:

parameters.php

$container->setParameter('referer', $_SERVER['REQUEST_URI']);

security.yml

    secured_area:
        pattern: ^/
        stateless: true
        form_login: 
            login_path: %accounts_host%/signin?referer=%referer%
        simple_preauth:
            authenticator: app.security.authenticator 

, referer security.yml . url , . , www.appserver.com/product/1, , www.appserver.com/product/200, referer www.appserver.com/product/1 .

, print_r($_SERVER['REQUEST_URI']); exit(); parameters.php, .

, . referer security.yml . :)

+4

All Articles