nepttune / security
安全生成组件
v2.0.1
2019-04-26 12:36 UTC
Requires
- nette/application: ^3.0
This package is auto-updated.
Last update: 2024-09-13 05:48:16 UTC
README
🔧 安全生成组件
简介
此组件可以从配置中的参数自动生成 security.txt。
依赖项
如何使用
- 在配置文件中将
\Nepttune\Component\ISecurityFactory注册为服务,注入到演示者中,编写createComponent方法,并在模板文件中使用宏{control}。- 就像任何其他组件一样。
- 您需要将安全配置传递给工厂服务。
- 内容类型自动设置为
text/plain。
- 修改参数以满足您的需求。
示例配置
services:
securityFactory:
implement: Nepttune\Component\ISecurityFactory
arguments:
- '%security%'
parameters:
security:
contact: 'contact@test.com'
hiring: 'https://hiring.test.com'
acknowledgements: 'https://hall-of-fame.test.com'
permission: 'none'
示例演示者
class ExamplePresenter implements IPresenter
{
/** @var \Nepttune\Component\ISecurityFactory */
protected $iSecurityFactory;
public function __construct(\Nepttune\Component\ISecurityFactory $ISecurityFactory)
{
$this->iSecurityFactory = $ISecurityFactory;
}
protected function createComponentSecurity() : \Nepttune\Component\Security
{
return $this->iSecurityFactory->create();
}
}