예제 #1
0
 public static function setUpBeforeClass()
 {
     Castle::setApiKey('secretkey');
     $_SERVER = array();
     $_SERVER['HTTP_USER_AGENT'] = 'TestAgent';
     $_SERVER['REMOTE_ADDR'] = '8.8.8.8';
 }
예제 #2
0
 public function exampleSessionTokenWithChallenge()
 {
     Castle::setApiKey('secretkey');
     $jwt = new Castle_JWT();
     $jwt->setHeader(array('iss' => '1', 'exp' => time()));
     $jwt->setBody('chg', 1);
     $jwt->setBody('dpr', 1);
     $jwt->setBody('mfa', 1);
     $jwt->setBody('vfy', 1);
     $jwt->setBody('typ', 'authenticator');
     $jwt->isValid();
     return array(array($jwt->toString()));
 }
예제 #3
0
 public static function setUpBeforeClass()
 {
     Castle::setApiKey('secretkey');
 }
예제 #4
0
 /**
  * @expectedException Castle_ConfigurationError
  */
 public function testConfiguration()
 {
     Castle::setApiKey(null);
     $this->request->send('GET', '/test');
 }
예제 #5
0
 public function setUp()
 {
     Castle::setApiKey('secret');
 }
예제 #6
0
 /**
  * Log out process: delete cookie, delete session
  */
 public static function logout()
 {
     if (Config::get('CASTLE_ENABLED')) {
         Castle::setApiKey(Config::get('CASTLE_SECRET'));
         Castle::logout();
         Castle::track(array('name' => '$logout.succeeded', 'user_id' => Session::get('user_id')));
     }
     self::deleteCookie();
     Session::destroy();
 }