Processes the logout request.

@param request
The current request.
@param response
The current response.
@return Return {@link Filter#STOP}.
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;
    }
713323
def logout(request):
    
    auth_logout(request)
    info(request, _("Successfully logged out"))
    return redirect(next_url(request) or get_script_prefix())
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()
907915
@GET
  @Path("logout")
  public Response logout() throws URISyntaxException {
    return Response
        .temporaryRedirect(new URI("/"))
        .cookie(createCookie(null, 0))
        .build();
  }
786524
public PauseSessionResponse pauseSession(PauseSessionRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
                request.getSessionId());
        internalRequest.addParameter(PAUSE, null);
        return invokeHttpClient(internalRequest, PauseSessionResponse.class);
    }
843694
@SneakyThrows
    public Event terminate(final RequestContext context) {
        val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
        val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);

        val tgtId = getTicketGrantingTicket(context);
        if (StringUtils.isNotBlank(tgtId)) {
            LOGGER.trace("Destroying SSO session linked to ticket-granting ticket [{}]", tgtId);
            val logoutRequests = this.centralAuthenticationService.destroyTicketGrantingTicket(tgtId);
            WebUtils.putLogoutRequests(context, logoutRequests);
        }
        LOGGER.trace("Removing CAS cookies");
        this.ticketGrantingTicketCookieGenerator.removeCookie(response);
        this.warnCookieGenerator.removeCookie(response);

        destroyApplicationSession(request, response);
        LOGGER.debug("Terminated all CAS sessions successfully.");

        if (StringUtils.isNotBlank(logoutProperties.getRedirectUrl())) {
            WebUtils.putLogoutRedirectUrl(context, logoutProperties.getRedirectUrl());
            return this.eventFactorySupport.event(this, CasWebflowConstants.STATE_ID_REDIRECT);
        }

        return this.eventFactorySupport.success(this);
    }
855345
@Override
    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain) throws IOException, ServletException {

        ServletRequest req = getRequest(request);

        ServletResponse resp = getResponse(request, response);

        request.setAttribute(PROCESSED_ATTR, Boolean.TRUE);

        chain.doFilter(req, resp);

        if (resp instanceof CompressedHttpServletResponseWrapper) {

            CompressedHttpServletResponseWrapper compressedResponseWrapper = (CompressedHttpServletResponseWrapper) resp;

            try {

                compressedResponseWrapper.close();  //so that stream is finished and closed.

            } catch (IOException ex) {

                LOGGER.error("Response was already closed: ", ex.toString());

            }

            if (compressedResponseWrapper.isCompressed()) {

                req.setAttribute(COMPRESSED_ATTR, Boolean.TRUE);

            }

        }

    }
1317296
public base_response logout() throws Exception
	{
		base_response result = null;
		logout logout = new logout();
		result = logout.perform_operation(this);
        sessionid = null;
        user_name = null;
        password = null;
		return result;
	}
486805
public CompletableFuture<ExecuteResponse> execute(ExecuteRequest request) {
    logRequest(request);
    return CompletableFuture.completedFuture(logResponse(ExecuteResponse.error()));
  }
1243684
protected static boolean isLogoutRequestConfirmed(final RequestContext requestContext) {
        val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
        return request.getParameterMap().containsKey(REQUEST_PARAM_LOGOUT_REQUEST_CONFIRMED);
    }
1296509
def _logout_request(self, url_logout):
        

        requests.post(url_logout,
                      headers=self._req_headers,
                      timeout=self.timeout_resp, verify=False)
966157
protected String checkLogOut(final HttpServletRequest request,
                               final UtilActionForm form)
               throws Throwable {
    final String reqUser = request.getRemoteUser();

    final boolean forceLogout =
            !Util.equalsString(reqUser, form.getCurrentUser());

    final String temp = request.getParameter(requestLogout);


    if (forceLogout || (temp != null)) {
      final HttpSession sess = request.getSession(false);

      if ((sess != null) && logOutCleanup(request, form)) {
        sess.invalidate();
      }
      return forwardLoggedOut;
    }

    return null;
  }
49741
protected <T> Response<T> doGet(Request<T> request) {
		URI uri = buidURI(request);
		
		Timer timer = Timer.tic();
		TransportResult result = getApiClientTransportFactory().newTransport(api).doGet(uri);
		timer.toc();
		
		log.trace(result.getStatusCode() + " " + uri.toString() + " took " + timer.getDifference() + "ms");

		Response<T> response = toResponse(timer, result, request);

		return response;
	}
313101
public LogoutRequest newLogoutRequest(final String id, final DateTime issueInstant,
                                          final String destination, final Issuer issuer,
                                          final String sessionIndex, final NameID nameId) {
        val request = newSamlObject(LogoutRequest.class);
        request.setID(id);
        request.setVersion(SAMLVersion.VERSION_20);
        request.setIssueInstant(issueInstant);
        request.setIssuer(issuer);
        request.setDestination(destination);

        if (StringUtils.isNotBlank(sessionIndex)) {
            val sessionIdx = newSamlObject(SessionIndex.class);
            sessionIdx.setSessionIndex(sessionIndex);
            request.getSessionIndexes().add(sessionIdx);
        }

        if (nameId != null) {
            request.setNameID(nameId);
        }
        return request;
    }
787944
public void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain filterChain)
    throws IOException, ServletException {
        if (logger.isDebugEnabled()) {
            logger.debug("Entering FilterRestApiFlash.doThisSubclass()");
        }

        HttpServletRequest httpRequest = (HttpServletRequest)request;
        HttpServletResponse httpResponse = (HttpServletResponse)response;
        String queryString = httpRequest.getQueryString();
        if(queryString != null &&
           queryString.contains("flash=true")) {
            StatusHttpServletResponseWrapper sHttpResponse =
                new StatusHttpServletResponseWrapper(httpResponse);

            filterChain.doFilter(request, sHttpResponse);

            if(sHttpResponse.status != sHttpResponse.realStatus) {
                // Append the error indicator with real status
                try {
                    ServletOutputStream out = sHttpResponse.getOutputStream();
                    out.print("::ERROR("+sHttpResponse.realStatus+")");
                } catch(IllegalStateException ise) {
                    PrintWriter out = sHttpResponse.getWriter();
                    out.print("::ERROR("+sHttpResponse.realStatus+")");
                }
            }
        } else {
            filterChain.doFilter(request, response);
        }
    }
444256
public DeleteDomainResponse deleteDomain(DeleteDomainRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        InternalRequest internalRequest = createRequest(request, HttpMethodName.DELETE, DOMAIN, request.getDomain());
        return invokeHttpClient(internalRequest, DeleteDomainResponse.class);
    }
1338463
@RequestMapping
    public void doLogout(HttpServletRequest request, HttpServletResponse response)
            throws IOException {

        String redirect = this.selectRedirectionUrl(request);
        final HttpSession session = request.getSession(false);

        if (session != null) {
            // Record that an authenticated user is requesting to log out
            try {
                final IPerson person = personManager.getPerson(request);
                if (person != null && person.getSecurityContext().isAuthenticated()) {
                    this.portalEventFactory.publishLogoutEvent(request, this, person);
                }
            } catch (final Exception e) {
                logger.error(
                        "Exception recording logout " + "associated with request " + request, e);
            }

            final String originalUid = this.identitySwapperManager.getOriginalUsername(session);
            // Logging out from a swapped user, just redirect to the Login servlet
            if (originalUid != null) {
                redirect = request.getContextPath() + "/Login";
            } else {
                // Clear out the existing session for the user
                try {
                    session.invalidate();
                } catch (final IllegalStateException ise) {
                    // IllegalStateException indicates session was already invalidated.
                    // This is fine.  LogoutController is looking to guarantee the logged out
                    // session is invalid;
                    // it need not insist that it be the one to perform the invalidating.
                    if (logger.isTraceEnabled()) {
                        logger.trace(
                                "LogoutController encountered IllegalStateException invalidating a presumably already-invalidated session.",
                                ise);
                    }
                }
            }
        }

        if (logger.isTraceEnabled()) {
            logger.trace(
                    "Redirecting to " + redirect + " to send the user back to the guest page.");
        }

        final String encodedRedirectURL = response.encodeRedirectURL(redirect);
        response.sendRedirect(encodedRedirectURL);
    }