ibrows / hmac-bundle
Symfony HMAC Bundle 添加了一个 SecurityListenerFactor,它为配置的防火墙提供了 hmac 身份验证
1.0.0
2015-08-27 15:04 UTC
Requires
- acquia/http-hmac-php: ~1.0
- symfony/framework-bundle: ~2.7
- symfony/security-bundle: ~2.7
Requires (Dev)
- phpunit/phpunit: ~4.0
- symfony/browser-kit: ~2.7
This package is auto-updated.
Last update: 2024-09-15 19:17:46 UTC
README
Ibrows HMAC Bundle 添加了一个 SecurityListenerFactor,它为配置的防火墙提供了 hmac 身份验证。这是对 RESTful Web API 请求进行签名和验证的推荐方式。
安装与设置包
-
在您的 composer.json 中添加 IbrowsHmacBundle
{ "require": { "ibrows/hmac-bundle": "~1.0", } }
-
现在运行以下命令,让 composer 下载包
$ php composer.phar update ibrows/hmac-bundle
-
将包添加到您的
AppKernel
类中// app/AppKernerl.php public function registerBundles() { $bundles = array( // ... new \Ibrows\HmacBundle\IbrowsHmacBundle(), // ... ); // ... }
-
您的 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']