Cookie-based authentication is a Laravel middleware that provides cookie-based authentication functionality. It allows you to secure your application from any access.
You can install this package via Composer. Simply run the following command:
composer require zalkarz/cookie-based-authTo use the Cookie-based authentication middleware, follow these steps:
- Add the middleware to your route or route group in your Laravel application.
- Configure the required environment variables for authentication credentials.
- Customize the authentication logic if needed.
Here's an example of how to add the middleware to a route group:
protected $middlewareGroups = [
'web' => [
...
\Zalkarz\CookieBasedAuth\Http\Middleware\CookieBasedAuth::class
],
];Make sure to set these environment variables in your .env file or your server configuration. For example:
COOKIE_BASED_AUTH_USERNAME=johndoe
COOKIE_BASED_AUTH_PASSWORD=mypasswordContributions are welcome! If you find any issues or want to add new features, please submit a pull request.
This package is open-source software licensed under the MIT license.