redcatphp/identify
最新稳定版本:v1.6.0
Composer 安装命令:
composer require redcatphp/identify
包简介
Identify - Complete Authentication System, Session Management and Cryptographic libraries
README 文档
README
No longer actively maintained.
Identify
Identify is a complete authentication system with session management and cryptographic libraries. It including many third-party library.
Session
The surikat session handler is independent from native php session and use a strong random id cookie which is regenerated when $cookieLifetime expire. Unlike native php session it allow you to use a session over any length you want, like one year for example, and it integrate an anti-bruteforce system with attempts records based on hashed ip.
$name = 'redcat'; $cookieLifetime = 3600; // 1 hour $sessionLifetime = 43200; // 1 year $session = new \\RedCat\\Identify\\Session($name,$cookieLifetime,$sessionLifetime); if(isset($session['var'])) var\_dump( $session['var'] ); $session['var'] = 'value';
Auth
Here is the main authentication API which you can use with Auth class.
login
$auth->login($login, $password, $lifetime=0);
loginRoot
$auth->loginRoot($password,$lifetime=0);
loginPersona
$auth->loginPersona($email,$lifetime=0);
register
$auth->register($email, $login, $password, $repeatpassword, $name=null);
activate
$auth->activate($key);
requestReset
$auth->requestReset($email);
logout
$auth->logout();
getHash
$auth->getHash($string, $salt);
getUID
$auth->getUID($login);
getUser
$auth->getUser($uid);
deleteUser
$auth->deleteUser($uid, $password);
validateLogin
$auth->validateLogin($login);
validateDisplayname
$auth->validateDisplayname($login);
resetPass
$auth->resetPass($key, $password, $repeatpassword);
resendActivation
$auth->resendActivation($email);
changePassword
$auth->changePassword($uid, $currpass, $newpass, $repeatnewpass);
getEmail
$auth->getEmail($uid);
changeEmail
$auth->changeEmail($uid, $email, $password);
getRight
$auth->getRight();
setRight
$auth->setRight($r);
connected
$auth->connected();
allowed
$auth->allowed($d);
allow
$auth->allow($d);
deny
$auth->deny($d);
lock
$auth->lock($r,$redirect=true);
AuthServer
First parameter correspond to RedCat\Identify\Auth rights constants. You can use them directly, or if you use string (like in example) it will be automaticaly converted to corresponding constant. The rights constants are Auth::RIGHT_MANAGE, Auth::RIGHT_EDIT, Auth::RIGHT_MODERATE, Auth::RIGHT_POST.
The second parameter (true by default) is for enable GET redirection to avoid re-POST on refresh.
$authServer = new \\RedCat\\Identify\\AuthServer; $authServer->htmlLock('RIGHT\_MANAGE',true);
Following example is for use inside a code (off course with ob-implicit-flush setted to false). It will handle authentication process, from locking with authentication window to logout button ouput. Put the code where you want button to appear.
$authServer->lougoutBTN();
For handle signup and login process:
$authServer->action();
For get identity:
$session = $authServer->getSession(); $identity = $session['\_AUTH\_'];
For handle reset password request:
$authServer->resetreq();
For handle reset password confirmation:
$authServer->resetpass();
For logout:
$authServer->getAuth()->logout()
And, in any context, to get result message:
echo $authServer->getResultMessage(true);
PHPMailer
PHPMailer - A full-featured email creation and transfer class for PHP.
PHPMailer is a third party toolbox. See the official PHPMailer and examples. There is simple facade class in RedCat\Identify namespace for use PHPMailer in simplicity:
$mailer = new RedCat\\Identify\\PHPMailer( $fromEmail,$fromName, $replyEmail,$replyName, $host,$port,$username,$passowrd,$secure, $sendmail, $debug,$exceptions ); $mailer->mail($email, $subject, $message, $html=true);
RandomLib
RandomLib - A library for generating random numbers and strings.
RandomLib is a third party toolbox. See the official RandomLib
SecurityLib
SecurityLib is a third party toolbox (dependency of RandomLib). See the official SecurityLib
PhpSecLib
PhpSecLib - PHP Secure Communications Library.
PhpSecLib is a third party cryptography toolbox. See the official PhpSecLib
redcatphp/identify 适用场景与选型建议
redcatphp/identify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 800 次下载、GitHub Stars 达 4, 最近一次更新时间为 2015 年 11 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「Authentication」 「cryptography」 「session」 「cookie」 「identify」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 redcatphp/identify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 redcatphp/identify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 redcatphp/identify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DUKPT implementation in PHP
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.
Provide a way to secure accesses to all routes of an symfony application.
Laravel middleware to restrict a site or specific routes using HTTP basic authentication
A library for reading KeePass 2.x databases
统计信息
- 总下载量: 800
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-11-04