kleegroup/franceconnect-bundle

Symfony4 OpenID安全扩展franceconnect

安装数: 5,766

依赖项: 0

建议者: 0

安全: 0

星标: 12

关注者: 13

分支: 9

开放问题: 3

类型:symfony-bundle

0.7 2018-05-25 09:07 UTC

This package is not auto-updated.

Last update: 2024-09-13 23:29:07 UTC


README

Latest Stable Version Total Downloads License

摘要

法国连接认证的Symfony扩展包。

依赖项

安装

所有安装说明位于文档中。安装分为两步

使用

  1. 在您的模板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>
  2. 添加一个处理响应的控制器

       /**
        * @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. 在您的模板中添加FranceConnect脚本

        {% block javascripts %}
            <script src="http://fcp.integ01.dev-franceconnect.fr/js/franceconnect.js"></script>
        {% endblock %}
  4. 在您的模板中添加FranceConnect块

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

许可证

本软件包采用MIT许可证。