- Moved Authenticate to DI file def

This commit is contained in:
Dave Mc Nicoll committed 2025-03-28 13:37:38 +00:00
1 parent 23079e6040
commit d149e0a741
5 files changed
+22 -8

No files matched your search

+4 -1
View File
@@ -5,11 +5,13 @@ namespace Ulmus\User\Authorize\Header;
use Psr\Http\Message\ServerRequestInterface;
use Ulmus\User\Entity\BasicAuthUserInterface;
use Ulmus\User\Entity\UserInterface;
use Ulmus\User\Lib\Authenticate;
use Ulmus\User\Lib\Authorize;
class BasicMethod implements MethodInterface
{
public function __construct(
protected Authenticate $authorize,
protected BasicAuthUserInterface $user,
protected string|array $arguments
) {}
@@ -29,7 +31,8 @@ class BasicMethod implements MethodInterface
throw new \RuntimeException("A password must be provided");
}
( new Authorize($this->user) )->authenticate([ $this->user->usernameField() => $userName ], $password);
$this->authorize->user = $this->user;
$this->authorize->authenticate([ $this->user->usernameField() => $userName ], $password);
return $this->user->loggedIn();
}