kleegroup / franceconnect-bundle
Symfony4 OpenID security extension franceconnect
Installs: 5 771
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 13
Forks: 9
Open Issues: 3
Type:symfony-bundle
Requires
- php: ^7.1.3
- mashape/unirest-php: 3.*
- namshi/jose: 7.2.*
- symfony/framework-bundle: ^4
Requires (Dev)
- phpunit/phpunit: ~7.1
Suggests
- doctrine/mongodb-odm: If you want store identities to mongodb
- doctrine/orm: If you want store identities to database
This package is not auto-updated.
Last update: 2024-11-23 00:17:17 UTC
README
Synopsis
Symfony bundle for FranceConnect authentication.
Dependencies
- namshi/jose: Utilisé pour la vérification du JWT
- Mashape/unirest-php utilisé pour les appels REST
Installation
All the installation instructions are located in documentation. The installation is in two steps:
Usage
-
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>
-
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 [...] }
-
Add FranceConnect script in your template
{% block javascripts %} <script src="http://fcp.integ01.dev-franceconnect.fr/js/franceconnect.js"></script> {% endblock %}
-
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.