简体   繁体   English

如何独立使用Symfony2 Security?

[英]How to use Symfony2 Security standalone?

Documentation says it is a standalone component. 文档说它是一个独立的组件。

Given I have following yaml parsed in the empty index.php file, how to init security and check roles etc.? 鉴于我已经在空的index.php文件中解析了yaml,如何初始化安全性并检查角色等?

# app/config/security.yml
security:
    providers:
        default_provider:
            memory:
                users:
                    ryan:  { password: ryanpass, roles: 'ROLE_USER' }
                    admin: { password: kitten, roles: 'ROLE_ADMIN' }

Matthias Noback hat just writed some documentation about the Security Component. Matthias Noback刚刚写了一些有关安全组件的文档。 You can read the raw version on github , but it will be merged soon and aviable for you at http://symfony.com/doc/current/components/security/introduction.html 您可以在github上阅读原始版本,但是它将很快合并并可以在http://symfony.com/doc/current/components/security/introduction.html上使用。

Or you can read his blog posts about the Security Component before changing it to documentation: http://php-and-symfony.matthiasnoback.nl/category/security/ 或者,您可以在将安全组件更改为文档之前阅读其有关安全组件的博客文章: http : //php-and-symfony.matthiasnoback.nl/category/security/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM