nowise/uup-auth
Composer 安装命令:
composer require nowise/uup-auth
包简介
Flexible authentication stack supporting multiple credential obtaining methods and account validation backends.
关键字:
README 文档
README
The uup-auth package provides a library for stacking authenticators together to support multiple authentication method in a uniform way.
Bundled are also restrictors for performing access restriction (i.e. on time of day or the ip-address/hostname). All authenticators in the stack can be set as required or sufficient to enforce logon policy (i.e. require CAS-logon from outside of LAN while supporting Kerberos logon from inside).
The library is modular. The authenticators are the frontend (credentials obtainers) that might use a validator as authentication source (for example LDAP). The authenticator can be combined with a storage object to support logon sessions.
Authenticators can be used in a stack or standalone (single login method). If configuring a stack, use one of the access classes for easy access to chains and authenticators.
+-- UUP/Authentication/
+-- Authenticator/ : Authenticator frontend classes.
+-- Restrictor/ : Restrictor classes.
+-- Stack/ : Support for stacking authenticators/restrictors.
+-- Storage/ : Persistance support.
+-- Validator/ : Authentication support.
Example
A typical authentication/authorization stack providing login thru PAM, CAS and LDAP with restriction on network and logon time might look like this:
class Authentication extends AuthenticatorStack { public function __construct() { $chain = array( // // Plugin account authenticator objects in stack: // 'auth' => array( 'pam' => (new SystemAuthentication()) ->visible(true) ->control(Authenticator::SUFFICIENT) ->name('System') ->description('Login using local system account.'), 'cas' => (new CasAuthenticator('cas.example.com')) ->visible(true) ->control(Authenticator::SUFFICIENT) ->name('CAS') ->description('CAS server login'), 'ldap' => (new LdapAuthenticator('ldaps://ldap.example.com')) ->visible(true) ->control(Authenticator::SUFFICIENT) ->name('LDAP') ->description('LDAP authentication') ), // // Add some login restrictions: // 'access' => array( 'addr' => (new AddressRestrictor(array('::1', '127.0.0.1', '192.168.0.0/16'))) ->visible(false) ->control(Authenticator::REQUIRED), 'time' => (new DateTimeRestrictor('08:45', '16:30')) ->visible(false) ->control(Authenticator::REQUIRED) ) ); parent::__construct($chain); } public function getName() { return $this->getAuthenticator()->name; } }
Somewhere (typical dispatcher or main template) add some code to handle login/logout request and render logon form:
try { $authenticator = new Authentication(); if (filter_has_var(INPUT_GET, 'login')) { $authenticator->activate(filter_input(INPUT_GET, 'login')); $authenticator->login(); } if (filter_has_var(INPUT_GET, 'logout')) { $authenticator->logout(); } if ($authenticator->accepted()) { printf("<p>Logged on to %s as %s | <a href=\"?logout\">Logout</a>\n", $authenticator->getName(), $authenticator->getSubject() ); } else { printf("<form action=\"\" method=\"GET\">\n"); printf("<select name=\"login\">\n"); foreach ($authenticator->authenticators(true) as $key => $obj) { printf("<option value=\"%s\" title=\"%s\">%s</option>\n", $key, $obj->description, $obj->name); } printf("</select>\n"); printf("<input type=\"submit\" value=\"Login\">\n"); printf("</form>\n"); } } catch (Exception $exception) { die(sprintf("Exception: %s", $exception)); }
See examples directory for fully functional code. Visit the project page for more information.
nowise/uup-auth 适用场景与选型建议
nowise/uup-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 48 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Authentication」 「auth」 「bmc」 「uup」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nowise/uup-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nowise/uup-auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nowise/uup-auth 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
GraphQL authentication for your headless Craft CMS applications.
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
Laravel middleware to restrict a site or specific routes using HTTP basic authentication
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2019-01-24