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\Operation\Request;
13
14use FreeDSx\Asn1\Asn1;
15use FreeDSx\Asn1\Type\AbstractType;
16
17/**
18 * Represents an anonymous bind request.
19 *
20 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
21 */
22class AnonBindRequest extends BindRequest
23{
24    /**
25     * @param string $username
26     * @param int $version
27     */
28    public function __construct(string $username = '', int $version = 3)
29    {
30        $this->username = $username;
31        $this->version = $version;
32    }
33
34    /**
35     * {@inheritdoc}
36     */
37    protected function getAsn1AuthChoice(): AbstractType
38    {
39        return Asn1::context(0, Asn1::octetString(''));
40    }
41
42    /**
43     * {@inheritdoc}
44     */
45    protected function validate(): void
46    {
47    }
48}
49