Failed Conditions
Push — master ( 1312dd...bb342a )
by Florent
04:40
created

getAuthenticationMethodReferenceFor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\ServerBundle\Tests\TestBundle\Entity;
15
16
use OAuth2Framework\Component\Core\UserAccount\AuthenticationContextClassReferenceSupport;
17
use OAuth2Framework\Component\Core\UserAccount\AuthenticationMethodReferenceSupport;
18
use OAuth2Framework\Component\Core\UserAccount\UserAccount;
19
use OAuth2Framework\Component\Core\UserAccount\UserAccountManager as UserAccountManagerInterface;
20
21
class UserAccountManager implements UserAccountManagerInterface, AuthenticationMethodReferenceSupport, AuthenticationContextClassReferenceSupport
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function isPasswordCredentialValid(UserAccount $user, string $password): bool
27
    {
28
        if (!$user instanceof User) {
29
            return false;
30
        }
31
32
        return in_array($password, $user->getOAuth2Passwords());
33
    }
34
35
    public function getAuthenticationContextClassReferenceFor(UserAccount $user): ?string
36
    {
37
        return null;
38
    }
39
40
    public function getAuthenticationMethodReferenceFor(UserAccount $user): ?array
41
    {
42
        return null;
43
    }
44
}
45