Installation

This package has a Symfony Flex recipe that will install configuration files for you.

Default configuration files will be copied in the dev environment.

Step 1

The recommended way to install it is with Composer :

composer require ecphp/eu-login-api-authentication-bundle

This package has a Symfony recipe that will provides the minimum configuration files.

Warning

Be careful, the recipe will enable some routes in your dev environment only. Those routes might be considered as a security issue if they are enabled in the production environment. Those routes are /api/token and /api/user. Find the documentation related to those routes inside the classes themselves. To disable them completely, just delete the file packages/config/routes/dev/eu_login_api_authentication.yaml.

Step 2

Edit the bundle configuration by editing the file config/packages/dev/eu_login_api_authentication.yaml.

eu_login_api_authentication:
    client_id: foo
    client_secret: bar
    environment: acceptance # Available values are: acceptance, production

Step 3

This is the crucial part of your application’s security configuration.

Edit the security settings of your application by edition the file config/packages/security.yaml.

security:
    enable_authenticator_manager: true
    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
    providers:
        eu_login_api_authentication:
            id: EcPhp\EuLoginApiAuthenticationBundle\Security\Core\User\EuLoginApiAuthenticationUserProvider
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            provider: eu_login_api_authentication
            custom_authenticators:
                - EcPhp\EuLoginApiAuthenticationBundle\Security\EuLoginApiAuthenticationAuthenticator

    access_control:
        - { path: ^/user, role: IS_AUTHENTICATED_FULLY }

Feel free to change these configuration to fits your need. Have a look at the Symfony documentation about security and authentication.