/
AleksWork
/
diary_plants
Обзор
Документация
Войти
/
AleksWork
/
diary_plants
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/Application/Security/AuthUser.php
41 строка
783 B
AlexeySerov
Add application security class for get jwt token
29 апр 2026, 17:33
29 апр 2026, 17:33
644bbd2
Код
Авторство
О чём код?
<?php namespace App\Application\Security; use Symfony\Component\Security\Core\User\UserInterface; class AuthUser implements UserInterface { private string $username; /** @var string[] */ private array $roles; public function __construct(array $credentials) { $this->username = $credentials['username']; $this->roles = array_unique(array_merge($credentials['roles'] ?? [], ['ROLE_USER'])); } /** * @return string[] */ public function getRoles(): array { return $this->roles; } public function getPassword(): string { return ''; } public function getUserIdentifier(): string { return $this->username; } public function eraseCredentials(): void { } }