[PLUGIN][OAuth] Fix login for OAuth

This commit is contained in:
2022-03-13 22:27:59 +00:00
parent 20f690c532
commit 27706d63f4
4 changed files with 9 additions and 10 deletions

View File

@@ -34,7 +34,7 @@ declare(strict_types = 1);
namespace Plugin\OAuth2\Controller;
use App\Core\Controller;
use App\Entity\LocalUser;
use App\Util\Common;
use App\Util\Exception\NotFoundException;
use League\OAuth2\Server\Entities\UserEntityInterface;
use League\OAuth2\Server\Exception\OAuthServerException;
@@ -56,7 +56,7 @@ class Authorize extends Controller
parent::__construct($stack);
}
public function __invoke(Request $request)
public function handle(Request $request)
{
// @var \League\OAuth2\Server\AuthorizationServer $server
$server = OAuth2::$authorization_server;
@@ -71,10 +71,11 @@ class Authorize extends Controller
$psrRequest = $psrHttpFactory->createRequest($request);
$authRequest = $server->validateAuthorizationRequest($psrRequest);
// TODO
$user = Common::ensureLoggedIn($request);
// Once the user has logged in set the user on the AuthorizationRequest
$authRequest->setUser(
new class(LocalUser::getByNickname('foo')->getId()) implements UserEntityInterface {
new class($user->getId()) implements UserEntityInterface {
public function __construct(private int $id)
{
}