### `composer.json` ```json { "hwi/oauth-bundle": "0.4.*@dev", "guzzle/guzzle": "3.8.*@dev", } ``` ### `app/AppKernel.php` ```php $bundles = array( // ... new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), // ... ); ``` ### `app/config/config.yml` ``` hwi_oauth: firewall_name: oauth2_secured_api resource_owners: test_connect: type: oauth2 client_id: %oauth_client% client_secret: %oauth_secret% access_token_url: %website_back_base_url%/oauth/v2/token authorization_url: %website_back_base_url%/oauth/v2/auth infos_url: %website_back_base_url%/me scope: "read" user_response_class: HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse paths: identifier: id nickname: username realname: username ``` ### `app/config/routing.yml` ```yml hwi_oauth_redirect: resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" prefix: /connect hwi_oauth_login: resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" prefix: /login ``` ### `app/config/security.yml` Look at that ! the same `context: test_connect` so [the two firewalls can talk to each other](http://symfony.com/doc/current/reference/configuration/security.html#firewall-context) ! ```yml security: encoders: Symfony\Component\Security\Core\User\User: plaintext role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: hwi: id: hwi_oauth.user.provider firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false oauth2_secured_api: anonymous: ~ context: test_connect oauth: resource_owners: test_connect: "/login/test-connect" login_path: /login use_forward: false failure_path: /login oauth_user_provider: service: hwi_oauth.user.provider access_control: - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/me, roles: ROLE_USER } ```