File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-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+ private const MIN_LENGTH = 13 ;
22+
23+ private string $ uid ;
24+
25+
26+ public function __construct (string $ uid )
27+ {
28+ if (strlen ($ uid ) < self ::MIN_LENGTH ) {
29+ throw new \LogicException ('UID is too short. ' );
30+ }
31+ $ this ->uid = $ uid ;
32+ }
33+
34+
35+ public function getId (): string
36+ {
37+ return $ this ->uid ;
38+ }
39+
40+
41+ public function getRoles (): array
42+ {
43+ throw new Nette \NotSupportedException ;
44+ }
45+
46+
47+ public function getData (): array
48+ {
49+ throw new Nette \NotSupportedException ;
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments