I have a class in Symfony that implements an interface. I need to have $request to have POST params. This is my function:
class WebserviceUserProvider implements UserProviderInterface
{
public function loadUserByUsername($username)
{
$salt = "";
$roles = "";
// make a call to your webservice here
.....
}
...
}
I can't do this:
public function loadUserByUsername($username, Request $request)
because i need to implement the interface, and i get this error:
FatalErrorException: Compile Error: Declaration of Actas\Gestion\UserBundle\Security\User\WebserviceUserProvider::loadUserByUsername() must be compatible with Symfony\Component\Security\Core\User\UserProviderInterface::loadUserByUsername($username)
How can i get the request params? This class is called from login, and i need the password sent by it to use a WebService to authenticate the user.
Thank you very much in advance!
This is my services.xml in the Bundle:
# src/Actas/Gestion/UserBundle/Resources/config/services.yml
parameters:
webservice_user_provider.class: Actas\Gestion\UserBundle\Security\User\WebserviceUserProvider
services:
webservice_user_provider:
class: "%webservice_user_provider.class%"
scope: container
calls:
- [setServiceContainer , ["@service_container"]]