1<?php
2
3/**
4 * This file is part of the FreeDSx LDAP package.
5 *
6 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace FreeDSx\Ldap\Server\Token;
13
14/**
15 * Represents a token for an anonymous bind.
16 *
17 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
18 */
19class AnonToken implements TokenInterface
20{
21    /**
22     * @var null|string
23     */
24    protected $username;
25
26    /**
27     * @var int
28     */
29    protected $version;
30
31    /**
32     * @param null|string $username
33     * @param int $version
34     */
35    public function __construct(?string $username = null, int $version = 3)
36    {
37        $this->username = $username;
38        $this->version = $version;
39    }
40
41    /**
42     * {@inheritdoc}
43     */
44    public function getUsername(): ?string
45    {
46        return $this->username;
47    }
48
49    /**
50     * @return null
51     */
52    public function getPassword(): ?string
53    {
54        return null;
55    }
56
57    /**
58     * {@inheritdoc}
59     */
60    public function getVersion(): int
61    {
62        return $this->version;
63    }
64}
65