public function isCsrfProtectionTokenValid($csrfToken)
    {
        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $csrfProtectionTokens = $sessionDataContainer->getCsrfProtectionTokens();

        if (!isset($csrfProtectionTokens[$csrfToken]) && !isset($this->csrfTokensRemovedAfterCurrentRequest[$csrfToken])) {
            return false;
        }

        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_URI) {
            unset($csrfProtectionTokens[$csrfToken]);
        }

        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_REQUEST) {
            $this->csrfTokensRemovedAfterCurrentRequest[$csrfToken] = true;
            unset($csrfProtectionTokens[$csrfToken]);
        }

        $sessionDataContainer->setCsrfProtectionTokens($csrfProtectionTokens);
        return true;
    }
public function isCsrfProtectionTokenValid($csrfToken)
    {
        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $csrfProtectionTokens = $sessionDataContainer->getCsrfProtectionTokens();

        if (!isset($csrfProtectionTokens[$csrfToken]) && !isset($this->csrfTokensRemovedAfterCurrentRequest[$csrfToken])) {
            return false;
        }

        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_URI) {
            unset($csrfProtectionTokens[$csrfToken]);
        }

        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_REQUEST) {
            $this->csrfTokensRemovedAfterCurrentRequest[$csrfToken] = true;
            unset($csrfProtectionTokens[$csrfToken]);
        }

        $sessionDataContainer->setCsrfProtectionTokens($csrfProtectionTokens);
        return true;
    }
public function isCsrfProtectionTokenValid ( $ csrfToken ) { $ sessionDataContainer = $ this -> objectManager -> get ( SessionDataContainer :: class ) ; $ csrfProtectionTokens = $ sessionDataContainer -> getCsrfProtectionTokens ( ) ; if ( ! isset ( $ csrfProtectionTokens [ $ csrfToken ] ) && ! isset ( $ this -> csrfTokensRemovedAfterCurrentRequest [ $ csrfToken ] ) ) { return false ; } if ( $ this -> csrfProtectionStrategy === self :: CSRF_ONE_PER_URI ) { unset ( $ csrfProtectionTokens [ $ csrfToken ] ) ; } if ( $ this -> csrfProtectionStrategy === self :: CSRF_ONE_PER_REQUEST ) { $ this -> csrfTokensRemovedAfterCurrentRequest [ $ csrfToken ] = true ; unset ( $ csrfProtectionTokens [ $ csrfToken ] ) ; } $ sessionDataContainer -> setCsrfProtectionTokens ( $ csrfProtectionTokens ) ; return true ; }
Returns true if the given string is a valid CSRF protection token. The token will be removed if the configured
csrf strategy is 'onePerUri'.

@param string $csrfToken The token string to be validated
@return boolean true, if the token is valid. false otherwise.
@throws Exception
Returns true if the given string is a valid CSRF protection token . The token will be removed if the configured csrf strategy is onePerUri .