FOSUserBundle을 처음 사용하고 있으며이 오류로 어려움을 겪고 있습니다. 사이트에서 적절한 답변을 찾을 수 없습니다.symfony2 FOSUserBundle login에서 'bad credentials'을 반환합니다.
사람은 PLZ 나에게 도움이 될 수 있습니다 - *
이 내 아이의 사용자 개체
<?php
// src/Blogger/BlogBundle/Entity/CommonUser.php
namespace Blogger\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use FOS\UserBundle\Model\User as BaseUser;
/**
* @ORM\Entity(repositoryClass="Blogger\BlogBundle\Entity\Repository\CommonUserRepository")
* @ORM\Table(name="CommonUser")
* @ORM\HasLifecycleCallbacks
*/
class CommonUser extends BaseUser
{
/**
* @ORM\OneToMany(targetEntity="Request", mappedBy="commonUser")
*/
protected $requests;
public function __construct()
{
parent::__construct();
$this->requests = new ArrayCollection();
}
/**
* @ORM\Id
* @ORM\Column(type="integer", nullable=false)
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
...
...
...
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
public function getSalt()
{
return '';
}
...
}
이며, 또한 이것은 request.php 클래스
<?php
// src/Blogger/BlogBundle/Entity/Request.php
namespace Blogger\BlogBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Blogger\BlogBundle\Entity\Repository\RequestRepository;
/**
* @ORM\Entity(repositoryClass="Blogger\BlogBundle\Entity\Repository\requestRepository")
* @ORM\Table(name="request")
* @ORM\HasLifecycleCallbacks
*/
class Request
{
/**
* @ORM\OneToMany(targetEntity="Note", mappedBy="request")
*/
protected $notes;
public function __construct()
{
$this->notes = new ArrayCollection();
$this->setCreated(new \DateTime());
$this->setUpdated(new \DateTime());
}
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="CommonUser", inversedBy="requests")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
protected $commonUser;
/**
* @ORM\Column(type="text")
*/
protected $request;
....
....
....
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
....
....
....
}
이며이 내입니다 보안 파일
# app/config/security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
왜 CommomUser :: getSalt가 '?'를 반환합니까? hide_user_not_found를 추가하십시오 : 보안 아래 false :. 그러면 적어도 사용자가로드되고 있음을 알 수 있습니다. – Cerad