Download the PHP package jhumanj/laravel-signed-auth-middleware without Composer
On this page you can find all versions of the php package jhumanj/laravel-signed-auth-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jhumanj/laravel-signed-auth-middleware
More information about jhumanj/laravel-signed-auth-middleware
Files in jhumanj/laravel-signed-auth-middleware
Package laravel-signed-auth-middleware
Short Description A Laravel package that can authenticate users using signed links
License MIT
Homepage https://github.com/jhumanj/laravel-signed-auth-middleware
Informations about the package laravel-signed-auth-middleware
Laravel Signed Auth Middleware
A simple, safe magic login link generator for Laravel
This packages allows you to generate links that will authenticate your users. You can use this for password-less applications, or simply to authenticate users from links your application sends (via email, text message etc.).
Why this package
I started to use laravel-passwordless-login package by grosv and it worked very well. Unfortunately, because of the redirection, I had some troubles with Google analytics and UTM tracking. I wanted to extend the package, but then realized that there wasn't a trivial solution, as utm tracking parameters should not be used in the context of intenal website navigation. Hence I created this package, which is very strongly inspired by laravel-passwordless-login.
Signed Auth Middleware package allows you to generate signed links that will automatically authenticate your users using
a middleware (without any redirect).
Unlike laravel-passwordless-login, this package does not support
the use-once
link feature.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
Setting up middleware
The first thing to do is to setup the middleware. The middleware needs to be registered before the auth middleware. You
can achieve that by adding the HasSignedAuth
trait to your App\Http\Kernel.php
file:
Then you have two options: use the middleware on all or your routes or not. To add the middleware to all your routes, add the middleware to the web middleware group.
Now if you don't want to use the middleware on all of your web routes you can also define a route middleware like this:
And then use it as follows in your route file:
Creating auth signed links
Here is how to generate a signed link that will authenticate your users:
You can also override the default expiry time:
Or you set it to never expire:
If you need to add some more parameters, just proceed as you would do it with the normal route()
method:
Testing
Please make sure that all package tests are running successfully before sending a pull request.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please contribute if you want to help me maintain this package or just make it better. Be nice to each other.
Reporting Issues
For security issues, please contact me directly on twitter or via email at [email protected]. For any other problems, use the issue tracker here.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-signed-auth-middleware with dependencies
spatie/laravel-package-tools Version ^1.1
illuminate/contracts Version ^8.0