bleicker/authentication

该包最新版本(2.2.0)的许可证信息不可用。

2.2.0 2015-05-11 20:37 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:19:54 UTC


README

TokenManager

AuthenticationManager需要TokenManager。只需注册自己的或使用默认的TokenManager

ObjectManager::register(TokenManagerInterface::class, new TokenManager());

AuthenticationManager

创建AuthenticationManager实例

$authenticationManager = new AuthenticationManager();

注册原型令牌

身份验证状态存在于整个运行时期间。

$authenticationManager->getTokenManager()->registerPrototypeToken(MyPrototypeToken::class, new MyPrototypeToken());

注册会话令牌

身份验证状态将存在于整个运行时期间。

$authenticationManager->getTokenManager()->registerSessionToken(MySessioinToken::class, new MySessioinToken());

获取Token的身份验证状态

$authenticationManager->getTokenManager()->getToken(MyPrototypeToken::class)->status();

运行身份验证

运行身份验证。在这种情况下,任何已注册的Token都会尝试进行身份验证。

$authenticationManager->run();