germania-kg/authentication

1.2.0 2023-01-09 14:13 UTC

This package is auto-updated.

Last update: 2024-09-09 17:48:09 UTC


README

此包是从旧代码中提炼出来的!
你最好不要在生产环境中使用它。 Tests

安装

$ composer require germania-kg/authentication

概览

AuthUserInterface

namespace Germania\Authentication;

// Setter and Getter for User ID.
public function getId();
public function setId( $id );

AuthUserMiddleware

构造函数接受

  • AuthUserInterface 实例
  • Aura\Session\SegmentInterface 实例。
  • 用户 ID 会话字段名称
  • 可选:PSR-3 Logger

中间件执行

  • 将用户存储在具有 user 属性的 Psr\Http\Message\ServerRequestInterface 请求对象中。它将在 $next 中间件中可用。
  • 在运行 $next 中间件后,如果 user 属性仍然是 AuthUserInterface 实例,则使用 SegmentInterface 实例存储用户 ID。

LoginController

待定。

LogoutController

待定。

开发

$ git clone git@github.com:GermaniaKG/Authentication.git germania-authentication
$ cd germania-authentication
$ composer install

单元测试

可以复制 phpunit.xml.distphpunit.xml 并根据需要修改,或者保持不变。像这样运行 PhpUnit

$ vendor/bin/phpunit