PHP code example of ruvents / manual-authentication-bundle
1. Go to this page and download the library: Download ruvents/manual-authentication-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ruvents / manual-authentication-bundle example snippets
namespace AppBundle\Controller;
use Ruvents\ManualAuthenticationBundle\Security\AuthenticationList;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @Route("/registration")
*/
class RegistrationController
{
/**
* @Route("")
* @Template()
*/
public function indexAction(AuthenticationList $authenticationList)
{
// registration form and etc
/** @var UserInterface $user */
// on form success
// you have to create relevant Tokens
// f.e. PostAuthenticationGuardToken for Guard auth
$token = new UsernamePasswordToken($user, $user->getPassword(), 'main', $user->getRoles());
$authenticationList->setToken('main', $token);
// redirect to next page
}
}