Page 1 of 1
FosUserBundle
Posted: 26 Jan 2015, 14:35
by garwat82
Hey
I've managed to integrate the Symfony FosUserBundle (
https://github.com/FriendsOfSymfony/FOSUserBundle) for registration, authentication and password reminder into my Aimeos Symfony project.
Are you also interested in using this in Aimeos instead of the current solution?
Regards,
Garret
Re: FosUserBundle
Posted: 26 Jan 2015, 15:36
by aimeos
Hi Garret
Sure, every contribution is welcome!
Re: FosUserBundle
Posted: 30 Jan 2015, 14:17
by garwat82
Hey
The necessary changes have been committed and as far as I can see, the tests for the core and the Symfony adapter succeed now.
There's a pull request for the Symfony bundle as well and it may require some more attention because I've only added the FosUser entity and that's no used by default.
Regards,
Garret
Re: FosUserBundle
Posted: 30 Jan 2015, 17:56
by garwat82
The test are now working like expected
Garret
Re: FosUserBundle
Posted: 30 Jan 2015, 18:19
by aimeos
Great! How does it work?
Maybe we can write some documentation for it.
Re: FosUserBundle
Posted: 30 Jan 2015, 19:47
by garwat82
I've used 2.0 branch of the FosUserBundle and I've added this to the require section of my composer.json:
Code: Select all
"friendsofsymfony/user-bundle": "~2.0@dev"
In AppKernel::registerBundles() the bundle must be registered:
Code: Select all
new FOS\UserBundle\FOSUserBundle(),
The config.yml needs these settings and I've used the secure Bcrypt encryption:
Code: Select all
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: aimeos_myaccount
user_class: Aimeos\ShopBundle\Entity\FosUser
aimeos_shop:
classes:
customer:
manager:
name: FosUser
mshop:
customer:
manager:
password:
name: Bcrypt
The user bundle routes must also be included in the routing.yml:
Code: Select all
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
The security.yml is the most complex file:
Code: Select all
security:
providers:
aimeos_customer:
entity: { class: AimeosShopBundle:FosUser, property: username }
encoders:
Aimeos\ShopBundle\Entity\FosUser: bcrypt
firewalls:
aimeos_myaccount:
pattern: ^/
form_login:
provider: aimeos_customer
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: ^/myaccount, roles: ROLE_USER }
Hope this helps.