Download the PHP package jpnut/extended-laravel-auth without Composer
On this page you can find all versions of the php package jpnut/extended-laravel-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jpnut/extended-laravel-auth
More information about jpnut/extended-laravel-auth
Files in jpnut/extended-laravel-auth
Package extended-laravel-auth
Short Description Extended Authentication implmentation for Laravel
License MIT
Homepage https://github.com/jpnut/extended-laravel-auth
Informations about the package extended-laravel-auth
Multiple "Remember Me" tokens per user
This package extends the default Laravel Authentication scaffolding to allow the creation of multiple "Remember Me" tokens per user.
With Laravel's default Auth, only one "Remember Me" token can be associated with a user at a time. This presents an issue for users of an application across multiple devices. For example, consider a user who has logged in using the "Remember Me" funcionality on two devices (e.g. on desktop and on mobile). If this user were to log out on one device (e.g. mobile), then the "Remember Me" token will be regenerated, and the user will not be logged in automatically on the other device (desktop in this example). We solve this problem my allowing multiple "Remember Me" tokens to be stored per user.
This process also has the added advantage of enabling an application to invalidate specific "Remember Me" tokens. For example, if a user were to accidentally click "Remember Me" whilst on a public device, the default process only allows a user to invalidate the token across all devices. With this package, we can selectively revoke tokens.
Installation
You can install the package with composer:
You can publish the migration with:
One should note that the removal of the "remember_token" field in the users table is not currently handled by this package. Any existing tokens will not transferred automatically. After the migration has been published you can create the token table by running the migrations:
You can publish the config file with:
Usage
Since the default auth implementation of "Remember Me" tokens is baked into the "Illuminate\Contracts\Auth\Authenticatable"
contract, this package overwrites this, and provides an alternative to the "Illuminate\Foundation\Auth\User"
provided by Laravel.
You must ensure that your User
model(s) implement "JPNut\ExtendedAuth\Contracts\Authenticatable"
. The easiest way to accomplish this is to extend "JPNut\ExtendedAuth\User"
:
To enable the guard, you will need to modify config/auth.php
as follows:
You should also make sure that the guard is defined on the routes where you wish to make use of this guard. For most cases this involves changing the default guard to extended-web
. Note that extended-session
and extended-eloquent
can be modified in the config/extended-auth
file.
Certain other areas of the default Laravel framework also rely upon features which have been changed in this package:
- You should comment out
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class
inconfig/app.php
- During testing, you should override
Illuminate\Foundation\Testing\TestCase
withJPNut\ExtendedAuth\Testing\TestCase
- For password resets, you should replace
Illuminate\Foundation\Auth\ResetsPasswords
withJPNut\ExtendedAuth\ResetsPasswords
Extending
You need to make sure:
- Any
User
model(s) implementJPNut\ExtendedAuth\Contracts\Authenticatable
- Your
Token
model implementsJPNut\ExtendedAuth\Contracts\Tokenable
Testing
License
MIT
All versions of extended-laravel-auth with dependencies
illuminate/auth Version ~5.5.0|~5.6.0
illuminate/contracts Version ~5.5.0|~5.6.0
illuminate/database Version ~5.5.0|~5.6.0
illuminate/support Version ~5.5.0|~5.6.0
laravel/framework Version ~5.5.0|~5.6.0
symfony/http-foundation Version ~4.0