-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
236 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
language: php | ||
|
||
php: | ||
- 5.6 | ||
- 7.0.7 | ||
|
||
before_script: | ||
- composer install | ||
|
||
# bacause used in composer | ||
script: | ||
- vendor/bin/phpunit | ||
- vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
|
||
## [1.5] - RELEASE_DATE_HERE | ||
|
||
### Added | ||
- Http public key pinning [(pull request)](https://github.com/SK-EID/smart-id-php-client/pull/18) | ||
|
||
### Fixed | ||
- Poller did not use specified network interface [#4](https://github.com/SK-EID/smart-id-php-client/issues/4) | ||
- Add exception message when user is not found [(commit)](https://github.com/SK-EID/smart-id-php-client/commit/053fe5f3b4bd715be305481e764d95aeddbe9d93) | ||
|
||
### Changed | ||
- php version 5.6 to 7.0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//QLZIaH7Qx9Rjq3gyznQuNsvwMQb7maC5L4SLu/z5qNU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//R8b8SIj92sylUdok0DqfxJJN0yW2O3epE0B+5vpo2eM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//l2uvq6ftLN4LZ+8Un+71J2vH1BT9wTbtrE5+Fj3Vc5g= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
|
||
namespace Sk\SmartId\Tests; | ||
|
||
use Sk\SmartId\Api\Data\AuthenticationHash; | ||
use Sk\SmartId\Api\Data\AuthenticationSessionRequest; | ||
use Sk\SmartId\Api\Data\DigestCalculator; | ||
use Sk\SmartId\Api\Data\HashType; | ||
use Sk\SmartId\Api\SmartIdRestConnector; | ||
use Sk\SmartId\Exception\SmartIdException; | ||
use Sk\SmartId\Tests\Api\DummyData; | ||
use Sk\SmartId\Util\Curl; | ||
|
||
class SslTest extends Setup | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function authenticate_demoEnv_success() | ||
{ | ||
$this->client->authentication() | ||
->createAuthentication() | ||
->withCertificateLevel(DummyData::CERTIFICATE_LEVEL) | ||
->withAuthenticationHash(new AuthenticationHash(DigestCalculator::calculateDigest( DummyData::SIGNABLE_TEXT, HashType::SHA512 ))) | ||
->withDocumentNumber(DummyData::VALID_DOCUMENT_NUMBER) | ||
->authenticate(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function authenticate_demoEnvUseDemoEnvPublicKeys_success() | ||
{ | ||
$this->client->useOnlyDemoPublicKey()->authentication() | ||
->createAuthentication() | ||
->withCertificateLevel(DummyData::CERTIFICATE_LEVEL) | ||
->withAuthenticationHash(new AuthenticationHash(DigestCalculator::calculateDigest( DummyData::SIGNABLE_TEXT, HashType::SHA512 ))) | ||
->withDocumentNumber(DummyData::VALID_DOCUMENT_NUMBER) | ||
->authenticate(); | ||
} | ||
|
||
|
||
/** | ||
* @test | ||
*/ | ||
public function authenticate_demoEnvUseLiveEnvPublicKeys_shouldThrowException() | ||
{ | ||
$this->expectException(SmartIdException::class); | ||
|
||
$this->client->useOnlyLivePublicKey()->authentication() | ||
->createAuthentication() | ||
->withCertificateLevel(DummyData::CERTIFICATE_LEVEL) | ||
->withAuthenticationHash(new AuthenticationHash(DigestCalculator::calculateDigest( DummyData::SIGNABLE_TEXT, HashType::SHA512 ))) | ||
->withDocumentNumber(DummyData::VALID_DOCUMENT_NUMBER) | ||
->authenticate(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function authenticate_demoEnvSetPublicKeysFromArray_success() | ||
{ | ||
$this->client->setPublicSslKeys("sha256//QLZIaH7Qx9Rjq3gyznQuNsvwMQb7maC5L4SLu/z5qNU=;sha256//R8b8SIj92sylUdok0DqfxJJN0yW2O3epE0B+5vpo2eM=")->authentication() | ||
->createAuthentication() | ||
->withCertificateLevel(DummyData::CERTIFICATE_LEVEL) | ||
->withAuthenticationHash(new AuthenticationHash(DigestCalculator::calculateDigest( DummyData::SIGNABLE_TEXT, HashType::SHA512 ))) | ||
->withDocumentNumber(DummyData::VALID_DOCUMENT_NUMBER) | ||
->authenticate(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function authenticate_demoEnvSetPublicKeysFromEmptyString_throwsException() | ||
{ | ||
$this->expectException(SmartIdException::class); | ||
$this->client->setPublicSslKeys("")->authentication() | ||
->createAuthentication() | ||
->withCertificateLevel(DummyData::CERTIFICATE_LEVEL) | ||
->withAuthenticationHash(new AuthenticationHash(DigestCalculator::calculateDigest( DummyData::SIGNABLE_TEXT, HashType::SHA512 ))) | ||
->withDocumentNumber(DummyData::VALID_DOCUMENT_NUMBER) | ||
->authenticate(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function makeRequestToGoogle_demoPublicKeys_shouldThrowException() | ||
{ | ||
$this->expectException(SmartIdException::class); | ||
$this->client | ||
->setHostUrl("https://www.google.com") | ||
->useOnlyDemoPublicKey()->authentication() | ||
->createAuthentication() | ||
->withCertificateLevel(DummyData::CERTIFICATE_LEVEL) | ||
->withAuthenticationHash(new AuthenticationHash(DigestCalculator::calculateDigest( DummyData::SIGNABLE_TEXT, HashType::SHA512 ))) | ||
->withDocumentNumber(DummyData::VALID_DOCUMENT_NUMBER) | ||
->authenticate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//QLZIaH7Qx9Rjq3gyznQuNsvwMQb7maC5L4SLu/z5qNU= |
1 change: 1 addition & 0 deletions
1
tests/resources/ssl_public_keys/rp-api.smart-id.com.pem (1).cer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//R8b8SIj92sylUdok0DqfxJJN0yW2O3epE0B+5vpo2eM= |
1 change: 1 addition & 0 deletions
1
tests/resources/ssl_public_keys/rp-api_smart-id_com_2019.PEM.crt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//l2uvq6ftLN4LZ+8Un+71J2vH1BT9wTbtrE5+Fj3Vc5g= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256//fqp7yWK7iGGKj+3unYdm2DA3VCPDkwtyX+DrdZYSC6o= |