File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
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+ declare (strict_types=1 );
9+
10+ namespace Nette \Bridges \SecurityHttp ;
11+
12+ use Nette ;
13+ use Nette \Security \IIdentity ;
14+
15+
16+ /**
17+ * Identity used by CookieStorage
18+ */
19+ final class CookieIdentity implements IIdentity
20+ {
21+ use Nette \SmartObject;
22+
23+ private const MIN_LENGTH = 13 ;
24+
25+ private string $ uid ;
26+
27+
28+ public function __construct (string $ uid )
29+ {
30+ if (strlen ($ uid ) < self ::MIN_LENGTH ) {
31+ throw new \LogicException ('UID is too short. ' );
32+ }
33+ $ this ->uid = $ uid ;
34+ }
35+
36+
37+ public function getId (): string
38+ {
39+ return $ this ->uid ;
40+ }
41+
42+
43+ public function getRoles (): array
44+ {
45+ throw new Nette \NotSupportedException ;
46+ }
47+
48+
49+ public function getData (): array
50+ {
51+ throw new Nette \NotSupportedException ;
52+ }
53+ }
You can’t perform that action at this time.
0 commit comments