private function initToken()
    {
        $tokenName = $this->getConfig()->get('Token', false);
        $rememberMe = $this->getConfig()->get('RememberMe', false);


        if (!$tokenName) {
            // fallback to the default token
            $securityKey = $this->getConfig()->get('TokenKey', false);

            if (!$securityKey) {
                throw new FirewallException('Missing TokenKey for "' . $this->getRealmName() . '" firewall.');
            }
        } else {
            $securityKey = Security::getConfig()->get('Tokens.' . $tokenName . '.SecurityKey', false);

            if (!$securityKey) {
                throw new FirewallException('Missing security key for "' . $tokenName . '" token.');
            }
        }

        $tokenCryptDriver = Security::getConfig()->get('Tokens.' . $tokenName . '.Driver', $this->defaultCryptDriver);
        $tokenCryptParams = Security::getConfig()->get('Tokens.' . $tokenName . '.Params', [], true);
        try {
            $tokenCrypt = $this->factory($tokenCryptDriver, $this->cryptDriverInterface, $tokenCryptParams);
        } catch (\Exception $e) {
            throw new FirewallException($e->getMessage());
        }

        $storageClass = Security::getConfig()->get('Tokens.' . $tokenName . '.StorageDriver');
        $this->token = new Token($this->getTokenName(), $rememberMe, $securityKey, $tokenCrypt, $storageClass);
    }