Skip to content

Instantly share code, notes, and snippets.

@RickySu
Created January 13, 2014 06:00
Show Gist options
  • Save RickySu/8395370 to your computer and use it in GitHub Desktop.
Save RickySu/8395370 to your computer and use it in GitHub Desktop.
#app/config/security.yml
security:
providers:
fos_userbundle:
id: my.custom.user_provider.username_email
<!-- YourBundle/resource/config/service.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="my.custom.user_provider.username_email" class="My\Custom\User\UserProvider" public="false">
<argument type="service" id="fos_user.user_manager" />
</service>
</services>
</container>
<?php
namespace My\Custom\User;
use FOS\UserBundle\Security;
use Symfony\Component\Security\Core\User\UserInterface;
class UserProvider extends EmailUserProvider
{
public function refreshUser(UserInterface $user)
{
return $user;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment