Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
CsrfToken.php
Go to the documentation of this file.
1<?php
2
4
13class CsrfToken {
14 private $name;
15 private $value;
16
17 public function __construct($size = 32) {
18 $this->name = $this->generate ( $size );
19 $this->value = $this->generate ( $size );
20 }
21
22 private function generate($size): string {
23 $bytes = \random_bytes ( $size );
24 return \rtrim ( \strtr ( \base64_encode ( $bytes ), '+/', '-_' ), '=' );
25 }
26
31 public function getName() {
32 return $this->name;
33 }
34
39 public function getValue() {
40 return $this->value;
41 }
42}
43
Ubiquity\utils\http\session\protection$CsrfToken This class is part of Ubiquity.
Definition CsrfToken.php:13