public function getCsrfProtectionToken()
    {
        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $csrfProtectionTokens = $sessionDataContainer->getCsrfProtectionTokens();
        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_SESSION && count($csrfProtectionTokens) === 1) {
            reset($csrfProtectionTokens);
            return key($csrfProtectionTokens);
        }

        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_REQUEST) {
            if (empty($this->requestCsrfToken)) {
                $this->requestCsrfToken = Algorithms::generateRandomToken(16);
                $csrfProtectionTokens[$this->requestCsrfToken] = true;
                $sessionDataContainer->setCsrfProtectionTokens($csrfProtectionTokens);
            }

            return $this->requestCsrfToken;
        }

        $newToken = Algorithms::generateRandomToken(16);
        $csrfProtectionTokens[$newToken] = true;
        $sessionDataContainer->setCsrfProtectionTokens($csrfProtectionTokens);

        return $newToken;
    }
public function getCsrfProtectionToken()
    {
        $sessionDataContainer = $this->objectManager->get(SessionDataContainer::class);
        $csrfProtectionTokens = $sessionDataContainer->getCsrfProtectionTokens();
        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_SESSION && count($csrfProtectionTokens) === 1) {
            reset($csrfProtectionTokens);
            return key($csrfProtectionTokens);
        }

        if ($this->csrfProtectionStrategy === self::CSRF_ONE_PER_REQUEST) {
            if (empty($this->requestCsrfToken)) {
                $this->requestCsrfToken = Algorithms::generateRandomToken(16);
                $csrfProtectionTokens[$this->requestCsrfToken] = true;
                $sessionDataContainer->setCsrfProtectionTokens($csrfProtectionTokens);
            }

            return $this->requestCsrfToken;
        }

        $newToken = Algorithms::generateRandomToken(16);
        $csrfProtectionTokens[$newToken] = true;
        $sessionDataContainer->setCsrfProtectionTokens($csrfProtectionTokens);

        return $newToken;
    }
public function getCsrfProtectionToken ( ) { $ sessionDataContainer = $ this -> objectManager -> get ( SessionDataContainer :: class ) ; $ csrfProtectionTokens = $ sessionDataContainer -> getCsrfProtectionTokens ( ) ; if ( $ this -> csrfProtectionStrategy === self :: CSRF_ONE_PER_SESSION && count ( $ csrfProtectionTokens ) === 1 ) { reset ( $ csrfProtectionTokens ) ; return key ( $ csrfProtectionTokens ) ; } if ( $ this -> csrfProtectionStrategy === self :: CSRF_ONE_PER_REQUEST ) { if ( empty ( $ this -> requestCsrfToken ) ) { $ this -> requestCsrfToken = Algorithms :: generateRandomToken ( 16 ) ; $ csrfProtectionTokens [ $ this -> requestCsrfToken ] = true ; $ sessionDataContainer -> setCsrfProtectionTokens ( $ csrfProtectionTokens ) ; } return $ this -> requestCsrfToken ; } $ newToken = Algorithms :: generateRandomToken ( 16 ) ; $ csrfProtectionTokens [ $ newToken ] = true ; $ sessionDataContainer -> setCsrfProtectionTokens ( $ csrfProtectionTokens ) ; return $ newToken ; }
Returns the current CSRF protection token. A new one is created when needed, depending on the  configured CSRF
protection strategy.

@return string
@Flow\Session(autoStart=true)
Returns the current CSRF protection token . A new one is created when needed depending on the configured CSRF protection strategy .