1000 search results

// ... lines 1 - 19
class JwtTokenAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 22 - 68
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
}
// ... lines 73 - 95
}
See Code Block in Script
// ... lines 1 - 19
class JwtTokenAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 22 - 68
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
return new JsonResponse('Hello!', 401);
}
// ... lines 73 - 95
}
See Code Block in Script
// ... lines 1 - 19
class JwtTokenAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 22 - 68
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
$apiProblem = new ApiProblem(401);
// ... lines 72 - 75
}
// ... lines 77 - 99
}
See Code Block in Script
// ... lines 1 - 70
$apiProblem = new ApiProblem(401);
// you could translate this
$apiProblem->set('detail', $exception->getMessageKey());
// ... lines 74 - 101
See Code Block in Script
// ... lines 1 - 70
$apiProblem = new ApiProblem(401);
// you could translate this
$apiProblem->set('detail', $exception->getMessageKey());
return $this->responseFactory->createResponse($apiProblem);
// ... lines 76 - 101
See Code Block in Script
// ... lines 1 - 19
class JwtTokenAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 22 - 48
public function getUser($credentials, UserProviderInterface $userProvider)
{
$data = $this->jwtEncoder->decode($credentials);
if ($data === false) {
throw new CustomUserMessageAuthenticationException('Invalid Token');
}
$username = $data['username'];
return $this->em
->getRepository('AppBundle:User')
->findOneBy(['username' => $username]);
}
// ... lines 63 - 99
}
See Code Block in Script
// ... lines 1 - 2
namespace AppBundle\Security;
// ... lines 4 - 10
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
class WeirdFormAuthenticator extends AbstractGuardAuthenticator
{
// ... lines 15 - 42
}
See Code Block in Script
// ... lines 1 - 4
use Symfony\Component\HttpFoundation\Request;
// ... line 6
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
// ... lines 11 - 12
class WeirdFormAuthenticator extends AbstractGuardAuthenticator
{
public function getCredentials(Request $request)
{
}
public function getUser($credentials, UserProviderInterface $userProvider)
{
}
public function checkCredentials($credentials, UserInterface $user)
{
}
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
}
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
{
}
public function supportsRememberMe()
{
}
public function start(Request $request, AuthenticationException $authException = null)
{
}
}
See Code Block in Script
// ... lines 1 - 28
public function getCredentials(Request $request)
{
if ($request->getPathInfo() != '/login' || !$request->isMethod('POST')) {
return;
}
// ... lines 34 - 40
}
// ... 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'),
// ... 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