-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* SDK-2241 Create Session * SDK-2244 Retrieve Session * SDK-2250 Create QR Code * SDK-2258 Retrieve QR Code * SDK-2265 Retrieve Receipt * SDK-2377 added failure reasons to idv * SDK-2357 added failure receipt error details * Sdk 2420 php add support for advanced identity profiles to share v 2 and examples (#360) * SDK-2371 added advanced identity profile to sharev1,example and updated tests * Added-example-for-DBS-and-updated-failure-details * Updated IDV Example Defaults * Removed unneccessary used libraries
- Loading branch information
1 parent
c9a2b35
commit f752956
Showing
187 changed files
with
9,868 additions
and
112 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 |
---|---|---|
|
@@ -17,3 +17,4 @@ coverage | |
.scannerwork | ||
|
||
.DS_Store | ||
.php-cs-fixer.cache |
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,14 @@ | ||
# This file is a template for defining the environment variables | ||
# Set the application config values here | ||
|
||
YOTI_SDK_ID=xxxxxxxxxxxxxxxxxxxxx | ||
|
||
# Below is the private key (in .pem format) associated with the Yoti Application you created on Yoti Hub | ||
YOTI_KEY_FILE_PATH=./keys/php-sdk-access-security.pem | ||
|
||
# Laravel config: | ||
APP_NAME=yoti.sdk.digitalidentity.demo | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost |
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,16 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
*.pem | ||
keys/*.pem | ||
sdk |
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,24 @@ | ||
# Digital Identity Example | ||
|
||
## Requirements | ||
|
||
This example requires [Docker](https://docs.docker.com/) | ||
|
||
## Setup | ||
|
||
* Create your application in the [Yoti Hub](https://hub.yoti.com) (this requires having a Yoti account) | ||
* Set the application domain of your app to `localhost:4002` | ||
* Do the steps below inside the [examples/digitalidentity](./) folder | ||
* Put `your-application-pem-file.pem` file inside the [keys](keys) folder, as Docker requires the `.pem` file to reside within the same location where it's run from. | ||
* Copy `.env.example` to `.env` | ||
* Open `.env` file and fill in the environment variable `YOTI_SDK_ID` | ||
* Set `YOTI_KEY_FILE_PATH` to `./keys/your-application-pem-file.pem` | ||
* Install dependencies `docker-compose up composer` | ||
* Run the `docker-compose up --build` command | ||
* Visit [https://localhost:4002](https://localhost:4002) | ||
* Run the `docker-compose stop` command to stop the containers. | ||
|
||
> To see how to retrieve activity details using the one time use token, refer to the [digitalidentity controller](app/Http/Controllers/IdentityController.php) | ||
## Digital Identity Example | ||
* Visit [/generate-share](https://localhost:4002/generate-share) |
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,41 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire')->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* @param \Throwable $exception | ||
* @return void | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function report(Throwable $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Throwable $exception | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws \Throwable | ||
*/ | ||
public function render($request, Throwable $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
examples/digitalidentity/app/Http/Controllers/AdvancedIdentityController.php
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,71 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Log; | ||
use mysql_xdevapi\Exception; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Yoti\DigitalIdentityClient; | ||
use Yoti\Identity\Policy\PolicyBuilder; | ||
use Yoti\Identity\ShareSessionRequestBuilder; | ||
use Yoti\YotiClient; | ||
|
||
class AdvancedIdentityController extends BaseController | ||
{ | ||
public function generateSession(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
$advancedIdentityProfileJson = | ||
(object)[ | ||
"profiles" => [(object)[ | ||
|
||
"trust_framework" => "YOTI_GLOBAL", | ||
"schemes" => [(object)[ | ||
|
||
"label" => "identity-AL-L1", | ||
"type" => "IDENTITY", | ||
"objective"=> "AL_L1" | ||
], | ||
[ | ||
"label" => "identity-AL-M1", | ||
"type" => "IDENTITY", | ||
"objective" => "AL_M1" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
; | ||
|
||
$policy = (new PolicyBuilder()) | ||
->withAdvancedIdentityProfileRequirements((object)$advancedIdentityProfileJson) | ||
->build(); | ||
|
||
$redirectUri = 'https://host/redirect/'; | ||
|
||
$shareSessionRequest = (new ShareSessionRequestBuilder()) | ||
->withPolicy($policy) | ||
->withRedirectUri($redirectUri) | ||
->build(); | ||
$session = $client->createShareSession($shareSessionRequest); | ||
return $session->getId(); | ||
} | ||
catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
public function show(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
return view('advancedidentity', [ | ||
'title' => 'Digital Identity(Advanced) Complete Example', | ||
'sdkId' => $client->id | ||
]); | ||
} catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
examples/digitalidentity/app/Http/Controllers/DbsController.php
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,53 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Log; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Yoti\DigitalIdentityClient; | ||
use Yoti\Identity\Policy\PolicyBuilder; | ||
use Yoti\Identity\ShareSessionRequestBuilder; | ||
|
||
class DbsController extends BaseController | ||
{ | ||
public function generateSession(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
$policy = (new PolicyBuilder()) | ||
->withIdentityProfileRequirements((object)[ | ||
'trust_framework' => 'UK_TFIDA', | ||
'scheme' => [ | ||
'type' => 'DBS', | ||
'objective' => 'BASIC' | ||
] | ||
]) | ||
->build(); | ||
|
||
$redirectUri = 'https://host/redirect/'; | ||
|
||
$shareSessionRequest = (new ShareSessionRequestBuilder()) | ||
->withPolicy($policy) | ||
->withRedirectUri($redirectUri) | ||
->build(); | ||
$session = $client->createShareSession($shareSessionRequest); | ||
return $session->getId(); | ||
} | ||
catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
public function show(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
return view('dbs', [ | ||
'title' => 'Digital Identity DBS Check Example', | ||
'sdkId' => $client->id | ||
]); | ||
} catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
examples/digitalidentity/app/Http/Controllers/IdentityController.php
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,60 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Log; | ||
use mysql_xdevapi\Exception; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Yoti\DigitalIdentityClient; | ||
use Yoti\Identity\Policy\PolicyBuilder; | ||
use Yoti\Identity\ShareSessionRequestBuilder; | ||
use Yoti\YotiClient; | ||
|
||
class IdentityController extends BaseController | ||
{ | ||
public function generateSession(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
|
||
$policy = (new PolicyBuilder()) | ||
->withFamilyName() | ||
->withGivenNames() | ||
->withFullName() | ||
->withDateOfBirth() | ||
->withGender() | ||
->withNationality() | ||
->withPhoneNumber() | ||
->withSelfie() | ||
->withEmail() | ||
->withDocumentDetails() | ||
->withDocumentImages() | ||
->build(); | ||
|
||
$redirectUri = 'https://host/redirect/'; | ||
|
||
$shareSessionRequest = (new ShareSessionRequestBuilder()) | ||
->withPolicy($policy) | ||
->withRedirectUri($redirectUri) | ||
->build(); | ||
$session = $client->createShareSession($shareSessionRequest); | ||
return $session->getId(); | ||
} | ||
catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
public function show(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
return view('identity', [ | ||
'title' => 'Digital Identity Complete Example', | ||
'sdkId' => $client->id | ||
]); | ||
} catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
} |
Oops, something went wrong.