private function findAccessToken(array $identity)
    {
        $config = $this->container->get('config');

        foreach ($config['zf-oauth2-doctrine'] as $oauth2Config) {
            if (array_key_exists('object_manager', $oauth2Config)) {
                $objectManager = $this->container->get($oauth2Config['object_manager']);
                $accessTokenRepository = $objectManager
                    ->getRepository($oauth2Config['mapping']['AccessToken']['entity']);

                $accessToken = $accessTokenRepository->findOneBy([
                    $oauth2Config['mapping']['AccessToken']['mapping']['access_token']['name']
                    => array_key_exists('access_token', $identity) ? $identity['access_token'] : $identity['id'],
                ]);

                if ($accessToken) {
                    if ($accessToken->getClient()->getClientId() == $identity['client_id']) {
                        // Match found
                        return $accessToken;
                    }
                }
            }
        }
    }
private function findAccessToken(array $identity)
    {
        $config = $this->container->get('config');

        foreach ($config['zf-oauth2-doctrine'] as $oauth2Config) {
            if (array_key_exists('object_manager', $oauth2Config)) {
                $objectManager = $this->container->get($oauth2Config['object_manager']);
                $accessTokenRepository = $objectManager
                    ->getRepository($oauth2Config['mapping']['AccessToken']['entity']);

                $accessToken = $accessTokenRepository->findOneBy([
                    $oauth2Config['mapping']['AccessToken']['mapping']['access_token']['name']
                    => array_key_exists('access_token', $identity) ? $identity['access_token'] : $identity['id'],
                ]);

                if ($accessToken) {
                    if ($accessToken->getClient()->getClientId() == $identity['client_id']) {
                        // Match found
                        return $accessToken;
                    }
                }
            }
        }
    }
private function findAccessToken ( array $ identity ) { $ config = $ this -> container -> get ( 'config' ) ; foreach ( $ config [ 'zf-oauth2-doctrine' ] as $ oauth2Config ) { if ( array_key_exists ( 'object_manager' , $ oauth2Config ) ) { $ objectManager = $ this -> container -> get ( $ oauth2Config [ 'object_manager' ] ) ; $ accessTokenRepository = $ objectManager -> getRepository ( $ oauth2Config [ 'mapping' ] [ 'AccessToken' ] [ 'entity' ] ) ; $ accessToken = $ accessTokenRepository -> findOneBy ( [ $ oauth2Config [ 'mapping' ] [ 'AccessToken' ] [ 'mapping' ] [ 'access_token' ] [ 'name' ] => array_key_exists ( 'access_token' , $ identity ) ? $ identity [ 'access_token' ] : $ identity [ 'id' ] , ] ) ; if ( $ accessToken ) { if ( $ accessToken -> getClient ( ) -> getClientId ( ) == $ identity [ 'client_id' ] ) { // Match found return $ accessToken ; } } } } }
Search each OAuth2 configuration for a matching clientId and access_token
Search each OAuth2 configuration for a matching clientId and access_token