1 | <?php |
||
26 | class InMemoryApiUserProvider implements UserProviderInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private $users; |
||
32 | |||
33 | /** |
||
34 | * Constructor class. |
||
35 | * |
||
36 | * @param array $users The list of given users in security |
||
37 | */ |
||
38 | public function __construct(array $users = []) |
||
42 | |||
43 | /** |
||
44 | * Returns a username for a given api key. |
||
45 | * |
||
46 | * @param string $apiKey |
||
47 | * |
||
48 | * @return string|null |
||
49 | */ |
||
50 | public function getUsernameByApiKey($apiKey) |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function loadUserByUsername($username) |
||
70 | |||
71 | /** |
||
72 | * Adds a new User to the provider. |
||
73 | * |
||
74 | * @param UserInterface $user A UserInterface instance |
||
75 | * |
||
76 | * @return void |
||
77 | * @throws \LogicException |
||
78 | */ |
||
79 | public function createUser(UserInterface $user) |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function refreshUser(UserInterface $user) |
||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | public function supportsClass($class) |
||
103 | |||
104 | /** |
||
105 | * Returns the user by given username. |
||
106 | * |
||
107 | * @param string $username The username |
||
108 | * |
||
109 | * @return User |
||
110 | * @throws UsernameNotFoundException If user whose given username does not exist. |
||
111 | */ |
||
112 | private function getUser($username) |
||
123 | } |
||
124 |