/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param ObjectConfig $config An optional ObjectConfig object with configuration options. * @return void */ protected function _initialize(ObjectConfig $config) { $config->append(array('priority' => self::PRIORITY_HIGH)); parent::_initialize($config); }
/** * Sign the response with a session token * * @param DispatcherContext $context A dispatcher context object */ public function challengeResponse(DispatcherContext $context) { if ($context->request->isGet()) { $token = $context->user->getSession()->getToken(); $context->response->headers->addCookie($this->getObject('lib:http.cookie', array('name' => 'csrf_token', 'value' => $token, 'path' => $context->request->getBaseUrl()->getPath()))); $context->response->headers->set('X-CSRF-Token', $token); } parent::challengeResponse($context); }
/** * Initializes the default configuration for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param ObjectConfig $config An optional ObjectConfig object with configuration options. * @return void */ protected function _initialize(ObjectConfig $config) { $config->append(array('priority' => self::PRIORITY_HIGH, 'secret' => '', 'max_age' => 900, 'check_user' => true, 'check_age' => true, 'check_expire' => true)); parent::_initialize($config); }