承接 redcatphp/identify 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

统计信息

  • 总下载量: 800
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-11-04