XFrameOptions.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\App\Response\HeaderProvider;
  7. use \Magento\Framework\App\Response\Http;
  8. /**
  9. * Adds an X-FRAME-OPTIONS header to HTTP responses to safeguard against click-jacking.
  10. */
  11. class XFrameOptions extends \Magento\Framework\App\Response\HeaderProvider\AbstractHeaderProvider
  12. {
  13. /** Deployment config key for frontend x-frame-options header value */
  14. const DEPLOYMENT_CONFIG_X_FRAME_OPT = 'x-frame-options';
  15. /** Always send SAMEORIGIN in backend x-frame-options header */
  16. const BACKEND_X_FRAME_OPT = 'SAMEORIGIN';
  17. /**
  18. * x-frame-options Header name
  19. *
  20. * @var string
  21. */
  22. protected $headerName = Http::HEADER_X_FRAME_OPT;
  23. /**
  24. * x-frame-options header value
  25. *
  26. * @var string
  27. */
  28. protected $headerValue;
  29. /**
  30. * @param string $xFrameOpt
  31. */
  32. public function __construct($xFrameOpt = 'SAMEORIGIN')
  33. {
  34. $this->headerValue = $xFrameOpt;
  35. }
  36. }