laborci/mik-auth

该包已被 弃用,不再维护。未建议替代包。
关于此包的最新版本(dev-master)没有可用的许可信息。

dev-master 2018-11-16 09:10 UTC

This package is auto-updated.

Last update: 2020-08-19 16:39:39 UTC


README

Phlex 模块,用于处理 MIK-AUTH

将配置文件复制到您的配置文件夹中,填写它,并在 index.php 中添加引用

putenv('PXCONFIG=config.php,config.auth.php');

别忘了将 MikAuth 添加到服务管理器中

ServiceManager::bind('AuthRedirectClass')->value(\MikAuth\Action\AuthRedirect::class);
ServiceManager::bind(MikAuthServiceInterface::class)->sharedService(MikAuthService::class);
ServiceManager::bind(MikUserApiServiceInterface::class)->sharedService(MikUserApiService::class);
ServiceManager::bind(MikUserContainerInterface::class)->sharedService(MikUserContainer::class);

最后,将认证添加到您的路由器中

$router->get('/auth/login', AuthRedirect::class, ['method' => 'login']);
$router->get('/auth/success/{token}', AuthRedirect::class, ['method' => 'success']);
$router->addMiddleware(AuthCheck::class);
$router->get('/auth/logout', AuthRedirect::class, ['method' => 'logout']);
$router->get('/', Page\Index::class);