Skip to content

Freja eID API PHP integration package. Original development by DSorlov/phpFreja.

License

Notifications You must be signed in to change notification settings

feeria/php-frejaeid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpFreja

Simple PHP wrapper to get information from 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.
  • Supports specific data fetching within array Available data
  • Well behaved functions that do not throw (atleast not by design) but always return objects for simpler handling.

To setup your test enviroment and then basic agreement read this information on Freja eID website.

Installation

To run installation type following in your project command line: composer require feeria/php-frejaeid

Quickstart

use Feeria\PhpFrejaeid\PhpFrejaeid;

// Create FrejaeID API Instance
$frejaApi = new PhpFrejaeid(
  'path_to_your_pfx_certificate.pfx',
  'your_password',
  false, // production mode
);

// Initialize the authorization
$authResponse = $frejaApi->initAuthentication(
  'EMAIL',
  'FREJAEID_USER_EMAIL',
  'BASIC',  // auth level, can be BASIC, EXTENDED, PLUS
  [
    'EMAIL_ADDRESS',
    // and any another from official docs
  ]
);

// Return user data
if ($authResponse->success)
    $authStatus = $frejaApi->checkAuthentication($authResponse->authRef);

    return $authStatus; // all user data from FrejaeID

Create URL for QR-Code

$qrInfo = $frejaAPI->createAuthQRCode();

if ($qrInfo->success)
    $imageUrl = $qrInfo->url;

Init, monitor and cancel authentication request

$authResponse = $frejaAPI->initAuthentication('EMAIL','youremail@yourserver.com');

if ($authResponse->success)
    $authStatus = $frejaAPI->checkAuthRequest($authResponse->authRef);

$frejaAPI->cancelAuthentication($authResponse->authRef);

Init, monitor and cancel signature request

$signResponse = $frejaAPI->initSignatureRequest('EMAIL','youremail@yourserver.com','Testsign','This is the agreement text');

if ($signResponse->success)
    $signStatus = $frejaAPI->checkSignatureRequest($signResponse->signRef);

$frejaAPI->cancelSignatureRequest($authResponse->signRef);

About

Freja eID API PHP integration package. Original development by DSorlov/phpFreja.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages