1<?php
2/**
3 * This file is part of the FreeDSx LDAP package.
4 *
5 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11namespace FreeDSx\Ldap\Operation\Request;
12
13use FreeDSx\Asn1\Asn1;
14use FreeDSx\Asn1\Type\AbstractType;
15
16/**
17 * Represents an anonymous bind request.
18 *
19 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
20 */
21class AnonBindRequest extends BindRequest
22{
23    /**
24     * @param string $username
25     * @param int $version
26     */
27    public function __construct(string $username = '', int $version = 3)
28    {
29        $this->username = $username;
30        $this->version = $version;
31    }
32
33    /**
34     * {@inheritdoc}
35     */
36    protected function getAsn1AuthChoice(): AbstractType
37    {
38        return Asn1::context(0, Asn1::octetString(''));
39    }
40
41    /**
42     * {@inheritdoc}
43     */
44    protected function validate(): void
45    {
46    }
47}
48