kleegroup/franceconnect-bundle

Symfony4 OpenID security extension franceconnect

Installs: 5 770

Dependents: 0

Suggesters: 0

Security: 0

Stars: 12

Watchers: 13

Forks: 9

Open Issues: 3

Type:symfony-bundle

0.7 2018-05-25 09:07 UTC

This package is not auto-updated.

Last update: 2024-10-25 23:58:58 UTC


README

Latest Stable Version Total Downloads License

Synopsis

Symfony bundle for FranceConnect authentication.

Dependencies

Installation

All the installation instructions are located in documentation. The installation is in two steps:

Usage

  1. Add a link to the route " france_connect_login " in your template twig

         <a href="{{ path('france_connect_login') }}" class="btnLink">
            <img src="{{ asset('bundles/franceconnect/images/FCboutons-10.png') }}"
                alt="FranceConnect button"/>
        </a>
  2. Add a controller that will handle the response

       /**
        * @param Request $request
        * @Route("/france-connect-traitement", name="app.fc.return")
        * @Security("is_granted('IS_AUTHENTICATED_FRANCE_CONNECT')")
        */
       public function franceConnectAction(Request $request)
       {
           $token = $this->get('security.token_storage')->getToken();
           $token->getIdentity(); // json array provided by FranceConnect 
           [...]
       }
  3. Add FranceConnect script in your template

        {% block javascripts %}
            <script src="http://fcp.integ01.dev-franceconnect.fr/js/franceconnect.js"></script>
        {% endblock %}
  4. Add FranceConnect block in your template

        <div id="fconnect-profile" data-fc-logout-url="{{ url('france_connect_logout') }}">
            <a href="#">
                {{- identity.givenName ~ ' ' ~ identity.familyName|upper -}}
            </a>
        </div>

License

This bundle is under the MIT license.