Download the PHP package middlewares/http-authentication without Composer
On this page you can find all versions of the php package middlewares/http-authentication. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/http-authentication
More information about middlewares/http-authentication
Files in middlewares/http-authentication
Package http-authentication
Short Description Middleware to implement Basic and Digest Http authentication
License MIT
Homepage https://github.com/middlewares/http-authentication
Informations about the package http-authentication
middlewares/http-authentication
Middleware to implement RFC 2617 Http Authentication. Contains the following components:
- BasicAuthentication
- DigestAuthentication
Requirements
- PHP >= 7.2
- A PSR-7 http library
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/http-authentication.
BasicAuthentication
The Basic access authentication is the simplest technique.
You have to provide an Array
or ArrayAccess
with the usernames and passwords of all available users. The keys are the usernames and the values the passwords.
Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface
as the second argument, that will be used to create the error responses (401
). If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.
realm
The realm value. By default is "Login".
attribute
The attribute name used to save the username of the user. If it's not defined, it wont be saved. Example:
verifyHash
This option verifies the password using password_verify
. Useful if you don't want to provide the passwords in plain text.
DigestAuthentication
The Digest access authentication is more secure than basic.
The constructor signature is the same than BasicAuthentication
:
realm
The realm value. By default is "Login".
attribute
The attribute name used to save the username of the user. If it's not defined, it wont be saved.
nonce
To configure the nonce value. If its not defined, it's generated with uniqid
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of http-authentication with dependencies
middlewares/utils Version ^3.0 || ^4.0
psr/http-server-middleware Version ^1.0