0

我试图了解 HWIOauthBUndle 是如何工作的。我可以看到对资源所有者的初始授权请求是如何构建和发出的。

但是,我看不到资源所有者的回调如何触发我的应用程序中的任何控制器/操作(不过,它最明显的是这样做的)。

当遵循一般可用的指令时,回调将被发送到类似的东西<path to my app>/check-[resourceOwner],例如http://www.example.com/oauth/check-facebook

在我的routing.yml文件中,我把

facebook_login:
    pattern: /oauth/check-facebook

我看不到任何控制器是如何与该路由关联的,那么当对我的应用程序进行回调时实际发生了什么?

4

1 回答 1

0

身份验证提供程序系统是更复杂的功能之一。您可能想在这里通读:http: //symfony.com/doc/current/cookbook/security/custom_authentication_provider.html

回调通过请求侦听器处理。具体来说:

namespace HWI\Bundle\OAuthBundle\Security\Http\Firewall\OAuthListener;

use Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener;

class OAuthListener extends AbstractAuthenticationListener
{
public function requiresAuthentication(Request $request)
{
    // Check if the route matches one of the check paths
    foreach ($this->checkPaths as $checkPath) {
        if ($this->httpUtils->checkRequestPath($request, $checkPath)) {
            return true;
        }
    }

    return false;
}
protected function attemptAuthentication(Request $request)
{
    // Lots of good stuff here

checkPaths 如何初始化以及如何进行所有调用需要很长的解释。但是身份验证提供程序章节会让您继续前进。

于 2014-08-12T17:45:55.517 回答