Currently my project works very well. I use FOSUserBundle for the management of my users. Now, I want to implement OAuth, so I'm using FOSOAuthServerBundle. Most of developers recommend this bundle for implement OAuth.
I followed the documentation of FOSOAuthServerBundle. Normally, I have to add more information in my security.yml but I don't know exactly what I have to do ...
Here is my security.yml :
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Moodress\Bundle\UserBundle\Entity\User: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
main:
id: fos_user.user_provider.username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
oauth_token:
pattern: ^/oauth/v2/token
security: false
oauth_authorize:
pattern: ^/oauth/v2/auth
main:
pattern: ^/
fos_oauth: true
stateless: true
anonymous: true
I guess that there are some information to add in firewalls maybe ??
I really don't know how to make works FOSOAuthServerBundle with FOSUserBundle. Before, with just FOSUserBundle, I used the login form and the login check of FOSUserBundle. Now that I put all the basic configuration of FOSOAuthServerBundle, what I have to do next ? Which form should I use? Which login check? The token is created automatically by FOSOAuthServerBundle ? In the documentation, they show how to create a client... Am I supposed to add this code in my project ? If yes... where ? :/
I found this article on the web : http://blog.logicexception.com/2012/04/securing-syfmony2-rest-service-wiith.html
I tried to implement this, but I can't believe that we need to add all this files to make it work...
If someone knows how to make works FOSOAuthServerBundle with FOSUserBundle, it would be very helpful.