bogosoft / http-auth
A library for PSR-7 and PSR-15 compliant authentication middleware.
1.0.0
2020-11-29 17:20 UTC
Requires
- php: >=7.4
- bogosoft/identity: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^1.7
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-12-29 06:46:22 UTC
README
A PHP library for PSR-7 and PSR-15 compliant authentication middleware.
Requirements
- PHP >= 7.4
Package Dependencies
Installation
composer require bogosoft/http-auth
Summary
This small library contains a PSR-15 compliant authentication middleware component, AuthenticationMiddleware
,
with the following responsibilities:
- Derive a security context (
IPrincipal
object) from a PSR-7 compliant HTTP request. TheIPrincipal
contract is from thebogosoft/identity
package. - Pass the derived security context to a
IPrincipalHandler
object on a successful authentication attempt. - Immediately return an HTTP response with a
401 Unauthorized
status code on a failed authentication attempt. this is configurable.