ibrows/hmac-bundle

Symfony HMAC Bundle 添加了一个 SecurityListenerFactor,它为配置的防火墙提供了 hmac 身份验证

安装数: 1,408

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

1.0.0 2015-08-27 15:04 UTC

This package is auto-updated.

Last update: 2024-09-15 19:17:46 UTC


README

Build Status

Ibrows HMAC Bundle 添加了一个 SecurityListenerFactor,它为配置的防火墙提供了 hmac 身份验证。这是对 RESTful Web API 请求进行签名和验证的推荐方式。

安装与设置包

  1. 在您的 composer.json 中添加 IbrowsHmacBundle

    {
        "require": {
            "ibrows/hmac-bundle": "~1.0",
        }
    }
  2. 现在运行以下命令,让 composer 下载包

    $ php composer.phar update ibrows/hmac-bundle
  3. 将包添加到您的 AppKernel 类中

    // app/AppKernerl.php
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new \Ibrows\HmacBundle\IbrowsHmacBundle(),
            // ...
        );
        // ...
    }
  4. 您的 security.yml 配置示例

    security:
        firewalls:
            api:
                pattern:  ^/api
                stateless: true
                anonymous: ~
                provider: api_provider
                ibrows_hmac:
                    authentication_provider_key: me
        access_control:
            - { path: ^/api/, roles: ROLE_API }
        encoders:
            Symfony\Component\Security\Core\User\User: plaintext
        providers:
            api_provider:
                memory:
                    users:
                        test:
                            password: test
                            roles:  ['ROLE_API']