Download src/User/Application/CommandHandlers/BasicAuthCommandHandler.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 738 Bytes
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/User/Application/CommandHandlers/BasicAuthCommandHandler.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/User/Application/CommandHandlers/BasicAuthCommandHandler.php
-
curl -L -o BasicAuthCommandHandler.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/User/Application/CommandHandlers/BasicAuthCommandHandler.php
738 Bytes
| declare(strict_types=1); | |
| namespace User\Application\CommandHandlers; | |
| use User\Application\Commands\BasicAuthCommand; | |
| use User\Domain\Entities\UserEntity; | |
| use User\Domain\Exceptions\UserNotFoundException; | |
| use User\Domain\Exceptions\InvalidPasswordException; | |
| use User\Domain\Repositories\UserRepositoryInterface; | |
| class BasicAuthCommandHandler | |
| { | |
| public function __construct( | |
| private UserRepositoryInterface $repo, | |
| ) { | |
| } | |
| /** | |
| * @throws UserNotFoundException | |
| * @throws InvalidPasswordException | |
| */ | |
| public function handle(BasicAuthCommand $cmd): UserEntity | |
| { | |
| $user = $this->repo->ofEmail($cmd->email); | |
| $user->verifyPassword($cmd->password); | |
| return $user; | |
| } | |
| } | |