Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed application layer logic from UserAuth::challenge() #102

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/UserAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
{
}

Expand All @@ -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;
}

/**
Expand Down
Loading