Removes the given token from the token cache.

This is only necessary if the 'preserveToken' parameter of the token's preset is true.
Otherwise tokens are deleted automatically.

@param Token $token
@return void
187212
public function invalidateToken(Token $token)
    {
        $this->tokenCache->remove($token->getHash());

        $this->logger->log(sprintf('Deleted token %s.', $token->getIdentifier()), LOG_INFO);
    }
1286320
public function addToken(Token $token)
    {
        $this->tokens[$this->getAppKey()][$token->getTokenUUID()->composeUUID()] = $token;
    }
909259
public function invalidate(Token $token)
    {
        if (! $this->blacklistEnabled) {
            throw new JWTException('You must have the blacklist enabled to invalidate a token.');
        }

        return $this->blacklist->add($this->decode($token));
    }
1198479
private function _checkProhibitedTokens($token) {
		if ($this->_isActive('checkProhibitedTokens')) {
			if (in_array($token->getName(), $this->_prohibitedTokens)) {
				$msg = $this->_getMessage("PROHIBITED_TOKEN", $token->getName());
				$this->_writeError('checkProhibitedTokens', $msg);
			}
		}
	}
956709
public function cleanUpUnassignedTokens(array $tokens)
    {
        $this->em->clear();
        foreach ($tokens as $token) {
            $token = $this->em->merge($token);
            $this->em->remove($token);
        }

        $this->em->flush();
    }
903728
public static function delete($token)
    {
        if (is_string($token)) {
            $token = self::read($token);
        }

        if (!($token instanceof \Token\Model\Entity\Token)) {
            return false;
        }

        return TableRegistry::get('Token.Tokens')->delete($token);
    }
270711
private function cleanup()
    {
        foreach ($this->tokens as $i => $t) {
            if ($t[0] === self::$deleteToken) {
                unset($this->tokens[$i]);
            }
        }
        $this->tokens = array_values($this->tokens);
    }
984326
public function clearSessionTokens()
    {
        $this->session->remove(self::SESSION_TOKEN_KEY);
        $this->session->remove(self::SESSION_TOKEN_SECRET_KEY);
    }
18813
public function offsetUnset( $offset )
	{
		if ( is_int( $offset ) ) {
			unset( $this->tokens[ $offset ] );
		}
		else {
			$this->remove( $offset );
		}
	}
1302955
public function remove(string ...$tokens)
    {
        if (count($tokens) === 0) {
            return;
        }
        if (count($this->tokens) === 0) {
            return;
        }
        foreach ($tokens as $t) {
            $i = array_search($t, $this->tokens);
            if ($i === false) {
                continue;
            }
            array_splice($this->tokens, $i, 1);
        }
        $this->setAttributeValue();
    }
1168591
public function reset($token=null, $data=null)
    {
        if ($this->options['shared']) {
            $data = static::formatData($data);
            $key2 = md5(serialize($data));
            
            static::getStorage()->remove($key2);
        }
        
        if ($token) {
            $key = trim($token);
            
            static::getStorage()->remove($key);
        }
    }
1018099
public function saveToken($token)
    {
        $rows = $this->_db->query(
            'UPDATE '.$this->_dbConfig['table']
                        .' SET '.$this->_dbConfig['token'].' = :tk'
                        .' WHERE '.$this->_dbConfig['id'].' = :id',
            [':tk'=>$token, ':id'=>$this->_data['id']]
        );
        if ($rows > 0) {
            $this->_data['token'] = $token;
            return true;
        }
        return false;
    }
776475
public function set($key, $token)
    {
        $this->instance->set($key, $token, $this->keyTtl);
    }
1290432
public function clearTokens() {
		$this->logger->log( LogLevel::DEBUG, 'Clearing session tokens', [ 'tokens' => $this->tokens ] );
		$this->tokens = [];
	}
468407
public function offsetUnset($offset)
    {
        unset($this->tokens[$offset]);
        --$this->count;
        for ($i = $offset; $i < $this->count; ++$i) {
            $this->tokens[$i] = $this->tokens[$i + 1];
        }
        unset($this->tokens[$this->count]);
    }
1368450
protected function _setToken($token)
    {
        //Prevents an empty value is serialized
        if (!$token) {
            return $token;
        }
        $token = is_string($token) ? $token : serialize($token);

        return substr(Security::hash($token, 'sha1', Configure::read('Tokens.tokenSalt')), 0, 25);
    }
268566
protected function store_token($token) {
        if (!$this->system) {
            parent::store_token($token);
            return;
        }

        $this->accesstoken = $token;

        // Create or update a DB record with the new token.
        $persistedtoken = access_token::get_record(['issuerid' => $this->issuer->get('id')]);
        if ($token !== null) {
            if (!$persistedtoken) {
                $persistedtoken = new access_token();
                $persistedtoken->set('issuerid', $this->issuer->get('id'));
            }
            // Update values from $token. Don't use from_record because that would skip validation.
            $persistedtoken->set('token', $token->token);
            if (isset($token->expires)) {
                $persistedtoken->set('expires', $token->expires);
            } else {
                // Assume an arbitrary time span of 1 week for access tokens without expiration.
                // The "refresh_system_tokens_task" is run hourly (by default), so the token probably won't last that long.
                $persistedtoken->set('expires', time() + WEEKSECS);
            }
            $persistedtoken->set('scope', $token->scope);
            $persistedtoken->save();
        } else {
            if ($persistedtoken) {
                $persistedtoken->delete();
            }
        }
    }