helthe/api-security-bundle

适用于Symfony 2的Helthe API安全包

安装: 26

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

1.0.0 2014-02-21 07:08 UTC

This package is auto-updated.

Last update: 2024-08-29 03:48:55 UTC


README

Helthe Api Security Bundle将Helthe API安全组件集成到您的Symfony2应用程序中。

安装

步骤 1: 在Composer中添加包依赖

手动

在您的composer.json中添加以下内容

{
    "require": {
        // ...
        "helthe/api-security-bundle": "~1.0"
    }
}

使用命令行

$ composer require 'helthe/api-security-bundle=~1.0'

步骤 2: 在kernel中注册bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Helthe\Bundle\ApiSecurityBundle\HeltheApiSecurityBundle(),
    );
}

用法

用户提供者

Helthe API安全组件提供了一个必须由使用API密钥认证的Symfony防火墙提供的用户提供者实现的UserProviderInterface

防火墙

要添加API密钥认证,只需在防火墙配置中添加api_key,如下所示

# security.yml
security:
    firewalls:
        api:
            api_key:
                name:   helthe-api-key
                method: http_header

错误

对于错误或功能请求,请创建一个问题