You are here

class SecureLoginPathProcessor in Secure Login 8

Secure login path processor.

This path processor applies a configured secure base URL. It is useful for sites that have multiple insecure base URLs and an SSL certificate valid only for one secure base URL.

Hierarchy

Expanded class hierarchy of SecureLoginPathProcessor

1 string reference to 'SecureLoginPathProcessor'
securelogin.services.yml in ./securelogin.services.yml
securelogin.services.yml
1 service uses SecureLoginPathProcessor
securelogin.path_processor in ./securelogin.services.yml
Drupal\securelogin\SecureLoginPathProcessor

File

src/SecureLoginPathProcessor.php, line 17

Namespace

Drupal\securelogin
View source
class SecureLoginPathProcessor implements OutboundPathProcessorInterface {

  /**
   * The configured secure login base URL.
   *
   * @var string
   */
  protected $baseUrl;

  /**
   * Constructs secure login path processor.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->baseUrl = $config_factory
      ->get('securelogin.settings')
      ->get('base_url');
  }

  /**
   * {@inheritdoc}
   */
  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
    if (!empty($options['https']) && $this->baseUrl) {
      $options['absolute'] = TRUE;
      $options['base_url'] = $this->baseUrl;
    }
    return $path;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SecureLoginPathProcessor::$baseUrl protected property The configured secure login base URL.
SecureLoginPathProcessor::processOutbound public function Processes the outbound path. Overrides OutboundPathProcessorInterface::processOutbound
SecureLoginPathProcessor::__construct public function Constructs secure login path processor.