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 username/password token that is bound and authorized.
16 *
17 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
18 */
19class BindToken implements TokenInterface
20{
21    /**
22     * @var string
23     */
24    protected $username;
25
26    /**
27     * @var string
28     */
29    protected $password;
30
31    /**
32     * @var int
33     */
34    protected $version;
35
36    /**
37     * @param string $username
38     * @param string $password
39     * @param int $version
40     */
41    public function __construct(string $username, string $password, int $version = 3)
42    {
43        $this->username = $username;
44        $this->password = $password;
45        $this->version = $version;
46    }
47
48    /**
49     * @return string
50     */
51    public function getUsername(): ?string
52    {
53        return $this->username;
54    }
55
56    /**
57     * @return string
58     */
59    public function getPassword(): ?string
60    {
61        return $this->password;
62    }
63
64    /**
65     * {@inheritdoc}
66     */
67    public function getVersion(): int
68    {
69        return $this->version;
70    }
71}
72