1 | <?php |
||
39 | trait SessionRequestAwareTrait |
||
40 | { |
||
41 | /** |
||
42 | * Session attribute |
||
43 | * |
||
44 | * @var string |
||
45 | * |
||
46 | * @access protected |
||
47 | */ |
||
48 | protected $sessionAttribute = 'aura/session:session'; |
||
49 | |||
50 | /** |
||
51 | * CsrfName |
||
52 | * |
||
53 | * @var string |
||
54 | * |
||
55 | * @access protected |
||
56 | */ |
||
57 | protected $csrfName = '__csrf_token'; |
||
58 | |||
59 | /** |
||
60 | * CsrfHeader |
||
61 | * |
||
62 | * @var string |
||
63 | * |
||
64 | * @access protected |
||
65 | */ |
||
66 | protected $csrfHeader = 'X-Csrf-Token'; |
||
67 | |||
68 | /** |
||
69 | * Set session attribute |
||
70 | * |
||
71 | * @param string $attr name of attribute for session |
||
72 | * |
||
73 | * @return $this |
||
74 | * |
||
75 | * @access public |
||
76 | */ |
||
77 | 3 | public function setSessionAttribute($attr) |
|
82 | |||
83 | /** |
||
84 | * SetCsrfName |
||
85 | * |
||
86 | * @param mixed $name DESCRIPTION |
||
87 | * |
||
88 | * @return mixed |
||
89 | * |
||
90 | * @access public |
||
91 | */ |
||
92 | 1 | public function setCsrfName($name) |
|
97 | |||
98 | /** |
||
99 | * GetCsrfName |
||
100 | * |
||
101 | * @return mixed |
||
102 | * |
||
103 | * @access public |
||
104 | */ |
||
105 | 9 | public function getCsrfName() |
|
109 | |||
110 | /** |
||
111 | * SetCsrfHeader |
||
112 | * |
||
113 | * @param mixed $header DESCRIPTION |
||
114 | * |
||
115 | * @return mixed |
||
116 | * |
||
117 | * @access public |
||
118 | */ |
||
119 | 1 | public function setCsrfHeader($header) |
|
124 | |||
125 | /** |
||
126 | * GetCsrfHeader |
||
127 | * |
||
128 | * @return mixed |
||
129 | * |
||
130 | * @access public |
||
131 | */ |
||
132 | 8 | public function getCsrfHeader() |
|
136 | |||
137 | /** |
||
138 | * Get session from request |
||
139 | * |
||
140 | * @param Request $request PSR7 Request |
||
141 | * |
||
142 | * @return Session |
||
143 | * @throws InvalidArgumentException if session attribute is invalid |
||
144 | * |
||
145 | * @access protected |
||
146 | */ |
||
147 | 6 | protected function getSession(Request $request) |
|
158 | |||
159 | /** |
||
160 | * GetCsrfSpec |
||
161 | * |
||
162 | * @param Request $request DESCRIPTION |
||
163 | * |
||
164 | * @return mixed |
||
165 | * |
||
166 | * @access protected |
||
167 | */ |
||
168 | 1 | protected function getCsrfSpec(Request $request) |
|
180 | } |
||
181 |