项目作者: DSorlov

项目描述 :
Simple PHP wrapper to talk to Freja eID REST API
高级语言: PHP
项目地址: git://github.com/DSorlov/phpFreja.git
创建时间: 2019-10-14T11:05:43Z
项目社区:https://github.com/DSorlov/phpFreja

开源协议:Apache License 2.0

下载


phpFreja

Simple PHP wrapper to talk to Freja eID REST API for use both in test and production enviroment.

  • Supports validation of the JWS but requires external library for that part (thanks to php-jws).
  • Supports both directed and inferred authentication, for use with qr-code and app.
  • Supports authentication and signature api but not the assertion service.
  • Well behaved functions that do not throw (atleast not by design) but always return objects for simpler handling.
  • Not developed, supported or endorsed by Verisec.

To setup your test enviroment, and then basic agreement (free!!) read this information Freja eID

Example

Init connection to API (test)

  1. require_once('freja.php');
  2. $frejaAPI = new phpFreja('testCertificate.pfx','SuperSecretPassword',false);

Create URL for QR-Code

  1. $qrInfo = $frejaAPI->createAuthQRCode();
  2. if ($qrInfo->success)
  3. $imageUrl = $qrInfo->url;

Init, monitor and cancel authentication request

  1. $authResponse = $frejaAPI->initAuthentication('EMAIL','youremail@yourserver.com');
  2. if ($authResponse->success)
  3. $authStatus = $frejaAPI->checkAuthRequest($authResponse->authRef);
  4. $frejaAPI->cancelAuthentication($authResponse->authRef);

Init, monitor and cancel signature request

  1. $signResponse = $frejaAPI->initSignatureRequest('EMAIL','youremail@yourserver.com','Testsign','This is the agreement text');
  2. if ($signResponse->success)
  3. $signStatus = $frejaAPI->checkSignatureRequest($signResponse->signRef);
  4. $frejaAPI->cancelSignatureRequest($authResponse->signRef);