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;
12
13use FreeDSx\Ldap\Exception\SkipReferralException;
14use FreeDSx\Ldap\Operation\Request\BindRequest;
15use FreeDSx\Ldap\Protocol\LdapMessageRequest;
16
17/**
18 * An interface for referral chasing.
19 *
20 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
21 */
22interface ReferralChaserInterface
23{
24    /**
25     * Chase a referral for a request. Return a bind request to be used when chasing the referral. The $bind parameter
26     * is the bind request the original LDAP client bound with (which may be null). Return null and no bind will be done.
27     *
28     * To skip a referral throw the SkipReferralException.
29     *
30     * @param LdapMessageRequest $request
31     * @param LdapUrl $referral
32     * @param BindRequest|null $bind
33     * @throws SkipReferralException
34     * @return BindRequest|null
35     */
36    public function chase(LdapMessageRequest $request, LdapUrl $referral, ?BindRequest $bind): ?BindRequest;
37
38    /**
39     * Construct the LdapClient with the options you want, and perform other tasks (such as StartTLS)
40     *
41     * @param array $options
42     * @return LdapClient
43     */
44    public function client(array $options): LdapClient;
45}
46