"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core-bundle/src/Security/Authentication/Token/TokenChecker.php" between
contao-4.9.11.tar.gz and contao-4.9.12.tar.gz

About: Contao (fka TYPOlight) is a content management system (CMS). Long-term support (LTS).

TokenChecker.php  (contao-4.9.11):TokenChecker.php  (contao-4.9.12)
skipping to change at line 63 skipping to change at line 63
* @var AuthenticationTrustResolverInterface * @var AuthenticationTrustResolverInterface
*/ */
private $trustResolver; private $trustResolver;
/** /**
* @var VoterInterface * @var VoterInterface
*/ */
private $roleVoter; private $roleVoter;
/** /**
* @var string
*/
private $previewScript;
/**
* @internal Do not inherit from this class; decorate the "contao.security.t oken_checker" service instead * @internal Do not inherit from this class; decorate the "contao.security.t oken_checker" service instead
*/ */
public function __construct(RequestStack $requestStack, FirewallMapInterface $firewallMap, TokenStorageInterface $tokenStorage, SessionInterface $session, A uthenticationTrustResolverInterface $trustResolver, VoterInterface $roleVoter, s tring $previewScript = '') public function __construct(RequestStack $requestStack, FirewallMapInterface $firewallMap, TokenStorageInterface $tokenStorage, SessionInterface $session, A uthenticationTrustResolverInterface $trustResolver, VoterInterface $roleVoter)
{ {
$this->requestStack = $requestStack; $this->requestStack = $requestStack;
$this->firewallMap = $firewallMap; $this->firewallMap = $firewallMap;
$this->tokenStorage = $tokenStorage; $this->tokenStorage = $tokenStorage;
$this->session = $session; $this->session = $session;
$this->trustResolver = $trustResolver; $this->trustResolver = $trustResolver;
$this->roleVoter = $roleVoter; $this->roleVoter = $roleVoter;
$this->previewScript = $previewScript;
} }
/** /**
* Checks if a front end user is authenticated. * Checks if a front end user is authenticated.
*/ */
public function hasFrontendUser(): bool public function hasFrontendUser(): bool
{ {
$token = $this->getToken(self::FRONTEND_FIREWALL); $token = $this->getToken(self::FRONTEND_FIREWALL);
return null !== $token && VoterInterface::ACCESS_GRANTED === $this->role Voter->vote($token, null, ['ROLE_MEMBER']); return null !== $token && VoterInterface::ACCESS_GRANTED === $this->role Voter->vote($token, null, ['ROLE_MEMBER']);
skipping to change at line 136 skipping to change at line 130
return $token->getUser()->getUsername(); return $token->getUser()->getUsername();
} }
/** /**
* Tells whether the front end preview can show unpublished fragments. * Tells whether the front end preview can show unpublished fragments.
*/ */
public function isPreviewMode(): bool public function isPreviewMode(): bool
{ {
$request = $this->requestStack->getMasterRequest(); $request = $this->requestStack->getMasterRequest();
if (null === $request || $request->getScriptName() !== $this->previewScr ipt) { if (null === $request || !$request->attributes->get('_preview', false)) {
return false; return false;
} }
$token = $this->getToken(self::FRONTEND_FIREWALL); $token = $this->getToken(self::FRONTEND_FIREWALL);
return $token instanceof FrontendPreviewToken && $token->showUnpublished (); return $token instanceof FrontendPreviewToken && $token->showUnpublished ();
} }
private function getToken(string $context): ?TokenInterface private function getToken(string $context): ?TokenInterface
{ {
 End of changes. 4 change blocks. 
8 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)