From 17529ba71188a71a482336afc64cfebb129460f3 Mon Sep 17 00:00:00 2001 From: Oleg Baturin Date: Thu, 16 May 2024 20:39:25 +0700 Subject: [PATCH] Removed application layer logic from UserAuth::challenge() --- src/UserAuth.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/UserAuth.php b/src/UserAuth.php index f12eeb4..8643d17 100644 --- a/src/UserAuth.php +++ b/src/UserAuth.php @@ -4,12 +4,10 @@ namespace Yiisoft\User; -use Psr\Http\Message\ResponseFactoryInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Yiisoft\Auth\AuthenticationMethodInterface; use Yiisoft\Auth\IdentityInterface; -use Yiisoft\Http\Status; /** * Implementation of the authentication interface for the user. @@ -18,7 +16,7 @@ final class UserAuth implements AuthenticationMethodInterface { private string $authUrl = '/login'; - public function __construct(private CurrentUser $currentUser, private ResponseFactoryInterface $responseFactory) + public function __construct(private CurrentUser $currentUser) { } @@ -38,9 +36,7 @@ public function authenticate(ServerRequestInterface $request): ?IdentityInterfac */ public function challenge(ResponseInterface $response): ResponseInterface { - return $this->responseFactory - ->createResponse(Status::FOUND) - ->withHeader('Location', $this->authUrl); + return $response; } /**