vendor/symfony/security-bundle/Security/FirewallConfig.php line 72

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\SecurityBundle\Security;
  11. /**
  12. * @author Robin Chalas <robin.chalas@gmail.com>
  13. */
  14. final class FirewallConfig
  15. {
  16. private $name;
  17. private $userChecker;
  18. private $requestMatcher;
  19. private $securityEnabled;
  20. private $stateless;
  21. private $provider;
  22. private $context;
  23. private $entryPoint;
  24. private $accessDeniedHandler;
  25. private $accessDeniedUrl;
  26. private $authenticators;
  27. private $switchUser;
  28. public function __construct(string $name, string $userChecker, ?string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, ?string $provider = null, ?string $context = null, ?string $entryPoint = null, ?string $accessDeniedHandler = null, ?string $accessDeniedUrl = null, array $authenticators = [], ?array $switchUser = null)
  29. {
  30. $this->name = $name;
  31. $this->userChecker = $userChecker;
  32. $this->requestMatcher = $requestMatcher;
  33. $this->securityEnabled = $securityEnabled;
  34. $this->stateless = $stateless;
  35. $this->provider = $provider;
  36. $this->context = $context;
  37. $this->entryPoint = $entryPoint;
  38. $this->accessDeniedHandler = $accessDeniedHandler;
  39. $this->accessDeniedUrl = $accessDeniedUrl;
  40. $this->authenticators = $authenticators;
  41. $this->switchUser = $switchUser;
  42. }
  43. public function getName(): string
  44. {
  45. return $this->name;
  46. }
  47. /**
  48. * @return string|null The request matcher service id or null if neither the request matcher, pattern or host
  49. * options were provided
  50. */
  51. public function getRequestMatcher(): ?string
  52. {
  53. return $this->requestMatcher;
  54. }
  55. public function isSecurityEnabled(): bool
  56. {
  57. return $this->securityEnabled;
  58. }
  59. /**
  60. * @deprecated since Symfony 5.4
  61. */
  62. public function allowsAnonymous(): bool
  63. {
  64. trigger_deprecation('symfony/security-bundle', '5.4', 'The "%s()" method is deprecated.', __METHOD__);
  65. return \in_array('anonymous', $this->authenticators, true);
  66. }
  67. public function isStateless(): bool
  68. {
  69. return $this->stateless;
  70. }
  71. public function getProvider(): ?string
  72. {
  73. return $this->provider;
  74. }
  75. /**
  76. * @return string|null The context key (will be null if the firewall is stateless)
  77. */
  78. public function getContext(): ?string
  79. {
  80. return $this->context;
  81. }
  82. public function getEntryPoint(): ?string
  83. {
  84. return $this->entryPoint;
  85. }
  86. public function getUserChecker(): string
  87. {
  88. return $this->userChecker;
  89. }
  90. public function getAccessDeniedHandler(): ?string
  91. {
  92. return $this->accessDeniedHandler;
  93. }
  94. public function getAccessDeniedUrl(): ?string
  95. {
  96. return $this->accessDeniedUrl;
  97. }
  98. /**
  99. * @deprecated since Symfony 5.4, use {@see getAuthenticators()} instead
  100. */
  101. public function getListeners(): array
  102. {
  103. trigger_deprecation('symfony/security-bundle', '5.4', 'Method "%s()" is deprecated, use "%s::getAuthenticators()" instead.', __METHOD__, __CLASS__);
  104. return $this->getAuthenticators();
  105. }
  106. public function getAuthenticators(): array
  107. {
  108. return $this->authenticators;
  109. }
  110. public function getSwitchUser(): ?array
  111. {
  112. return $this->switchUser;
  113. }
  114. }