rs/auth-medikey

Authentication for medikey service

v1.3.0 2024-04-29 16:46 UTC

This package is auto-updated.

Last update: 2024-04-29 16:48:17 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

Medikey is the innovative service that allows the certification and the recognition of the Italian physicians: a single initial process of registration allows the physician to obtain two univocal access keys (username and password) through which one can automatically access all the reserved websites that have adhered to Medikey, avoiding new, long and repetitive registrations for each website.

Installation

You can install the package via composer:

composer require rs/auth-medikey

Usage

Before using auth-medikey, you will need to add the site id for your implementation of Medikey. These credentials should be placed in your application's config/services.php configuration file, and should use the key medikey.

'medikey' => [
    'site_id' => env('MEDIKEY_SITE_ID','5')
]

Authentication

To authenticate users using the Medikey provider, you will need two routes: one for redirecting the user to the provider, and another for receiving the callback from the provider after authentication. The example controller below demonstrates the implementation of both routes:

use RedSnapper\Medikey\MedikeyProvider;

Route::get('/auth/redirect', function (MedikeyProvider $provider) {
    return $provider->redirect();
});

Route::get('/auth/callback', function (MedikeyProvider $provider) {
    $user = $provider->user();
});

The redirect method provided takes care of redirecting the user to the provider, while the user method will read the incoming request and retrieve the user's information from the provider after they are authenticated.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email param@redsnapper.net instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.