File: SessionStore.php

package info (click to toggle)
simplesamlphp 1.13.1-2%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 11,304 kB
  • sloc: php: 65,124; xml: 629; python: 376; sh: 193; perl: 185; makefile: 43
file content (53 lines) | stat: -rw-r--r-- 1,247 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

/**
 * Class which implements the openid session store logic.
 *
 * This class has the interface specified in the constructor of the
 * Auth_OpenID_Consumer class.
 *
 * @package simpleSAMLphp
 */
class sspmod_openid_SessionStore {

	/**
	 * Retrieve a key from the session store.
	 *
	 * @param string $key  The key we should retrieve.
	 * @return mixed  The value stored with the given key, or NULL if the key isn't found.
	 */
	public function get($key) {
		assert('is_string($key)');

		$session = SimpleSAML_Session::getSessionFromRequest();
		return $session->getData('openid.session', $key);
	}


	/**
	 * Save a value to the session store under the given key.
	 *
	 * @param string $key  The key we should save.
	 * @param mixed NULL $value  The value we should save.
	 */
	public function set($key, $value) {
		assert('is_string($key)');

		$session = SimpleSAML_Session::getSessionFromRequest();
		$session->setData('openid.session', $key, $value);
	}


	/**
	 * Delete a key from the session store.
	 *
	 * @param string $key  The key we should delete.
	 */
	public function del($key) {
		assert('is_string($key)');

		$session = SimpleSAML_Session::getSessionFromRequest();
		$session->deleteData('openid.session', $key);
	}

}