Skip to content

Commit

Permalink
CookieIdentity WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 11, 2023
1 parent a41e0ff commit 1ec0564
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Bridges/SecurityHttp/CookieIdentity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

/**
* This file is part of the Nette Framework (https://nette.org)
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
*/

declare(strict_types=1);

namespace Nette\Bridges\SecurityHttp;

use Nette;
use Nette\Security\IIdentity;


/**
* Identity used by CookieStorage
*/
final class CookieIdentity implements IIdentity
{
private const MIN_LENGTH = 13;

private string $uid;


public function __construct(string $uid)
{
if (strlen($uid) < self::MIN_LENGTH) {
throw new \LogicException('UID is too short.');
}
$this->uid = $uid;
}


public function getId(): string
{
return $this->uid;
}


public function getRoles(): array
{
throw new Nette\NotSupportedException;
}


public function getData(): array
{
throw new Nette\NotSupportedException;
}
}

0 comments on commit 1ec0564

Please sign in to comment.