Destroy a token. Username is required as we use it to search through
tokens.

@param {String} username
@param {String} token
@param {Function} done - done(err)
425272
function deleteToken(username, token, done) {
  return tokenExists(username, token, function(existsErr, tokenObj) {
    if (existsErr) {
      return done(existsErr);
    }

    if (!tokenObj) {
      return done(new Error(`token '${token}' not found`));
    }

    return tokenObj.destroy(done);
  });
}
590506
function (auth, request, done) {
        var header,
            params = auth.get(AUTH_PARAMETERS),
            url = urlEncoder.toNodeUrl(request.url.toString(true));

        if (!params.username || !params.realm) {
            return done(); // Nothing to do if required parameters are not present.
        }

        request.removeHeader(AUTHORIZATION, {ignoreCase: true});

        params.method = request.method;
        params.uri = url.path;
        params.body = request.body && request.body.toString();

        try {
            header = this.computeHeader(params);
        }
        catch (e) { return done(e); }

        request.addHeader({
            key: AUTHORIZATION,
            value: header,
            system: true
        });

        return done();
    }
780936
public function deleteToken(Token $token)
    {
        $this->db
            ->delete('ucms_user_token')
            ->condition('uid', $token->uid)
            ->execute();
    }
447528
def delete_token():
    '''
        
    '''
    username = get_admin()[0]
    admins = get_couchdb_admins()

    # Delete current admin if exist
    if username in admins:
        print 'I delete {} CouchDB user'.format(username)
        delete_couchdb_admin(username)

    # Delete token file if exist
    if os.path.isfile(LOGIN_FILENAME):
        print 'I delete {} token file'.format(LOGIN_FILENAME)
        os.remove(LOGIN_FILENAME)
218929
final public static function deleteOtpToken (string $username)
	{
		if ($username == $_SESSION['username']) {
			$tokenValue 				= NULL;
			$tokenTime 					= NULL;
			$_SESSION['otp_token'] 		= NULL;
			$_SESSION['otp_token_time'] = NULL;
		}
		return self::setUserOtpToken($username, $tokenValue);
	}
545919
function deleteUser(options) {
            return models.Base.transaction((t) => {
                options.transacting = t;

                return Promise.all([
                    models.Accesstoken.destroyByUser(options),
                    models.Refreshtoken.destroyByUser(options),
                    models.Post.destroyByAuthor(options)
                ]).then(() => {
                    return models.User.destroy(options);
                }).return(null);
            }).catch((err) => {
                return Promise.reject(new common.errors.NoPermissionError({
                    err: err
                }));
            });
        }
246954
def del_user(self, username):
        
        self._check_fix_users(username)
        try:
            del self.users[username]
        except Exception as e:
            raise UserDoesntExist(username, self.backend_name)
188564
public void clearSingleSignOn(String username)
    {
        synchronized(_ssoId2Principal)
        {
            Object ssoID=_ssoUsername2Id.remove(username);
            Object principal=_ssoId2Principal.remove(ssoID);
            _ssoPrincipal2Credential.remove(principal);
        }        
    }
642757
public function validateForgotPasswordToken($username, $token)
    {
        $this->username = $username;

        if ($this->getMeta()->forgotPasswordToken == $token) {
            $this->getMeta()->forgotPasswordToken = '';
            $this->getMeta()->save();

            return true;
        }

        return false;
    }
228036
protected void cleanupSessionToken(String token) {
		// Empty check
		if (sessions.isEmpty()) {
			return;
		}

		if (log.isDebugEnabled()) {
			log.debug("Removing duplicates and cleaning up sessions for site - token: " + site + " - "
					+ token);
		}

		synchronized (this.sessions) {
			// If there are no more session tokens, delete all sessions
			HttpSessionTokensSet siteTokensSet = extension.getHttpSessionTokensSet(site);
			if (siteTokensSet == null) {
				log.info("No more session tokens. Removing all sessions...");
				// Invalidate all sessions
				for (HttpSession session : this.sessions) {
					session.invalidate();
				}
	
				// Remove all sessions
				this.sessions.clear();
				this.activeSession = null;
				this.model.removeAllElements();
				return;
			}
	
			// Iterate through all the sessions, eliminate the given token and eliminate any duplicates
			Map<String, HttpSession> uniqueSession = new HashMap<>(sessions.size());
			List<HttpSession> toDelete = new LinkedList<>();
			for (HttpSession session : this.sessions) {
				// Eliminate the token
				session.removeToken(token);
				if (session.getTokenValuesCount() == 0 && !session.isActive()) {
					toDelete.add(session);
					continue;
				} else {
					model.fireHttpSessionUpdated(session);
				}
	
				// If there is already a session with these tokens, mark one of them for deletion
				if (uniqueSession.containsKey(session.getTokenValuesString())) {
					HttpSession prevSession = uniqueSession.get(session.getTokenValuesString());
					// If the latter session is active, put it into the map and delete the other
					if (session.isActive()) {
						toDelete.add(prevSession);
						session.setMessagesMatched(session.getMessagesMatched()
								+ prevSession.getMessagesMatched());
					} else {
						toDelete.add(session);
						prevSession.setMessagesMatched(session.getMessagesMatched()
								+ prevSession.getMessagesMatched());
					}
				}
				// If it's the first one with these token values, keep it
				else {
					uniqueSession.put(session.getTokenValuesString(), session);
				}
			}
	
			// Delete the duplicate sessions
			if (log.isInfoEnabled()) {
				log.info("Removing duplicate or empty sessions: " + toDelete);
			}
			Iterator<HttpSession> it = toDelete.iterator();
			while (it.hasNext()) {
				HttpSession ses = it.next();
				ses.invalidate();
				sessions.remove(ses);
				model.removeHttpSession(ses);
			}
		}
	}
1281969
def delete_user(ctx, yes):
    """"""

    if ctx.obj['username'] is None:
        username = _ask("Please enter username:")
    else:
        username = ctx.obj['username']

    del_user = ctx.obj['db'].objectmodels['user'].find_one({'name': username})
    if yes or _ask('Confirm deletion', default=False, data_type='bool'):
        try:
            del_user.delete()
            log("Done")
        except AttributeError:
            log('User not found', lvl=warn)
    else:
        log("Cancelled")
27898
function destroy(req, res, next) {
  db.users.del(req.params.user, function(err) {
    if(err) { return next(err); }
    res.json(null);
  });
}
708288
def _delete_account(self, username):
        

        # account deleted

        ds_user = self.get_user(username)
        if ds_user is not None:
            self._call(["delete", "user", "name=%s" % username])

        return
1102464
@Delete("/tokens/{appId}")
    public CompletableFuture<Token> deleteToken(ServiceRequestContext ctx,
                                                @Param("appId") String appId,
                                                Author author, User loginUser) {
        return getTokenOrRespondForbidden(ctx, appId, loginUser).thenCompose(
                token -> mds.destroyToken(author, appId)
                            .thenApply(unused -> token.withoutSecret()));
    }
703858
def del_token(token):
    '''
    
    '''
    token_path = os.path.join(__opts__['token_dir'], token)
    if os.path.exists(token_path):
        return os.remove(token_path) is None
    return False
20679
function remove(user, callback) {
      var cb = callback || angular.noop;

      return User.remove({id: user._id},
        function (user) {
          return cb(user);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
282942
function removeEvent( token ) {
		if ( token.element.removeEventListener ) {
			token.element.removeEventListener( token.event, token.handler );
		} else {
			token.element.detachEvent( 'on' + token.event, token.handler );
		}
	}