/**
* Patch the OAuth2 configuration
*
* @param AuthenticationEntity $entity
* @param array $global
* @param array $local
* @return void
*/
protected function patchOAuth2Config(AuthenticationEntity $entity, array $global, array $local)
{
if (isset($global['route_match']) && $global['route_match']) {
$this->globalConfig->patchKey('router.routes.oauth.options.route', $global['route_match']);
}
switch ($entity->getDsnType()) {
case AuthenticationEntity::DSN_MONGO:
$toSet = ['storage' => 'ZF\\OAuth2\\Adapter\\MongoAdapter', 'mongo' => $local];
break;
case AuthenticationEntity::DSN_PDO:
default:
$toSet = ['storage' => 'ZF\\OAuth2\\Adapter\\PdoAdapter', 'db' => $local];
break;
}
$key = 'zf-oauth2';
$this->localConfig->patchKey($key, $toSet);
}