Add SessionInfo force-use flag
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 10 May 2016 19:25:39 +0000 (15:25 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 10 May 2016 19:59:32 +0000 (15:59 -0400)
commitafdcd30599d0670900463281025c582e3addba82
treeff7ef3d30023a362f09855711107c003ca8341d4
parentb1d31d60f6a060cc78d8d495884404ee7ddc118f
Add SessionInfo force-use flag

A provider that uses SessionProvider::hashToSessionId() will likely have
issues if something such as a call to $user->setToken() causes
SessionManager::loadSessionInfoFromStore() to fail, since the provider
can't just arbitrarily change the session ID it returns.

The two solutions to this problem are:
* Somehow include everything that could cause loadSessionInfoFromStore
  to fail in the data hashed by hashToSessionId.
* Flag the SessionInfo so that, if stored data and the SessionInfo
  conflict, it should delete the stored data instead of discarding the
  SessionInfo.

Since the second is less complexity overall due to the lack of need to
define "everything", this patch takes that approach.

Change-Id: I8c6fab2ec295e71242bbcb19d0ee5ade6bd655df
includes/session/SessionInfo.php
includes/session/SessionManager.php
includes/session/SessionProvider.php
tests/phpunit/includes/session/SessionInfoTest.php
tests/phpunit/includes/session/SessionManagerTest.php