FOSUserBundle多个防火墙+ FOSRestBundle

时间:2017-01-28 14:46:41

标签: symfony fosuserbundle firewall fosrestbundle

我想用FosRestBundle设置FosUserBundle来管理RestApi。 我已经在我的网站上设置了FosUserBundle,一切正常。但我想在config.yml中配置两个firewall_name,一个用于Api的其他网站。

这是我的实际config.yml:

# FOSUser Configuration
fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: AppBundle\Entity\User
    # config send mail
    registration:
        confirmation:
            enabled: true
            from_email:
                address:        noreply@tickenet.fr
                sender_name:    WebMaster
        # surcharge des champs du formulaire
        form:
            type: AppBundle\Form\RegistrationType
    from_email:
        address:        noreply@tickenet.fr
        sender_name:    WebMaster
    resetting:
        email:
            from_email:
                address:        noreply@tickenet.fr
                sender_name:    WebMaster

我想像这样编写一些想法:

# FOSUser Configuration
fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: AppBundle\Entity\User
    # config send mail
    registration:
        confirmation:
            enabled: true
            from_email:
                address:        noreply@tickenet.fr
                sender_name:    WebMaster
        # surcharge des champs du formulaire
        form:
            type: AppBundle\Form\RegistrationType
    from_email:
        address:        noreply@tickenet.fr
        sender_name:    WebMaster
    resetting:
        email:
            from_email:
                address:        noreply@tickenet.fr
                sender_name:    WebMaster

# FOSUserApi Configuration
fos_user_api:
    db_driver: orm
    firewall_name: api
    user_class: AppBundle\Entity\User

或者我可以在fos_user中指定多重防火墙,就像那样:

firewall_name:main,api

有人能帮助我吗?

致以最诚挚的问候,

0 个答案:

没有答案