Coder Social home page Coder Social logo

puzi-php's Introduction

pUZI logo

pUZI php

PHP

Proficient UZI pass reader in php.

The UZI card is part of an authentication mechanism for medical staff and doctors working in the Netherlands. The cards are distributed by the CIBG. More information and the relevant client software can be found at www.uziregister.nl (in Dutch).

pUZI is a simple and functional module which allows you to use the UZI cards as authentication mechanism. It consists of:

  1. a reader that interprets the PKCS11 data the card middleware provides to the webserver and returns an UziUser object in return (this repository).
  2. middleware (currently only for the Laravel framework) that allows authentication and user creation based on UZI cards.

For documentation, software and to apply for an UZI card, please check out www.uziregister.nl.

pUZI is available under the EU PL licence. It was created early 2021 during the COVID19 campaign as part of the vaccination registration project BRBA for the ‘Ministerie van Volksgezondheid, Welzijn & Sport, programma Realisatie Digitale Ondersteuning.’

Questions and contributions are welcome via GitHub.

Requirements

  • PHP >= 7.3

Apache config (or NginX equivalent):

SSLEngine on
SSLProtocol -all +TLSv1.3
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
SSLVerifyClient require
SSLVerifyDepth 3
SSLCACertificateFile /path/to/uziCA.crt
SSLOptions +StdEnvVars +ExportCertData

Installation

Composer

composer require minvws/puzi-php

Manual

Add the following to your composer.json and then run composer install.

{
    "require": {
        "minvws/puzi-php": "^0.2"
    }
}

Usage

// Request from your framework/controller
$uzi = new \MinVWS\PUZI\UziReader();
$user = $uzi->getDataFromRequest($request);
print $user->getUziNumber();

// In case of no request (deprecated):
$uzi = new \MinVWS\PUZI\UziReader();
$user = $uzi->getData();

print $user->getUziNumber();
var_dump($user->toArray());
array(9) {
  'givenName' =>
  string(4) "john"
  'surName' =>
  string(12) "doe-11111111"
  'OidCa' =>
  string(25) "2.16.528.1.1003.1.3.5.5.2"
  'UziVersion' =>
  string(1) "1"
  'UziNumber' =>
  string(8) "11111111"
  'CardType' =>
  string(1) "N"
  'SubscriberNumber' =>
  string(8) "90000111"
  'Role' =>
  string(6) "01.015"
  'AgbCode' =>
  string(8) "00000000"
}

This package also allows validation of the returned user:

$allowedTypes = [
    UziConstants::UZI_TYPE_CARE_PROVIDER,
    UziConstants::UZI_TYPE_NAMED_EMPLOYEE,
];
$allowedRoles = [
    UziConstants::UZI_ROLE_DOCTOR,    
    UziConstants::UZI_ROLE_PHARMACIST,    
];

$validator = new UziValidator(true, $allowedTypes, $allowedRoles);
if ($validator->isValid($user)) {
    print "Validated as doctor or pharmasist";
}

You can use either isValid(), which returns a boolean, or validate() which throws an exception when not correctly validated.

Uses

Used by

Alternatives

Contributing

  1. Fork the Project

  2. Ensure you have Composer installed (see Composer Download Instructions)

  3. Install Development Dependencies

    composer install
  4. Create a Feature Branch

  5. (Recommended) Run the Test Suite

    vendor/bin/phpunit
  6. (Recommended) Check whether your code conforms to our Coding Standards by running

    vendor/bin/phpstan analyse
    vendor/bin/psalm
    vendor/bin/phpcs
  7. Send us a Pull Request

pUZI

puzi-php's People

Contributors

okoeroo avatar annejan avatar jaytaph avatar underdarknl avatar

Stargazers

Michiel Klaver avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.