kleegroup / franceconnect-bundle
Symfony4 OpenID安全扩展franceconnect
0.7
2018-05-25 09:07 UTC
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-09-13 23:29:07 UTC
README
摘要
法国连接认证的Symfony扩展包。
依赖项
- namshi/jose:用于JWT验证
- Mashape/unirest-php:用于REST调用
安装
所有安装说明位于文档中。安装分为两步
使用
-
在您的模板twig中添加到路由"france_connect_login"的链接
<a href="{{ path('france_connect_login') }}" class="btnLink"> <img src="{{ asset('bundles/franceconnect/images/FCboutons-10.png') }}" alt="FranceConnect button"/> </a>
-
添加一个处理响应的控制器
/** * @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 [...] }
-
在您的模板中添加FranceConnect脚本
{% block javascripts %} <script src="http://fcp.integ01.dev-franceconnect.fr/js/franceconnect.js"></script> {% endblock %}
-
在您的模板中添加FranceConnect块
<div id="fconnect-profile" data-fc-logout-url="{{ url('france_connect_logout') }}"> <a href="#"> {{- identity.givenName ~ ' ' ~ identity.familyName|upper -}} </a> </div>
许可证
本软件包采用MIT许可证。