[PLUGIN][OAuth] Fix login for OAuth
This commit is contained in:
@@ -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)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user