welcome back to dyb-tech

This commit is contained in:
Daniel Guzman
2024-05-18 02:28:01 +02:00
parent 9513cdba09
commit 9f30bc98c7
6149 changed files with 668407 additions and 0 deletions
@@ -0,0 +1,78 @@
<?php
namespace Lexik\Bundle\JWTAuthenticationBundle\Security\User;
/**
* User class for which to create instances from JWT tokens.
*
* Note: This is only useful when using the JWTUserProvider (database-less).
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
class JWTUser implements JWTUserInterface
{
private $userIdentifier;
private $roles;
public function __construct(string $userIdentifier, array $roles = [])
{
$this->userIdentifier = $userIdentifier;
$this->roles = $roles;
}
/**
* {@inheritdoc}
*/
public static function createFromPayload($username, array $payload)
{
if (isset($payload['roles'])) {
return new static($username, (array) $payload['roles']);
}
return new static($username);
}
/**
* {@inheritdoc}
*/
public function getUsername(): string
{
return $this->getUserIdentifier();
}
public function getUserIdentifier(): string
{
return $this->userIdentifier;
}
/**
* {@inheritdoc}
*/
public function getRoles(): array
{
return $this->roles;
}
/**
* {@inheritdoc}
*/
public function getPassword(): ?string
{
return null;
}
/**
* {@inheritdoc}
*/
public function getSalt(): ?string
{
return null;
}
/**
* {@inheritdoc}
*/
public function eraseCredentials(): void
{
}
}