loadUserByUsername()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @see https://github.com/ecphp
8
 */
9
10
declare(strict_types=1);
11
12
namespace EcPhp\ApiGwAuthenticationBundle\Security\Core\User;
13
14
use Lexik\Bundle\JWTAuthenticationBundle\Security\User\JWTUserProvider;
15
use Lexik\Bundle\JWTAuthenticationBundle\Security\User\PayloadAwareUserProviderInterface;
16
use Symfony\Component\Security\Core\User\UserInterface;
17
18
final class ApiGwAuthenticationUserProvider implements PayloadAwareUserProviderInterface
19
{
20
    private PayloadAwareUserProviderInterface $userProvider;
21
22 5
    public function __construct()
23
    {
24 5
        $this->userProvider = new JWTUserProvider(ApiGwAuthenticationUser::class);
25
    }
26
27 1
    public function loadUserByUsername(string $username): UserInterface
28
    {
29 1
        return $this->userProvider->loadUserByUsername($username);
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Securi...e::loadUserByUsername() has been deprecated: since Symfony 5.3, use loadUserByIdentifier() instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

29
        return /** @scrutinizer ignore-deprecated */ $this->userProvider->loadUserByUsername($username);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
30
    }
31
32 1
    public function loadUserByUsernameAndPayload($username, array $payload)
33
    {
34 1
        return $this->userProvider->loadUserByUsernameAndPayload($username, $payload);
0 ignored issues
show
Deprecated Code introduced by
The function Lexik\Bundle\JWTAuthenti...rByUsernameAndPayload() has been deprecated: since 2.12, implement loadUserByIdentifierAndPayload() instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

34
        return /** @scrutinizer ignore-deprecated */ $this->userProvider->loadUserByUsernameAndPayload($username, $payload);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
35
    }
36
37 1
    public function refreshUser(UserInterface $user): UserInterface
38
    {
39 1
        return $this->userProvider->refreshUser($user);
40
    }
41
42 1
    public function supportsClass(string $class): bool
43
    {
44 1
        return $this->userProvider->supportsClass($class);
45
    }
46
}
47