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\Protocol\ServerProtocolHandler; 13 14use FreeDSx\Ldap\Protocol\LdapMessageRequest; 15use FreeDSx\Ldap\Protocol\Queue\ServerQueue; 16use FreeDSx\Ldap\Server\RequestContext; 17use FreeDSx\Ldap\Server\RequestHandler\RequestHandlerInterface; 18use FreeDSx\Ldap\Server\Token\TokenInterface; 19 20/** 21 * Handles search request logic. 22 * 23 * @author Chad Sikorra <Chad.Sikorra@gmail.com> 24 */ 25class ServerSearchHandler implements ServerProtocolHandlerInterface 26{ 27 use ServerSearchTrait; 28 29 /** 30 * @inheritDoc 31 */ 32 public function handleRequest( 33 LdapMessageRequest $message, 34 TokenInterface $token, 35 RequestHandlerInterface $dispatcher, 36 ServerQueue $queue, 37 array $options 38 ): void { 39 $context = new RequestContext( 40 $message->controls(), 41 $token 42 ); 43 $request = $this->getSearchRequestFromMessage($message); 44 45 $entries = $dispatcher->search( 46 $context, 47 $request 48 ); 49 50 $this->sendEntriesToClient( 51 $entries, 52 $message, 53 $queue 54 ); 55 } 56} 57