[TASK] Clean up phpDoc comments in typo3/sysext/rsaauth
[Packages/TYPO3.CMS.git] / typo3 / sysext / rsaauth / sv1 / storage / class.tx_rsaauth_session_storage.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Dmitry Dulepov <dmitry@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * This class contains a session-based storage for private keys. This storage
27 * is not secure enough because its implementation stores keys completely in the
28 * PHP sessions. PHP sessions usually store data in the file system and it is
29 * easy to extract. This storage is useful only as an example. It is better to
30 * use "split" storage for keys.
31 *
32 * @author Dmitry Dulepov <dmitry@typo3.org>
33 * @package TYPO3
34 * @subpackage tx_rsaauth
35 */
36 class tx_rsaauth_session_storage extends tx_rsaauth_abstract_storage {
37
38 /**
39 * Creates an instance of this class. It checks and initializes PHP
40 * sessions if necessary.
41 *
42 * @return void
43 */
44 public function __construct() {
45 if (!isset($_SESSION) || !is_array($_SESSION)) {
46 session_start();
47 }
48 }
49
50 /**
51 * Obtains key from the session
52 *
53 * @return string The key or NULL
54 * @see tx_rsaauth_abstract_storage::get()
55 */
56 public function get() {
57 return (isset($_SESSION['tx_rsaauth_key']) ? $_SESSION['tx_rsaauth_key'] : NULL);
58 }
59
60 /**
61 * Puts key to the session
62 *
63 * @param string $key The key
64 * @see tx_rsaauth_abstract_storage::put()
65 */
66 public function put($key) {
67 $_SESSION['tx_rsaauth_key'] = $key;
68 }
69 }
70 ?>