bogosoft / http-auth
A library for PSR-7 and PSR-15 compliant authentication middleware.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/bogosoft/http-auth
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: 2025-09-29 02:09:41 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 (
IPrincipalobject) from a PSR-7 compliant HTTP request. TheIPrincipalcontract is from thebogosoft/identitypackage. - Pass the derived security context to a
IPrincipalHandlerobject on a successful authentication attempt. - Immediately return an HTTP response with a
401 Unauthorizedstatus code on a failed authentication attempt. this is configurable.
Interfaces
| Name | Purpose |
|---|---|
IAuthenticator |
Derives a security context (IPrincipal) from an HTTP request. |
IPrincipalHandler |
Handles a derived security context and allows for HTTP request modification. |
Implementations
| Name | Interface | Details |
|---|---|---|
CompositeAuthenticator |
IAuthenticator |
Allows multiple IAuthenticator objects to behave as one. |
DelegatedAuthenticator |
IAuthenticator |
Turns a callable object in an IAuthenticator interface. |
AuthenticationMiddleware |
MiddlewareInterface |
An authenticating middleware component. |
AttributePrincipalHandler |
IPrincipalHandler |
Stores the derived IPrincipal object into a mutated HTTP request as an attribute. |
DelegatedPrincipalHandler |
IPrincipalHandler |
Turns a callable object into a IPrincipalHandler. |