2017 © Pedro Peláez
 

library laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

image

lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  • Monday, January 22, 2018
  • by MarceauKa
  • Repository
  • 6 Watchers
  • 109 Stars
  • 754 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 2 Open issues
  • 7 Versions
  • 16 % Grown

The README.md

Laravel Auth Checker

Build Status Scrutinizer Code Quality, (*1)

Laravel Auth Checker is a plugin to collect login info and devices used when a user authenticates. It makes it easy to catch user authentication attempts and lockouts from new IP address or new devices., (*2)

Example logins table, (*3)

Requirements

Version Release
11 3.0
9, 10 2.0
8, 9 1.7
6, 7 1.6

Installation

  • Require the package: composer require lab404/laravel-auth-checker
  • Publish migration files: php artisan vendor:publish --tag=auth-checker
  • Migrate your database: php artisan migrate
  • Configure your Authenticatable model (see below)

Usage

This library collects login data and devices data about your users., (*4)

Authenticatable model

Your Authenticatable model (usually User) must implement the HasLoginsAndDevicesInterface interface., (*5)

The trait HasLoginsAndDevices is provided with for a working default implementation., (*6)

use Lab404\AuthChecker\Models\HasLoginsAndDevices;
use Lab404\AuthChecker\Interfaces\HasLoginsAndDevicesInterface;

class User extends Authenticatable implements HasLoginsAndDevicesInterface
{
    // ...
    use HasLoginsAndDevices;  
}

Once configured, you can access the following methods, (*7)

  • logins() returns all logins
  • auths() returns all successful login attemps
  • fails() returns all failed login attempts
  • lockouts() returns all lockouts

Each login returned is associated with the Device model used, (*8)

  • devices() returns all devices used by the user to authenticate.

Logins

Calling $user->logins outputs:, (*9)

[
    [
        'ip_address' => '1.2.3.4',
        'device_id' => 1, // ID of the used device
        'type' => 'auth',
        'device' => [
            // See Devices
        ],
        'created_at' => '2017-03-25 11:42:00',
    ],
    // ...
]

Also, you can directly access logins by their type, (*10)

  • $user->auths, returns successful logins (via Login::TYPE_LOGIN)
  • $user->fails, returns failed logins (via Login::TYPE_FAILED)
  • $user->lockouts, returns locked out logins (via Login::TYPE_LOCKOUT)

Devices

Calling $user->devices outputs:, (*11)

[
    [
        'platform' => 'OS X',
        'platform_version' => '10_12_2',
        'browser' => 'Chrome',
        'browser_version' => '54',
        'is_desktop' => true,
        'is_mobile' => false,
        'language' => 'fr-fr',
        'login' => [
          // See logins
        ],
    ],
    // ...
]

Events

There are many events available that can be used to add features to your app, (*12)

  • LoginCreated is fired when a user authenticates.
  • DeviceCreated is fired when a new device is created for a user.
  • FailedAuth is fired when a user fails to log in.
  • LockoutAuth is fired when authentication is locked for a user (too many attempts).

Each event passes a Login model and a Device model to your listeners., (*13)

Tests

vendor/bin/phpunit

Contributors

Licence

MIT, (*14)

The Versions

22/01 2018

dev-master

9999999-dev

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

plugin laravel authentication user ip check package device laravel-package laravel-plugin

22/01 2018

1.1.2

1.1.2.0

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

plugin laravel authentication user ip check package device laravel-package laravel-plugin

03/09 2017

1.1.1

1.1.1.0

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

plugin laravel authentication user ip check package device laravel-package laravel-plugin

13/04 2017

1.1.0

1.1.0.0

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

plugin laravel authentication user ip check package device laravel-package laravel-plugin

06/04 2017

1.0.2

1.0.2.0

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

laravel authentication user ip check device laravel-plugin

28/03 2017

1.0.1

1.0.1.0

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

laravel authentication user ip check device laravel-plugin

28/03 2017

1.0.0

1.0.0.0

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by 404lab

laravel authentication user ip check device laravel-plugin