Download the PHP package ingria/laravel-x509-auth without Composer
On this page you can find all versions of the php package ingria/laravel-x509-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ingria/laravel-x509-auth
More information about ingria/laravel-x509-auth
Files in ingria/laravel-x509-auth
Package laravel-x509-auth
Short Description Laravel 5 Client Certificate auth middleware
License MIT
Informations about the package laravel-x509-auth
Client certificate authentication middleware for Laravel 5
Also known as X.509 client authentication.
How does it work
- You have a user in your app. For example,
Admin:[email protected]
- You generate a certificate for that user. Make sure you're using
[email protected]
for certificate'semailAddress
field. - This package allows
Admin
to use your app without ever logging in. - All users including
Admin
can still use plain password auth.
Pro tip: you can also use any other certificate attributes for authentication, not only
emailAddress
(likeid
orusername
). I don't think you need this package in that case, but anyway 🤷.
Prerequisites
Please don't blindly copy-paste the commands. It's important for you to know what you're doing.
1. Generate CA and Client certificate
Generating Certificate Authority:
Generating client certificate and signing it with your CA. When asked for the email, enter email of your app's user which will be autheticated with this certificate.
Optionally, generate a PKCS certificate to be installed into the browser, mobile or whatever:
2. Configure your web-server
This example is for NGINX with FastCGI.
You can also add pass some other useful params, see resources below.
Resources
Installation
1. Install the package
This assumes that you have composer installed globally:
2. Register middleware
Add \Ingria\LaravelX509Auth\Middleware\AuthenticateWithClientCertificate::class
to your routeMiddleware
array in app/Http/Kernel.php
.
For example, you can call it auth.x509
, by analogy with Laravel's auth.basic
name:
Resources
Usage
Just add the middleware's name to any route or controller instead of default auth
. For example:
Resources
License
The MIT License (MIT). Please see License File for more information.