Completed
Push — master ( af0e0d...dc2a9c )
by Florian
28s queued 11s
created

TokenAuthenticator::authenticate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the TheAlternativeZurich/events project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Security;
13
14
use Symfony\Component\HttpFoundation\RedirectResponse;
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\HttpFoundation\Response;
17
use Symfony\Component\Intl\Exception\MethodNotImplementedException;
18
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
19
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
20
use Symfony\Component\Security\Core\Exception\AuthenticationException;
21
use Symfony\Component\Security\Core\User\UserInterface;
22
use Symfony\Component\Security\Core\User\UserProviderInterface;
23
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
24
25
class TokenAuthenticator extends AbstractGuardAuthenticator
26
{
27
    /**
28
     * @var UrlGeneratorInterface
29
     */
30
    private $generator;
31
32
    /**
33
     * TokenAuthenticator constructor.
34
     */
35
    public function __construct(UrlGeneratorInterface $generator)
36
    {
37
        $this->generator = $generator;
38
    }
39
40
    public function supports(Request $request): ?bool
41
    {
42
        return false;
43
    }
44
45
    public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
46
    {
47
        throw new MethodNotImplementedException(__FUNCTION__);
48
    }
49
50
    public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
51
    {
52
        throw new MethodNotImplementedException(__FUNCTION__);
53
    }
54
55
    public function start(Request $request, AuthenticationException $authException = null)
56
    {
57
        return new RedirectResponse($this->generator->generate('create'));
58
    }
59
60
    public function getCredentials(Request $request)
61
    {
62
        throw new MethodNotImplementedException(__FUNCTION__);
63
    }
64
65
    public function getUser($credentials, UserProviderInterface $userProvider)
66
    {
67
        throw new MethodNotImplementedException(__FUNCTION__);
68
    }
69
70
    public function checkCredentials($credentials, UserInterface $user)
71
    {
72
        throw new MethodNotImplementedException(__FUNCTION__);
73
    }
74
75
    public function supportsRememberMe()
76
    {
77
        return true;
78
    }
79
}
80