Logout the currently authenticated user.

@return a task that can be used to block until the user associated with this session has been logged out.
511748
public BoxFutureTask<BoxSession> logout() {
        final BoxFutureTask<BoxSession> task = (new BoxSessionLogoutRequest(this)).toTask();
        new Thread(){
            @Override
            public void run() {
                task.run();
            }
        }.start();

        return task;
    }
476784
public static function logout()
    {
        Session::forget(static::resource('session'));
        Cookie::forget(static::resource('cookie'));
        static::$user = null;

        return true;
    }
1328017
def logout(self):
        
        resp = super(CookieSession, self).request('DELETE', self._session_url)
        resp.raise_for_status()
224678
public void free()
    {
        if (m_mapTasks != null)
        {
            while (m_mapTasks.size() > 0)
            {
                for (Task task : m_mapTasks.keySet())
                {
                    if (task != null)
                    {
                    	int iCount = 0;
                        while (task.isRunning())  // This will also remove this from the list
                        {
                        	if (iCount++ == 10)
                        	{
                                Util.getLogger().warning("Shutting down a running task");   // Ignore and continue
                        		break;
                        	}
                        	try {
								Thread.sleep(100);
							} catch (InterruptedException e) {
								e.printStackTrace();
							}
                        }
                        this.removeTask(task);	// Make sure this doesn't free me (if all tasks are freed, app will be freed)
                        task.setApplication(null);
                        task.stopTask();
                    }
                    else
                    {
                        try {
                            RemoteTask remoteTask = m_mapTasks.remove(task);
                            if (remoteTask != null)
                                remoteTask.freeRemoteSession();
                        } catch (RemoteException ex)    {
                            ex.printStackTrace();
                        }
                    }
                    break;  // YES, This only loops through the FIRST one, because it is removed and I would get a concurrent mod error
                }
            }
        }
        m_mapTasks = null;
        if (m_PhysicalDatabaseParent instanceof Freeable)
        {
            ((Freeable)m_PhysicalDatabaseParent).free();
            m_PhysicalDatabaseParent = null;
        }
    }
429105
def logout():
    
    from uliweb import request

    delete_user_session()
    request.session.delete()
    request.user = None
    return True
1086881
def logout(self, all_session=False):
        
        # initialize the counter of the number of destroyed sesisons
        session_nb = 0
        # save the current user username before flushing the session
        username = self.request.session.get("username")
        if username:
            if all_session:
                logger.info("Logging out user %s from all sessions." % username)
            else:
                logger.info("Logging out user %s." % username)
        users = []
        # try to get the user from the current session
        try:
            users.append(
                models.User.objects.get(
                    username=username,
                    session_key=self.request.session.session_key
                )
            )
        except models.User.DoesNotExist:
            # if user not found in database, flush the session anyway
            self.request.session.flush()

        # If all_session is set, search all of the user sessions
        if all_session:
            users.extend(
                models.User.objects.filter(
                    username=username
                ).exclude(
                    session_key=self.request.session.session_key
                )
            )

        # Iterate over all user sessions that have to be logged out
        for user in users:
            # get the user session
            session = SessionStore(session_key=user.session_key)
            # flush the session
            session.flush()
            # send SLO requests
            user.logout(self.request)
            # delete the user
            user.delete()
            # increment the destroyed session counter
            session_nb += 1
        if username:
            logger.info("User %s logged out" % username)
        return session_nb
707605
def logout(request):
    '''
    
    '''
    user = request.user
    serializer = LogoutSerializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    data = serializer.validated_data

    if should_authenticate_session():
        auth.logout(request)
    if should_retrieve_token() and data['revoke_token']:
        try:
            user.auth_token.delete()
        except Token.DoesNotExist:
            raise BadRequest('Cannot remove non-existent token')

    return get_ok_response('Logout successful')
903257
public void logout() throws IOException {

        String loggedInUserName = getRequestContext().getCurrentUser().getName();
        HttpSession session = getRequest().getSession(false);
        if (session != null) {
            session.invalidate();
            /* we need this because a new session might be created after this method,
             but before the session info is updated in OpenCmsCore.showResource. */
            getCmsObject().getRequestContext().setUpdateSessionEnabled(false);
        }
        // logout was successful
        if (LOG.isInfoEnabled()) {
            LOG.info(
                Messages.get().getBundle().key(
                    Messages.LOG_LOGOUT_SUCCESFUL_3,
                    loggedInUserName,
                    getRequestContext().addSiteRoot(getRequestContext().getUri()),
                    getRequestContext().getRemoteAddress()));
        }
        getResponse().sendRedirect(getFormLink());
    }
180523
protected int logout(final Request request, final Response response)
    {
        // Clears the credentials
        request.setChallengeResponse(null);
        final CookieSetting credentialsCookie = this.getCredentialsCookie(request, response);
        credentialsCookie.setMaxAge(0);
        
        this.log.debug("calling attemptRedirect after logout");
        // Attempt to redirect
        this.attemptRedirect(request, response, null);
        
        return Filter.STOP;
    }
676782
public function logout() {
        global $SESSION;
        unset($SESSION->{$this->sess_tag});
        unset($SESSION->{$this->sess_text});
        unset($SESSION->{$this->sess_account});
        return $this->print_login();
    }
845475
@GET
    @Produces(MediaType.TEXT_PLAIN)
    @Description("Terminates a user session. Not needed for existing auth api. This is just a placeholder method.")
    @Path("/logout")
    public Response logout(@Context UriInfo uriInfo) {
    	 return Response.ok("You have logged out.").build();
    }
670607
public function logout()
	{
		$this->user = null;

		$this->session->forget();
		$this->cookie->forget();
	}
300197
public function logout()
    {
        try {
            $this->startBrokerSession();
            $this->setSessionData('sso_user', null);
        } catch (SSOServerException $e) {
            return $this->returnJson(['error' => $e->getMessage()]);
        }

        return $this->returnJson(['success' => 'User has been successfully logged out.']);
    }
908143
def logout(request):
    
    # Dispatch the signal before the user is logged out so the receivers have a
    # chance to find out *who* logged out.
    user = getattr(request, 'user', None)
    if hasattr(user, 'is_authenticated') and not user.is_authenticated:
        user = None
    user_logged_out.send(sender=user.__class__, request=request, user=user)

    # remember language choice saved to session
    language = request.session.get(LANGUAGE_SESSION_KEY)

    request.session.flush()

    if language is not None:
        request.session[LANGUAGE_SESSION_KEY] = language

    if hasattr(request, 'user'):
        request.user = MojAnonymousUser()
1153062
def task_remove_user(self, *args, **kwargs):
        
        if not self.cur_task:
            return
        i = self.task_user_tablev.currentIndex()
        item = i.internalPointer()
        if item:
            user = item.internal_data()
            self.cur_task.users.remove(user)
            item.set_parent(None)
921893
def logout
      handler = proc do
        if response.code == 204
          clear_session
        else
          case response.code
          when 401 then
            raise Jiralicious::NotLoggedIn, "Not logged in"
          else
            # Give Net::HTTP reason
            raise Jiralicious::JiraError, response
          end
        end
      end

      request(:delete, "/rest/auth/latest/session", handler: handler)
    end
1276751
public synchronized void logout(final BoxSession session) {
        BoxUser user = session.getUser();
        if (user == null) {
            return;
        }
        session.clearCache();

        Context context = session.getApplicationContext();
        String userId = user.getId();

        getAuthInfoMap(session.getApplicationContext());
        BoxAuthenticationInfo info = mCurrentAccessInfo.get(userId);
        Exception ex = null;
        try {
            BoxApiAuthentication api = new BoxApiAuthentication(session);
            BoxApiAuthentication.BoxRevokeAuthRequest request = api.revokeOAuth(info.refreshToken(), session.getClientId(), session.getClientSecret());
            request.send();

        } catch (Exception e) {
            ex = e;
            BoxLogUtils.e(TAG, "logout", e);
            // Do nothing as we want to continue wiping auth info
        }
        mCurrentAccessInfo.remove(userId);

        String lastUserId = authStorage.getLastAuthentictedUserId(context);
        if (lastUserId != null) {
            authStorage.storeLastAuthenticatedUserId(null, context);
        }

        authStorage.storeAuthInfoMap(mCurrentAccessInfo, context);
        onLoggedOut(info, ex);
        info.wipeOutAuth();
    }