简体   繁体   English

Symfony2 2个应用程序的相同UserBundle

[英]Symfony2 same UserBundle for 2 applications

I just created a web reporting tool for customers, using the FOSUserBundle for authentication. 我刚刚使用FOSUserBundle进行身份验证,为客户创建了一个Web报告工具。 I now want to develop an other reporting tool on the same server but with a different URI. 我现在想在同一服务器上使用不同的URI开发其他报告工具。

The user management will be the same. 用户管理将相同。 Do I really have to re-use the UserBundle I created before, or is there a way to authenticate my users using the first application ? 我是否真的必须重新使用之前创建的UserBundle,或者是否可以使用第一个应用程序对我的用户进行身份验证?

Thanks a lot :) 非常感谢 :)

Pete 皮特

You may be interested by the host requirements in the routing file, take a look : http://symfony.com/doc/current/book/routing.html#adding-a-host-requirement 您可能对路由文件中的主机要求感兴趣,请参阅: http : //symfony.com/doc/current/book/routing.html#adding-a-host-requirement

That means you can scope an entire bundle routing to a certain domain. 这意味着您可以将整个分发包路由到某个域。

Don't specify host requirement to your fos user routing, it will works for every domains. 不要为您的fos用户路由指定主机要求,它将适用于每个域。 Then override the login/register/... templates for each domain. 然后覆盖每个域的登录/注册/ ...模板。 You may need to override the controllers too. 您可能还需要覆盖控制器。 https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_controllers.md https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_templates.md https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_controllers.md https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_templates.md

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

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