Skip to content

Min auth is a package that allows you to create and manage a client based authentication system on your Laravel web application.

License

Notifications You must be signed in to change notification settings

bencoderus/min-auth

Repository files navigation

Laravel webhook preview

Min Auth

Build Status Latest Stable Version License

Min Auth is a Laravel package that allows you to create and manage a client based authentication system on your Laravel web application.

Installation

This package requires PHP >= 7.2 and above. (Laravel 8 and PHP 8 support are available).

You can install the package via composer:

composer require bencoderus/min-auth

Publish migration and configurations.

php artisan min-auth:install

Run migrations

php artisan migrate

Usage

Min Auth commands

Publish migration and configurations.

php artisan min-auth:install

Create a client

php artisan min-auth:create-client {name}

Using the middleware to protect your routes.

In your route add auth.client

Route::get('test', function(){
    return "Hello world";
})->middleware('auth.client');

In your controller add auth.client

public function __construct(){
    $this->middleware('auth.client');
}

Using the helpers

Import Min Auth Helper

use Bencoderus\MinAuth\MinAuth;

Create a client

MinAuth::createClient($name);
// Optional
MinAuth::createClient($name, $ip, $isBlacklisted);

Find a client by API key

MinAuth::findByApiKey($apiKey);

Blacklist a client

MinAuth::blacklistClient($client);

Whitelist a client

MinAuth::whitelistClient($client);

Refresh Client API key

MinAuth::refreshApiKey($client);

Update client Ip address

$ip = "127.0.0.8";
MinAuth::updateIpAddress($client, $ip);

Configuration

You can turn off IP Address verification via config/min-auth.php

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 bencoderus@gmail.com instead of using the issue tracker.

Credits

License

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

About

Min auth is a package that allows you to create and manage a client based authentication system on your Laravel web application.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages