Remove token from the store.

    :param opts: Salt master config options
    :param tok: Token to remove
    :returns: Empty dict if successful. None if failed.
542072
def rm_token(opts, tok):
    '''
    
    '''
    t_path = os.path.join(opts['token_dir'], tok)
    try:
        os.remove(t_path)
        return {}
    except (IOError, OSError):
        log.warning('Could not remove token %s', tok)
406417
def remove_token(self, *, payer_id, credit_card_token_id):
        
        payload = {
            "language": self.client.language.value,
            "command": PaymentCommand.REMOVE_TOKEN.value,
            "merchant": {
                "apiLogin": self.client.api_login,
                "apiKey": self.client.api_key
            },
            "removeCreditCardToken": {
                "payerId": payer_id,
                "creditCardTokenId": credit_card_token_id
            },
            "test": self.client.is_test
        }
        return self.client._post(self.url, json=payload)
907169
def pop(self, key=util_const.NoParam, default=util_const.NoParam):
        
        # Dictionary pop if key is specified
        if key is not util_const.NoParam:
            if default is util_const.NoParam:
                return (key, self._dict.pop(key))
            else:
                return (key, self._dict.pop(key, default))
        # Otherwise do a heap pop
        try:
            # Ammortized O(1)
            _heap = self._heap
            _dict = self._dict
            val, key = self._heappop(_heap)
            # Remove items marked for lazy deletion as they are encountered
            while key not in _dict or _dict[key] != val:
                val, key = self._heappop(_heap)
        except IndexError:
            if len(_heap) == 0:
                raise IndexError('queue is empty')
            else:
                raise
        del _dict[key]
        return key, val
931008
def delete_token(self):
        
        if self.token_path.exists():
            self.token_path.unlink()
            return True
        return False
245965
def kill(options):
    
    configuration = config.get_default()
    app_url = configuration['app_url']

    if options.deployment != None:
        deployment_name = options.deployment
    else:
        deployment_name = configuration['deployment_name']

    client_id = configuration['client_id']
    client_secret = configuration['client_secret']

    token_manager = auth.TokenManager(client_id=client_id,
                                      client_secret=client_secret,
                                      app_url=app_url)

    job_details = data_engine.get_job_details(options.job_id,
                                              deployment_name,
                                              token_manager=token_manager,
                                              app_url=app_url)

    options.format = 'table'

    if options.yes:
        decision = 'Y'
    else:
        _print_jobs([job_details], token_manager, app_url, options)
        decision = prompt('Are you sure you want to delete the above job? (Y/N)')

    if decision == 'Y':
        data_engine.delete_job(options.job_id.strip(),
                               deployment_name,
                               token_manager=token_manager,
                               app_url=app_url)

    else:
        raise JutException('Unexpected option "%s"' % decision)
259225
def salt_token_tool():
    '''
    
    '''
    x_auth = cherrypy.request.headers.get('X-Auth-Token', None)

    # X-Auth-Token header trumps session cookie
    if x_auth:
        cherrypy.request.cookie['session_id'] = x_auth
398888
def delete_token(self):
        
        try:
            self.doc_ref.delete()
        except Exception as e:
            log.error('Could not delete the token (key: {}): {}'.format(self.doc_id, str(e)))
            return False
        return True
1363263
def remove_key(self, store_key):
        
        if store_key in self._undefined_keys:
            del self._undefined_keys[store_key]
        if store_key in self._reverse_index:
            for value in self._reverse_index[store_key]:
                self._index[value].remove(store_key)
            del self._reverse_index[store_key]
489299
def revoke_refresh_token(self):
        

        if not self._refresh_token:
            return

        self.execute_post('authentication/revoke', json=dict(
            token_type_hint='refresh_token',
            token=self._refresh_token
        ))

        self._refresh_token = None
861111
def remove_domain_from_fqdn(opts, newid):
    '''
    
    '''
    opt_domain = opts.get('minion_id_remove_domain')
    if opt_domain is True:
        if '.' in newid:
            # Remove any domain
            newid, xdomain = newid.split('.', 1)
            log.debug('Removed any domain (%s) from minion id.', xdomain)
    else:
        # Must be string type
        if newid.upper().endswith('.' + opt_domain.upper()):
            # Remove single domain
            newid = newid[:-len('.' + opt_domain)]
            log.debug('Removed single domain %s from minion id.', opt_domain)
    return newid
1008675
def delete_metadata(address=None, tx_hash=None, block_hash=None, api_key=None, coin_symbol='btc'):
    '''
    
    '''
    assert is_valid_coin_symbol(coin_symbol), coin_symbol
    assert api_key, 'api_key required'

    kwarg = get_valid_metadata_identifier(
        coin_symbol=coin_symbol,
        address=address,
        tx_hash=tx_hash,
        block_hash=block_hash,
        )

    url = make_url(coin_symbol, meta=True, **kwarg)

    params = {'token': api_key}

    r = requests.delete(url, params=params, verify=True, timeout=TIMEOUT_IN_SECONDS)
    return get_valid_json(r, allow_204=True)
998633
def revoke_access(self):
        
        if self.token is None:
            return True
        #Don't try to revoke if token is invalid anyway, will cause an error response anyway.
        if self.validate():
            data = {}
            data['token'] = self.token['access_token']
            self.request().post(self.revoke_url, data=data, json=None,verify=self.verifySSL)
        return True
512067
def toggle(self, token: str) -> None:
        
        self._validate_token(token)
        if token in self:
            self.remove(token)
        else:
            self.add(token)
1080317
function (opts, cb) {
      var self = this
      opts = opts || {}
      var root = opts.root || RootKey
      mq.del(root, function (err, doc) {
        if (err) {
          cb(err, ERR.config.FA_DEL_CONFIG)
        } else {
          self.emit('delRoot', opts)
          cb(null, true)
        }
      })
    }
1083888
def delete_key(self,
                    match=None,
                    match_dict=None,
                    preserve_minions=None,
                    revoke_auth=False):
        '''
        
        '''
        if match is not None:
            matches = self.name_match(match)
        elif match_dict is not None and isinstance(match_dict, dict):
            matches = match_dict
        else:
            matches = {}
        for status, keys in six.iteritems(matches):
            for key in keys:
                try:
                    if revoke_auth:
                        if self.opts.get('rotate_aes_key') is False:
                            print('Immediate auth revocation specified but AES key rotation not allowed. '
                                     'Minion will not be disconnected until the master AES key is rotated.')
                        else:
                            try:
                                client = salt.client.get_local_client(mopts=self.opts)
                                client.cmd_async(key, 'saltutil.revoke_auth')
                            except salt.exceptions.SaltClientError:
                                print('Cannot contact Salt master. '
                                      'Connection for {0} will remain up until '
                                      'master AES key is rotated or auth is revoked '
                                      'with \'saltutil.revoke_auth\'.'.format(key))
                    os.remove(os.path.join(self.opts['pki_dir'], status, key))
                    eload = {'result': True,
                             'act': 'delete',
                             'id': key}
                    self.event.fire_event(eload,
                                          salt.utils.event.tagify(prefix='key'))
                except (OSError, IOError):
                    pass
        if self.opts.get('preserve_minions') is True:
            self.check_minion_cache(preserve_minions=matches.get('minions', []))
        else:
            self.check_minion_cache()
        if self.opts.get('rotate_aes_key'):
            salt.crypt.dropfile(self.opts['cachedir'], self.opts['user'])
        return (
            self.name_match(match) if match is not None
            else self.dict_match(matches)
        )
273664
def detokenize(self, inputs, delim=' '):
        
        detok = delim.join([self.idx2tok[idx] for idx in inputs])
        detok = detok.replace(self.separator + ' ', '')
        detok = detok.replace(self.separator, '')

        detok = detok.replace(config.BOS_TOKEN, '')
        detok = detok.replace(config.EOS_TOKEN, '')
        detok = detok.replace(config.PAD_TOKEN, '')
        detok = detok.strip()
        return detok
998859
def flush(bank, key=None):
    '''
    
    '''
    if key is None:
        c_key = bank
    else:
        c_key = '{0}/{1}'.format(bank, key)
    try:
        return api.kv.delete(c_key, recurse=key is None)
    except Exception as exc:
        raise SaltCacheError(
            'There was an error removing the key, {0}: {1}'.format(
                c_key, exc
            )
        )