diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index b21a6e7103c4b6bdfd8d7e15381601909ce6bbad..feea0fbd30df5b20c323f3982e76fbced8782d9c 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -22,7 +22,7 @@ use SimpleSAML\Error; * @package SimpleSAMLphp */ -class Session implements \Serializable +class Session implements \Serializable, Utils\ClearableState { /** * This is a timeout value for setData, which indicates that the data @@ -1134,4 +1134,14 @@ class Session implements \Serializable } return $authorities; } + + + /** + * Clear any configuration information cached + */ + public static function clearInternalState() + { + self::$instance = null; + self::$sessions = null; + } } diff --git a/lib/SimpleSAML/Store.php b/lib/SimpleSAML/Store.php index d5be90656fd91737839453c198b00a9bfa864c4d..7f227fca2a37000354e6705b2b5622379b07df36 100644 --- a/lib/SimpleSAML/Store.php +++ b/lib/SimpleSAML/Store.php @@ -9,7 +9,7 @@ use SimpleSAML\Error\CriticalConfigurationError; * * @package SimpleSAMLphp */ -abstract class Store +abstract class Store implements Utils\ClearableState { /** * Our singleton instance. @@ -100,4 +100,13 @@ abstract class Store * @param string $key The key. */ abstract public function delete($type, $key); + + + /** + * Clear any SSP specific state, such as SSP environmental variables or cached internals. + */ + public static function clearInternalState() + { + self::$instance = null; + } } diff --git a/tests/Utils/StateClearer.php b/tests/Utils/StateClearer.php index db32db8e780bed71d522243d26ce4bfef8e9fcfd..89dafe4af2d59574896233ec1e912f69f2c47fe3 100644 --- a/tests/Utils/StateClearer.php +++ b/tests/Utils/StateClearer.php @@ -18,7 +18,7 @@ class StateClearer * Class that implement \SimpleSAML\Utils\ClearableState and should have clearInternalState called between tests * @var array */ - private $clearableState = array('SimpleSAML\Configuration'); + private $clearableState = array('SimpleSAML\Configuration', 'SimpleSAML\Store', 'SimpleSAML\Session'); /** * Environmental variables to unset