Files
myep-team/src/Security/OAuth2/AuthorizationDeniedException.php
T

35 lines
964 B
PHP

<?php
namespace App\Security\OAuth2;
use Symfony\Component\HttpFoundation\Request;
/**
* MyE&P redirected back with an `error` instead of a code — the person cancelled, or the
* authorization was refused.
*
* A subclass of AuthorizationRequestException so that a caller which does not care why the
* callback carried no code still catches it, and one that does can tell this apart from a
* malformed or replayed callback and say so.
*/
class AuthorizationDeniedException extends AuthorizationRequestException
{
public function __construct(
private readonly string $error,
private readonly ?string $errorDescription,
Request $request,
) {
parent::__construct(sprintf('Authorization denied: %s', $error), 400, $request);
}
public function getError(): string
{
return $this->error;
}
public function getErrorDescription(): ?string
{
return $this->errorDescription;
}
}