如何使用 openfire 服务器将 symfony2 登录/传递凭据传递给 strophe.js


How to pass symfony2 login/pass credentials to strophe.js with openfire server?

我有一个简单的登录/注册应用程序,用symfony2编写。我正在使用数据库编码器来检查用户/密码组合。这部分工作得很好。

我在登录时遇到问题。我不明白login_check路?控制器在哪里?

我需要在用户登录期间捕获纯密码,以便我可以将该用户名和纯密码传递给php xmpp命名空间,该命名空间将在openfire服务器上检查用户/传递。

请告诉我我是否有错误的方法。我真的需要一些指导。

请指教。

请参阅我对类似问题的回答,以快速介绍特殊的"路线"form_login.check_path

我通过添加一个在用户登录时触发的事件侦听器来解决这个问题。

服务.yml

services:
    d_user.login_listener:
      class: Chat'IndexBundle'EventListener'LoginListener
      arguments: []
      tags:
        - { name: 'kernel.event_subscriber', event: 'security.interactive_login' }

和侦听器

namespace Chat'IndexBundle'EventListener;
use Symfony'Component'Security'Http'Event'InteractiveLoginEvent;
use Symfony'Component'EventDispatcher'EventSubscriberInterface;
class LoginListener implements EventSubscriberInterface
{
    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        die(var_dump($event->getRequest()));
    }
    //...etc
}

在那个die(var_dump($event->getRequest()));现在我可以捕获用户并将其传递并传递给 openfire 服务器,从中我可以获取 sid、rid 和 jid 并附加到前端的该会话。

这个答案非常有帮助。