be3f0fe1aed267a0aee44be8d6d20e8cf5777ed4
[WebKit-https.git] / Websites / perf.webkit.org / public / privileged-api / generate-csrf-token.php
1 <?php
2
3 require_once('../include/json-header.php');
4
5 ensure_privileged_api_data();
6
7 $expiritaion = time() + 3600; // Valid for one hour.
8 $_COOKIE['CSRFSalt'] = rand();
9 $_COOKIE['CSRFExpiration'] = $expiritaion;
10
11 setcookie('CSRFSalt', $_COOKIE['CSRFSalt']);
12 setcookie('CSRFExpiration', $expiritaion);
13
14 exit_with_success(array('user' => remote_user_name(), 'token' => compute_token(), 'expiration' => $expiritaion * 1000));
15
16 ?>