ApiGwAuthenticationUserProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 7
dl 0
loc 27
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A loadUserByUsernameAndPayload() 0 3 1
A loadUserByUsername() 0 3 1
A __construct() 0 3 1
A supportsClass() 0 3 1
A refreshUser() 0 3 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