Protect login against CSRF

refs #5626
This commit is contained in:
Johannes Meyer 2014-07-16 09:54:58 +02:00
parent b40027b6c7
commit e6dee9fe89
4 changed files with 18 additions and 7 deletions

View File

@ -11,12 +11,6 @@ use Icinga\Web\Form;
*/
class LoginForm extends Form
{
/**
* Disable CSRF protection
* @var bool
*/
protected $tokenDisabled = true;
/**
* Interface how the form should be created
*/

View File

@ -10,6 +10,7 @@ use Zend_Config;
use Zend_Form_Element_Submit;
use Zend_Form_Element_Reset;
use Zend_View_Interface;
use Icinga\Web\Session;
use Icinga\Web\Form\Element\Note;
use Icinga\Exception\ProgrammingError;
use Icinga\Web\Form\Decorator\HelpText;
@ -112,7 +113,7 @@ class Form extends Zend_Form
public function getSessionId()
{
if (!$this->sessionId) {
$this->sessionId = session_id();
$this->sessionId = Session::getSession()->getId();
}
return $this->sessionId;

View File

@ -191,6 +191,15 @@ class PhpSession extends Session
}
}
/**
* @see Session::getId()
*/
public function getId()
{
$this->open(); // Make sure we actually get a id
return session_id();
}
/**
* Assign a new sessionId to the currently active session
*/

View File

@ -54,6 +54,13 @@ abstract class Session extends SessionNamespace
*/
abstract public function refreshId();
/**
* Return the id of this session
*
* @return string
*/
abstract public function getId();
/**
* Get or create a new session namespace
*