class_CookieAuth.php

Go to the documentation of this file.
00001 <?php
00024 class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registerable {
00030         protected function __construct () {
00031                 // Call parent constructor
00032                 parent::__construct(__CLASS__);
00033 
00034                 // Clean up a little
00035                 $this->removeNumberFormaters();
00036                 $this->removeSystemArray();
00037         }
00038 
00045         public final static function createCookieAuth (Responseable $responseInstance) {
00046                 // Get a new instance
00047                 $loginInstance = new CookieAuth();
00048 
00049                 // Set the response instance
00050                 $loginInstance->setResponseInstance($responseInstance);
00051 
00052                 // Return the prepared instance
00053                 return $loginInstance;
00054         }
00055 
00062         public function setUserAuth ($userName) {
00063                 $this->getResponseInstance()->addCookie('username', $userName);
00064         }
00065 
00072         public function setPasswordAuth ($passHash) {
00073                 $this->getResponseInstance()->addCookie('u_hash', $passHash, true);
00074         }
00075 
00081         public function getUserAuth () {
00082                 // Get the username from cookie
00083                 $userName = $this->getRequestInstance()->readCookie('username');
00084 
00085                 // Return the username
00086                 return $userName;
00087         }
00088 
00094         public function getPasswordAuth () {
00095                 // Get the username from cookie
00096                 $passHash = $this->getRequestInstance()->readCookie('u_hash');
00097 
00098                 // Return the username
00099                 return $passHash;
00100         }
00101 
00107         public function destroyAuthData () {
00108                 // Expire both cookies
00109                 $this->getResponseInstance()->expireCookie('username');
00110                 $this->getResponseInstance()->expireCookie('u_hash');
00111         }
00112 
00119         public function updateAuthData () {
00120                 $this->getResponseInstance()->refreshCookie('username');
00121                 $this->getResponseInstance()->refreshCookie('u_hash');
00122         }
00123 }
00124 
00125 // [EOF]
00126 ?>

Generated on Mon Dec 8 01:06:45 2008 for Ship-Simulator by  doxygen 1.5.6