Нераспознанное поле: App\Domain\Entity\User::$email с использованием LexikJWTAuthenticationBundle.Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Нераспознанное поле: App\Domain\Entity\User::$email с использованием LexikJWTAuthenticationBundle.

Сообщение Anonymous »

У меня есть этот класс пользователей а это файл security.yaml

Код: Выделить всё

security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
app_user_provider:
entity:
class: App\Domain\Entity\User
property: email
users_in_memory: { memory: null }
jwt:
lexik_jwt: ~
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
pattern: ^/api/login
stateless: true
provider: app_user_provider
json_login:
check_path: /api/login_check
username_path: email       # Cambia "username" a "email" aquí
password_path: password
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure

api:
pattern: ^/api
stateless: true
provider: app_user_provider
jwt: ~  # Usa JWT como autenticador
main:
lazy: true
provider: users_in_memory

# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall

# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true

# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/api/register, roles: PUBLIC_ACCESS }
- { path: ^/api/login, roles: PUBLIC_ACCESS }
- { path: ^/api,       roles: IS_AUTHENTICATED_FULLY }

when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon
Я могу использовать API для регистрации пользователя, но когда я пытаюсь войти в систему, я получаю эту ошибку

Код: Выделить всё

Unrecognized field: App\Domain\Entity\User::$email
Я изменил функцию getEmail, чтобы она возвращала строку вместо электронной почты класса объекта значения, но получаю ту же ошибку. Я застрял на этом, свойство электронной почты существует, и я не знаю, в чем может быть ошибка

Подробнее здесь: https://stackoverflow.com/questions/791 ... nticationb
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»