public function authenticate(TokenInterface $authenticationToken)
    {
        parent::authenticate($authenticationToken);
        if (!$authenticationToken->getAuthenticationStatus() === TokenInterface::AUTHENTICATION_SUCCESSFUL) {
            return;
        }

        // Force set isAuthenticated to true on authentication manager to update roles needed for entity privileges
        ObjectAccess::setProperty($this->authenticationManager, 'isAuthenticated', true, true);

        $domain = $this->domainRepository->findOneByActiveRequest();
        if ($domain === null) {
            if (!$this->securityContext->hasRole('Neos.Neos:Administrator')) {
                $this->securityLogger->log('No domain found and user has not assigned "Neos.Neos:Administrator", rolling back.', LOG_DEBUG);
                $this->rollback($authenticationToken);
            }
            return;
        }

        $site = $domain->getSite();
        try {
            $site->getName();
            // Site access allowed, continue
        } catch (EntityNotFoundException $e) {
            $this->securityLogger->log('Domain found but user has no access to site, rolling back.', LOG_DEBUG);
            $this->rollback($authenticationToken);
        }
    }
public function authenticate(TokenInterface $authenticationToken)
    {
        parent::authenticate($authenticationToken);
        if (!$authenticationToken->getAuthenticationStatus() === TokenInterface::AUTHENTICATION_SUCCESSFUL) {
            return;
        }

        // Force set isAuthenticated to true on authentication manager to update roles needed for entity privileges
        ObjectAccess::setProperty($this->authenticationManager, 'isAuthenticated', true, true);

        $domain = $this->domainRepository->findOneByActiveRequest();
        if ($domain === null) {
            if (!$this->securityContext->hasRole('Neos.Neos:Administrator')) {
                $this->securityLogger->log('No domain found and user has not assigned "Neos.Neos:Administrator", rolling back.', LOG_DEBUG);
                $this->rollback($authenticationToken);
            }
            return;
        }

        $site = $domain->getSite();
        try {
            $site->getName();
            // Site access allowed, continue
        } catch (EntityNotFoundException $e) {
            $this->securityLogger->log('Domain found but user has no access to site, rolling back.', LOG_DEBUG);
            $this->rollback($authenticationToken);
        }
    }
public function authenticate ( TokenInterface $ authenticationToken ) { parent :: authenticate ( $ authenticationToken ) ; if ( ! $ authenticationToken -> getAuthenticationStatus ( ) === TokenInterface :: AUTHENTICATION_SUCCESSFUL ) { return ; } // Force set isAuthenticated to true on authentication manager to update roles needed for entity privileges ObjectAccess :: setProperty ( $ this -> authenticationManager , 'isAuthenticated' , true , true ) ; $ domain = $ this -> domainRepository -> findOneByActiveRequest ( ) ; if ( $ domain === null ) { if ( ! $ this -> securityContext -> hasRole ( 'Neos.Neos:Administrator' ) ) { $ this -> securityLogger -> log ( 'No domain found and user has not assigned "Neos.Neos:Administrator", rolling back.' , LOG_DEBUG ) ; $ this -> rollback ( $ authenticationToken ) ; } return ; } $ site = $ domain -> getSite ( ) ; try { $ site -> getName ( ) ; // Site access allowed, continue } catch ( EntityNotFoundException $ e ) { $ this -> securityLogger -> log ( 'Domain found but user has no access to site, rolling back.' , LOG_DEBUG ) ; $ this -> rollback ( $ authenticationToken ) ; } }
Checks if a user has access to a site by enabling entity privileges and checking if user has access to current
site.

@param TokenInterface $authenticationToken The token to be authenticated
@return void
Checks if a user has access to a site by enabling entity privileges and checking if user has access to current site .