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