innmind/http-authentication
Composer 安装命令:
composer require innmind/http-authentication
包简介
HTTP authentication
关键字:
README 文档
README
Simple tool to authenticate a request.
Installation
composer require innmind/http-authentication
Usage
use Innmind\HttpAuthentication\ViaBasicAuthorization; use Innmind\Router\{ Router, Component, Collect, Handle, }; use Innmind\Http\{ ServerRequest, Response, }; use Innmind\Immutable\Attempt; function login(string $user, string $password): Attempt { // find the user } $router = Router::of( Component::of(ViaBasicAuthorization::of( static fn(string $user, string $password) => login($user, $password), )) ->map(Collect::of('user')) ->pipe(Handle::of( static fn(ServerRequest $request, mixed $user) => Attempt::result( Response::of( // build response ), ), )); ); $response = $router(/* an instance of Innmind\Http\ServerRequest */)->unwrap();
统计信息
- 总下载量: 2.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-11