1000 search results

// ... lines 1 - 28
public function getCredentials(Request $request)
{
// ... lines 31 - 34
return [
'username' => $request->request->get('_username'),
// ... lines 37 - 39
];
}
// ... lines 42 - 101
See Code Block in Script
// ... lines 1 - 28
public function getCredentials(Request $request)
{
// ... lines 31 - 34
return [
'username' => $request->request->get('_username'),
'password' => $request->request->get('_password'),
'answer' => $request->request->get('the_answer'),
'terms' => $request->request->get('terms'),
];
}
// ... lines 42 - 101
See Code Block in Script
// ... lines 1 - 17
class WeirdFormAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 20 - 42
public function getUser($credentials, UserProviderInterface $userProvider)
{
$username = $credentials['username'];
// ... lines 46 - 53
}
// ... lines 55 - 99
}
See Code Block in Script
// ... lines 1 - 42
public function getUser($credentials, UserProviderInterface $userProvider)
{
$username = $credentials['username'];
// this looks like a weird username
if (substr($username, 0, 1) == '@') {
return;
}
// ... lines 51 - 53
}
// ... lines 55 - 101
See Code Block in Script
// ... lines 1 - 5
use Doctrine\ORM\EntityManager;
// ... lines 7 - 17
class WeirdFormAuthenticator extends AbstractGuardAuthenticator
{
private $em;
// ... lines 21 - 22
public function __construct(EntityManager $em, RouterInterface $router)
{
$this->em = $em;
// ... line 26
}
// ... lines 28 - 99
}
See Code Block in Script
// ... lines 1 - 42
public function getUser($credentials, UserProviderInterface $userProvider)
{
$username = $credentials['username'];
// ... lines 46 - 51
return $this->em->getRepository('AppBundle:User')
->findOneBy(['username' => $username]);
}
// ... lines 55 - 101
See Code Block in Script
// ... lines 1 - 55
public function checkCredentials($credentials, UserInterface $user)
{
if ($credentials['password'] != 'symfony3') {
return;
}
// ... lines 61 - 70
}
// ... lines 72 - 101
See Code Block in Script
// ... lines 1 - 55
public function checkCredentials($credentials, UserInterface $user)
{
// ... lines 58 - 61
if ($credentials['answer'] != 42) {
return;
}
if (!$credentials['terms']) {
return;
}
return true;
}
// ... lines 72 - 101
See Code Block in Script
// ... lines 1 - 72
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
// ... lines 75 - 79
}
// ... lines 81 - 101
See Code Block in Script
// ... lines 1 - 72
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
// ... lines 76 - 79
}
// ... lines 81 - 101
See Code Block in Script
// ... lines 1 - 9
use Symfony\Component\Routing\RouterInterface;
// ... lines 11 - 17
class WeirdFormAuthenticator extends AbstractGuardAuthenticator
{
// ... line 20
private $router;
public function __construct(EntityManager $em, RouterInterface $router)
{
// ... line 25
$this->router = $router;
}
// ... lines 28 - 99
}
See Code Block in Script
// ... lines 1 - 72
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
// ... lines 75 - 76
$url = $this->router->generate('login');
return new RedirectResponse($url);
}
// ... lines 81 - 101
See Code Block in Script
// ... lines 1 - 81
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
{
$url = $this->router->generate('homepage');
return new RedirectResponse($url);
}
// ... lines 88 - 101
See Code Block in Script
// ... lines 1 - 88
public function start(Request $request, AuthenticationException $authException = null)
{
$url = $this->router->generate('login');
return new RedirectResponse($url);
}
// ... lines 95 - 101
See Code Block in Script
// ... lines 1 - 95
public function supportsRememberMe()
{
return true;
}
// ... lines 100 - 101
See Code Block in Script
// ... lines 1 - 12
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
// ... lines 14 - 43
public function getUser($credentials, UserProviderInterface $userProvider)
{
// ... lines 46 - 48
if (substr($username, 0, 1) == '@') {
throw new CustomUserMessageAuthenticationException(
'Starting a username with @ is weird, don\'t you think?'
);
}
// ... lines 54 - 56
}
// ... lines 58 - 108
See Code Block in Script
// ... lines 1 - 58
public function checkCredentials($credentials, UserInterface $user)
{
// ... lines 61 - 64
if ($credentials['answer'] != 42) {
throw new CustomUserMessageAuthenticationException(
'Don\'t you read any books?'
);
}
// ... lines 70 - 77
}
// ... lines 79 - 108
See Code Block in Script
// ... lines 1 - 58
public function checkCredentials($credentials, UserInterface $user)
{
// ... lines 61 - 70
if (!$credentials['terms']) {
throw new CustomUserMessageAuthenticationException(
'Agree to our terms!!!'
);
}
return true;
}
// ... lines 79 - 108
See Code Block in Script
// ... lines 1 - 2
namespace AppBundle\Security;
// ... lines 4 - 18
class WeirdFormAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 21 - 23
public function __construct(EntityManager $em, RouterInterface $router)
{
// ... lines 26 - 27
}
// ... lines 29 - 106
}
See Code Block in Script
// ... lines 1 - 2
namespace AppBundle\Security;
class EvilSecurityRobot
{
public function doesRobotAllowAccess()
{
return rand(0, 10) >= 5;
}
}
See Code Block in Script