Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed oid ca check #27

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/Exceptions/UziCaException.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/UziValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use MinVWS\PUZI\Exceptions\UziAllowedRoleException;
use MinVWS\PUZI\Exceptions\UziAllowedTypeException;
use MinVWS\PUZI\Exceptions\UziCaException;
use MinVWS\PUZI\Exceptions\UziCardExpired;
use MinVWS\PUZI\Exceptions\UziCertificateException;
use MinVWS\PUZI\Exceptions\UziException;
Expand Down Expand Up @@ -81,14 +80,6 @@ public function validate(Request $request): void
throw new UziCertificateException('No UZI data found in certificate');
}

if (
$this->strictCAcheck === true &&
$uziInfo->getOidCa() !== UziConstants::OID_CA_CARE_PROVIDER &&
$uziInfo->getOidCa() !== UziConstants::OID_CA_NAMED_EMPLOYEE
) {
throw new UziCaException('CA OID not UZI register Care Provider or named employee');
}

if (! $x509->validateSignature(count($this->caCerts) > 0)) {
throw new UziCertificateException('Uzi certificate path not valid');
}
Expand Down
37 changes: 0 additions & 37 deletions tests/UziValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use MinVWS\PUZI\Exceptions\UziAllowedRoleException;
use MinVWS\PUZI\Exceptions\UziAllowedTypeException;
use MinVWS\PUZI\Exceptions\UziCaException;
use MinVWS\PUZI\Exceptions\UziCertificateException;
use MinVWS\PUZI\Exceptions\UziVersionException;
use MinVWS\PUZI\UziConstants;
Expand Down Expand Up @@ -60,42 +59,6 @@ public function testInvalidCert(): void
$validator->validate($request);
}

public function testValidateIncorectOIDca(): void
{
$user = new UziUser();
$user->setOidCa("1.2.3.4");

$this->expectException(UziCaException::class);
$this->expectExceptionMessage("CA OID not UZI register Care Provider or named employee");

$request = new Request();
$request->server->set('SSL_CLIENT_VERIFY', "SUCCESS");
$request->server->set('SSL_CLIENT_CERT', file_get_contents(__DIR__ . '/certs/mock-020-incorrect-oidca.cert'));

$reader = new UziReader();
$validator = new UziValidator($reader, true, [], []);
$validator->validate($request);
}

public function testValidateIncorectOIDcaWithoutStrictCheck(): void
{
$user = new UziUser();
$user->setOidCa("1.2.3.4");

$request = new Request();
$request->server->set('SSL_CLIENT_VERIFY', "SUCCESS");
$request->server->set('SSL_CLIENT_CERT', file_get_contents(__DIR__ . '/certs/mock-020-incorrect-oidca.cert'));

$reader = new UziReader();
$validator = new UziValidator(
$reader,
false,
[UziConstants::UZI_TYPE_NAMED_EMPLOYEE],
[UziConstants::UZI_ROLE_DOCTOR]
);
$this->assertTrue($validator->isValid($request));
}

public function testIncorrectVersion(): void
{
$request = new Request();
Expand Down