TD-322: [BACK]. [реализовать сервис для подписания документов в контейнере signer]
This commit is contained in:
parent
e42e611f29
commit
74f3a069f0
|
|
@ -10,5 +10,4 @@ class SignRequest implements RequestDtoInterface
|
|||
{
|
||||
public string $url;
|
||||
public int $batch;
|
||||
public string $apiKey;
|
||||
}
|
||||
|
|
@ -15,8 +15,6 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
|||
|
||||
class SignController extends AbstractController
|
||||
{
|
||||
private const string API_KEY = 'ldskfjhgsdkl;ftghwerot239845yjsdknbgedklhhg';
|
||||
|
||||
public function __construct(
|
||||
private readonly SignService $signService
|
||||
){
|
||||
|
|
@ -25,10 +23,6 @@ class SignController extends AbstractController
|
|||
#[Route(path: '/sign', name: 'app.sign', methods: ['POST'])]
|
||||
public function __invoke(Request $request, SignRequest $signRequest): Response
|
||||
{
|
||||
if ($signRequest->apiKey !== self::API_KEY) {
|
||||
throw new AccessDeniedException('доступ запрещен');
|
||||
}
|
||||
|
||||
$token = $request->server->get('HTTP_AUTHORIZATION');
|
||||
|
||||
return new JsonResponse($this->signService->signDocument($signRequest->url, $token, $signRequest->batch));
|
||||
|
|
|
|||
Loading…
Reference in New Issue