AdUser::getSalt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Riper\Security\ActiveDirectoryBundle\Security\User;
4
5
use Symfony\Component\Security\Core\User\UserInterface;
6
7
class AdUser implements UserInterface
8
{
9
    /** @var string */
10
    private $username;
11
12
    /** @var string */
13
    private $password;
14
15
    /** @var array */
16
    private $roles;
17
18
    /** @var string */
19
    private $displayName;
20
21
    /** @var string */
22
    private $email;
23
24
    public function __construct($username, $password, array $roles)
25
    {
26
        $this->username = $username;
27
        $this->password = $password;
28
        $this->roles = $roles;
29
    }
30
31
    /**
32
     * Returns the password used to authenticate the user.
33
     *
34
     * This should be the encoded password. On authentication, a plain-text
35
     * password will be salted, encoded, and then compared to this value.
36
     *
37
     * @return string The password
38
     */
39
    public function getPassword()
40
    {
41
        return $this->password;
42
    }
43
44
    /**
45
     * Sets the password used to authenticate the user.
46
     *
47
     * This should be the encoded password.
48
     *
49
     * @param string $password
50
     */
51
    public function setPassword($password)
52
    {
53
        $this->password = $password;
54
    }
55
56
    /**
57
     * Returns the salt that was originally used to encode the password.
58
     *
59
     * This can return null if the password was not encoded using a salt.
60
     *
61
     * @return string The salt
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
62
     */
63
    public function getSalt()
64
    {
65
        return null;
66
    }
67
68
    /**
69
     * Returns the username used to authenticate the user.
70
     *
71
     * @return string The username
72
     */
73
    public function getUsername()
74
    {
75
        return $this->username;
76
    }
77
78
    /**
79
     * Returns the display name of the authenticated user.
80
     *
81
     * @return string
82
     */
83
    public function getDisplayName()
84
    {
85
        return $this->displayName;
86
    }
87
88
    /**
89
     * Set the display name of the authenticated user.
90
     *
91
     * @param string $displayName
92
     */
93
    public function setDisplayName($displayName)
94
    {
95
        $this->displayName = $displayName;
96
    }
97
98
    /**
99
     * Returns the email address of the authenticated user.
100
     *
101
     * @return string
102
     */
103
    public function getEmail()
104
    {
105
        return $this->email;
106
    }
107
108
    /**
109
     * Set the email address of the authenticated user.
110
     *
111
     * @param string $email
112
     */
113
    public function setEmail($email)
114
    {
115
        $this->email = $email;
116
    }
117
118
    /**
119
     * Removes sensitive data from the user.
120
     *
121
     * This is important if, at any given point, sensitive information like
122
     * the plain-text password is stored on this object.
123
     *
124
     * @return void
125
     */
126
    public function eraseCredentials()
127
    {
128
        //return void;
129
    }
130
131
    /**
132
     * Returns the roles granted to the user.
133
     *
134
     * <code>
135
     * public function getRoles()
136
     * {
137
     *     return array('ROLE_USER');
138
     * }
139
     * </code>
140
     *
141
     * Alternatively, the roles might be stored on a ``roles`` property,
142
     * and populated in any number of different ways when the user object
143
     * is created.
144
     *
145
     * @return array Role[] The user roles
146
     */
147
    public function getRoles()
148
    {
149
        return  $this->roles;
150
    }
151
152
    /**
153
     * Sets the roles for the user.
154
     *
155
     * @param array $roles
156
     */
157
    public function setRoles(array $roles)
158
    {
159
        $this->roles = $roles;
160
    }
161
}
162