AuthBucket\OAuth2\ResponseType\AbstractResponseTypeHandler::checkClientId PHP Method

checkClientId() protected method

Fetch cliend_id from GET.
protected checkClientId ( Request $request ) : string
$request Symfony\Component\HttpFoundation\Request Incoming request object
return string Supplied client_id from incoming request
    protected function checkClientId(Request $request)
    {
        // client_id is required and in valid format.
        $clientId = $request->query->get('client_id');
        $errors = $this->validator->validate($clientId, [new NotBlank(), new ClientId()]);
        if (count($errors) > 0) {
            throw new InvalidRequestException(['error_description' => 'The request includes an invalid parameter value.']);
        }
        // Compare client_id with database record.
        $clientManager = $this->modelManagerFactory->getModelManager('client');
        $result = $clientManager->readModelOneBy(['clientId' => $clientId]);
        if ($result === null) {
            throw new UnauthorizedClientException(['error_description' => 'The client is not authorized.']);
        }
        return $clientId;
    }