File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ /**
4+ * This file is part of the Nette Framework (https://nette.org)
5+ * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6+ */
7+
8+ namespace Nette \Bridges \SecurityHttp ;
9+
10+ use Nette ;
11+ use Nette \Security \IIdentity ;
12+ use function strlen ;
13+
14+
15+ /**
16+ * Identity used by CookieStorage
17+ */
18+ final readonly class CookieIdentity implements IIdentity
19+ {
20+ private const MIN_LENGTH = 13 ;
21+
22+ private string $ uid ;
23+
24+
25+ public function __construct (string $ uid )
26+ {
27+ if (strlen ($ uid ) < self ::MIN_LENGTH ) {
28+ throw new \LogicException ('UID is too short. ' );
29+ }
30+ $ this ->uid = $ uid ;
31+ }
32+
33+
34+ public function getId (): string
35+ {
36+ return $ this ->uid ;
37+ }
38+
39+
40+ /**
41+ * @throws Nette\NotSupportedException
42+ */
43+ public function getRoles (): array
44+ {
45+ throw new Nette \NotSupportedException ;
46+ }
47+
48+
49+ /**
50+ * @return array<string, mixed>
51+ * @throws Nette\NotSupportedException
52+ */
53+ public function getData (): array
54+ {
55+ throw new Nette \NotSupportedException ;
56+ }
57+ }
You can’t perform that action at this time.
0 commit comments