token
This extension is create and validate token.
Copyright © 2009 by dongbeta All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of dongbeta nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Available Downloads
| File | Summary | Uploaded on | Downloaded |
|---|---|---|---|
| token_0.2.zip (1.8 KB) | rewrited, function 'validate ' changed. | May 17, 2010 | 48 |
| token_0.1.1.zip (5.0 KB) | add $secretKey instead of SECRET_KEY | March 6, 2010 | 65 |
| token_0.1.zip (1.8 KB) | token 0.1 | March 3, 2010 | 35 |
March 3, 2010
- Initial release.
March 6, 2010
- Add public $secretKey and delete SECRET_KEY
Requirements
- Yii 1.0 or above
Installation
- Extract the release file under
protected/components - Create table:
CREATE TABLE IF NOT EXISTS
token(idint(11) unsigned NOT NULL AUTO_INCREMENT,actionvarchar(100) DEFAULT NULL,identitychar(32) NOT NULL,tokenchar(32) DEFAULT NULL,datatext,expire_timeint(10) unsigned DEFAULT NULL, PRIMARY KEY (id) ); Add componets in main.php
'tokenManager'=>array( 'class'=>'TokenManager', ),
Usage
See the following code example: ~~~ * Create token
$token = Yii::app()->tokenManager->create('actionName', array('Some Params'), 172800, array('Data saved in this token'));
- Validate token *
$data = Yii::app()->tokenManager->validate('actionName', $token);
