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
54
55
56
|
<?php /** * * This file is part of Aura for PHP. * * @license http://opensource.org/licenses/bsd-license.php BSD * */ namespace Aura\Session;
/** * * A factory to create CSRF token objects. * * @package Aura.Session * */ class CsrfTokenFactory { /** * * A cryptographically-secure random value generator. * * @var RandvalInterface * */ protected $randval;
/** * * Constructor. * * @param RandvalInterface $randval A cryptographically-secure random * value generator. * */ public function __construct(RandvalInterface $randval) { $this->randval = $randval; }
/** * * Creates a CsrfToken object. * * @param Session $session The session manager. * * @return CsrfToken * */ public function newInstance(Session $session) { $segment = $session->getSegment('Aura\Session\CsrfToken'); return new CsrfToken($segment, $this->randval); } }
|