简体   繁体   中英

How do I configure Symfony security.yml in phalcon project?

I am trying to use Symfony's security component in a phalcon project. I read symfony security.yml documentation but I am not sure how that configuration gets injected and how can I make it available in phalcon project.

So far, I have configured TokenStorage as a service in phalcon services.php

/**
* Symfony TokenStorage
 */
$di->setShared( 'tokenStorage', function () use ( $di )
{
    $session = $di->getSession();
    if ( $session->has( 'tokenStorage' ) )
    {
        return $session->get( 'tokenStorage' );
    } else
    {
        $session->set( 'tokenStorage', new \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage(
                                     $di[ 'authProvider' ]
                                 )
        );

        return $session->get( 'tokenStorage' );

    }
}
);

Any help much appreciated. Thanks in advance.

It's can be done so simple. I suggest to look at Silex SecurityServiceProvider class. Symfony security component requires Symfony Events, and Dispatcher and some others classes that have implementation of Symfony interfaces..

So if you have a lot of free time you can manage to work Symfony Security in Phalcon..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM