private function getAuthProviderConfig($authProvider)
{
// have we already fetched the auth config
if ($this->authProviderConfig) {
return $this->authProviderConfig;
}
if ($authProvider == '') {
// get the first auth provider from the list
$providers = $this->getConfig()->get('AuthenticationProviders', []);
$authProvider = $providers[0];
}
$this->authProviderConfig = Security::getConfig()->get('AuthenticationProviders.' . $authProvider, new ConfigObject());
// merge the internal driver
// merge only if driver is not set and it matches the internal auth provider name
if (!$this->authProviderConfig->get('Driver', false) && isset(self::$authProviders[$authProvider])) {
$this->authProviderConfig->mergeWith(['Driver' => self::$authProviders[$authProvider]]);
}
// make sure the requested auth provider is assigned to the current firewall
if (!in_array($authProvider, $this->getConfig()->get('AuthenticationProviders', [])->toArray())) {
throw new FirewallException('Authentication provider "' . $authProvider . '" is not defined on "' . $this->getFirewallKey() . '" firewall.');
}
// check that we have the driver
if (!$this->authProviderConfig->get('Driver', false)) {
throw new FirewallException('Unable to detect configuration for authentication provider "' . $authProvider . '".');
}
$this->authProviderName = $authProvider;
return $this->authProviderConfig;
}