Skip to content
Snippets Groups Projects

Issue #3410613 by bluegeek9: Services Dependency Injection

Files
5
@@ -2,9 +2,9 @@
namespace Drupal\ldap_sso_auth\RequestPolicy\PageCache;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\PageCache\RequestPolicyInterface;
use Drupal\Core\Session\SessionConfigurationInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -27,23 +27,23 @@ class LdapSsoAuthLoginName implements RequestPolicyInterface {
protected $sessionConfiguration;
/**
* The services container.
* The ldap_sso_auth settings.
*
* @var \Symfony\Component\DependencyInjection\ContainerInterface
* @var \Drupal\Core\Config\ImmutableConfig
*/
protected $container;
protected $settings;
/**
* Constructs a new page cache session policy.
*
* @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration
* The session configuration.
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The services container.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(SessionConfigurationInterface $session_configuration, ContainerInterface $container) {
public function __construct(SessionConfigurationInterface $session_configuration, ConfigFactoryInterface $config_factory) {
$this->sessionConfiguration = $session_configuration;
$this->container = $container;
$this->settings = $config_factory->get('ldap_sso_auth.settings');
}
/**
@@ -52,9 +52,7 @@ class LdapSsoAuthLoginName implements RequestPolicyInterface {
public function check(Request $request) {
if (!$this->sessionConfiguration->hasSession($request)) {
// No session stored check header sso variable of user name.
$sso_variable = $this->container->get('config.factory')
->get('ldap_sso_auth.settings')
->get('ssoVariable');
$sso_variable = $this->settings->get('ssoVariable');
if ($request->server->get($sso_variable) === NULL) {
// Not contains name in sso variable allow to get page from cache.
Loading