germania-kg / authentication
1.2.0
2023-01-09 14:13 UTC
Requires
- php: ^7.4|^8.0
- aura/session: ^2.1
- psr/http-message: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^1.0
Requires (Dev)
- monolog/monolog: ^1.16
- php-coveralls/php-coveralls: ^2.0
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^8.0|^9.0
This package is auto-updated.
Last update: 2024-11-09 18:11:46 UTC
README
This package was destilled from legacy code!
You better do not want it to use this in production.
Installation
$ composer require germania-kg/authentication
Overview
AuthUserInterface
namespace Germania\Authentication; // Setter and Getter for User ID. public function getId(); public function setId( $id );
AuthUserMiddleware
Constructor accepts:
- AuthUserInterface instance
- Aura\Session\SegmentInterface instance.
- User ID session field name
- Optional: PSR-3 Logger
Middleware does:
- Stores the user with a
user
attribute in the Psr\Http\Message\ServerRequestInterface request object. It will be available within the$next
middleware. - After running
$next
middleware, stores the User ID with the SegmentInterface instance, if theuser
attribute still is AuthUserInterface instance.
LoginController
TBD.
LogoutController
TBD.
Development
$ git clone git@github.com:GermaniaKG/Authentication.git germania-authentication
$ cd germania-authentication
$ composer install
Unit tests
Either copy phpunit.xml.dist
to phpunit.xml
and adapt to your needs, or leave as is.
Run PhpUnit like this:
$ vendor/bin/phpunit