/*
Controller for API token based logout only.
Standard logout occurs via firewall logout configuration.
332653
public function write(Request $request, Application $app)
    {
        $token = $this->tokenStorage->getToken();

        $this->userManager->logoutUser($token->getUser());

        return [LogoutSuccessView::class];
    }
1330181
@Override
    public void createLogoutCookies(HttpServletRequest req, HttpServletResponse res) {
        createLogoutCookies(req, res, true);
    }
792551
public function logout() {
		$allConfiguration = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow');
		$tokens = $this->securityContext->getAuthenticationTokensOfType('Flowpack\SingleSignOn\Client\Security\SingleSignOnToken');
		foreach ($tokens as $token) {
			$providerName = $token->getAuthenticationProviderName();
			$serverIdentifier = \TYPO3\Flow\Utility\Arrays::getValueByPath($allConfiguration, 'security.authentication.providers.' . $providerName . '.providerOptions.server');
			if ($serverIdentifier !== NULL) {
				$ssoClient = $this->ssoClientFactory->create();
				$ssoServer = $this->ssoServerFactory->create($serverIdentifier);
				$ssoServer->destroySession($ssoClient, $token->getGlobalSessionId());
			}
		}
	}
190074
public function logout()
    {
        // Token from Clef.io
        if (isset($_POST['logout_token'])) {
            // Verif token
            $clef = \Aperdia\Clef::logout($_POST['logout_token']);

            if (!$clef) {
                // Verif in Authentication table
                $auth = Authentication::whereprovider("clef")->whereprovider_uid($clef)->first();

                if (!empty($auth)) {
                    $user = User::find($auth->user_id);

                    if (!empty($user)) {
                        $user->logout = 1;
                        $user->save();
                    }
                }
            }
        }
    }
762758
def oauth_logout_handler(sender_app, user=None):
    """"""
    oauth = current_app.extensions['oauthlib.client']
    for remote in oauth.remote_apps.values():
        token_delete(remote)
    db.session.commit()
1207832
public function logout()
    {

        // load the authentication manager and try to authenticate this request
        /** @var \AppserverIo\Psr\Auth\AuthenticationManagerInterface $authenticationManager */
        if ($authenticationManager = $this->getAuthenticationManager()) {
            // try to load the authentication managers default authenticator
            if (($authenticator = $authenticationManager->getAuthenticator()) == null) {
                throw new ServletException('Can\'t find default authenticator');
            }

            // logout the actual user
            $authenticator->logout($this);
        }
    }
203591
public void logout(final BooleanCallback callback) {
		GwtCommand command = new GwtCommand(logoutCommandName);
		GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SuccessCommandResponse>() {

			public void execute(SuccessCommandResponse response) {
				if (response.isSuccess()) {
					userToken = null;
					Authentication.this.userId = null;
					if (callback != null) {
						callback.execute(true);
					}
					GwtCommandDispatcher.getInstance().logout();
					manager.fireEvent(new LogoutSuccessEvent());
				} else {
					if (callback != null) {
						callback.execute(false);
					}
					manager.fireEvent(new LogoutFailureEvent());
				}
			}
		});
	}
990273
def logout(self):
        
        self.bbox_auth.set_access(BboxConstant.AUTHENTICATION_LEVEL_PUBLIC, BboxConstant.AUTHENTICATION_LEVEL_PUBLIC)
        self.bbox_url.set_api_name("logout", None)
        api = BboxApiCall(self.bbox_url, BboxConstant.HTTP_METHOD_POST, None,
                          self.bbox_auth)
        response = api.execute_api_request()
        if response.status_code == 200:
            self.bbox_auth.set_cookie_id(None)
        return not self.bbox_auth.is_authentified()
1153526
def default_no_login_handler
      ->(controller) do
        notice = Oath.config.sign_in_notice

        if notice.respond_to?(:call)
          controller.flash.notice = notice.call
        else
          warn "[DEPRECATION] `Oath.config.sign_in_notice` should be a lambda instead of a string"
          controller.flash.notice = notice
        end

        controller.redirect_to Oath.config.no_login_redirect
      end
    end
824695
def logout(self):
        
        url = self.address + "/logout"
        header = self.__check_authentication()
        response = requests.get(url, headers=header)
        if response.status_code != 200:
            raise ValueError("Code {}. {}".format(response.status_code, response.json().get("error")))
1112975
@Override
    public boolean logout(boolean force, String target, String message) {
        boolean result = super.logout(force, target, message);
        
        if (result) {
            brokerSession.disconnect();
        }
        
        return result;
    }
434192
def logout_method(user = current_user)
      http_method = security.logout_method
      http_method || if defined? ::Devise
                       scope = ::Devise::Mapping.find_scope! user
                       mapping = ::Devise.mappings[scope]
                       mapping.sign_out_via
                     end
    end
1263987
protected void validateLogoutRequest(final LogoutRequest logoutRequest, final SAML2MessageContext context,
                                               final SignatureTrustEngine engine) {

        validateSignatureIfItExists(logoutRequest.getSignature(), context, engine);

        // don't check because of CAS v5
        //validateIssueInstant(logoutRequest.getIssueInstant());

        validateIssuerIfItExists(logoutRequest.getIssuer(), context);

        NameID nameId = logoutRequest.getNameID();
        final EncryptedID encryptedID = logoutRequest.getEncryptedID();
        if (encryptedID != null) {
            nameId = decryptEncryptedId(encryptedID, decrypter);
        }

        String sessionIndex = null;
        final List<SessionIndex> sessionIndexes = logoutRequest.getSessionIndexes();
        if (sessionIndexes != null && !sessionIndexes.isEmpty()) {
            final SessionIndex sessionIndexObject = sessionIndexes.get(0);
            if (sessionIndexObject != null) {
                sessionIndex = sessionIndexObject.getSessionIndex();
            }
        }

        final String sloKey = computeSloKey(sessionIndex, nameId);
        if (sloKey != null) {
            final String bindingUri = context.getSAMLBindingContext().getBindingUri();
            if (SAMLConstants.SAML2_SOAP11_BINDING_URI.equals(bindingUri)) {
                logoutHandler.destroySessionBack(context.getWebContext(), sloKey);
            } else {
                logoutHandler.destroySessionFront(context.getWebContext(), sloKey);
            }
        }
    }
868925
def logout(self):
        """"""

        # Check if all transfers are complete before logout
        self.transfers_complete

        payload = {
            'apikey': self.config.get('apikey'),
            'logintoken': self.session.cookies.get('logintoken')
            }

        method, url = get_URL('logout')
        res = getattr(self.session, method)(url, params=payload)

        if res.status_code == 200:
            self.session.cookies['logintoken'] = None
            return True

        hellraiser(res)
927485
function logoutpage_hook() {
        global $USER, $redirect;

        // Only do this if the user is actually logged in via CAS
        if ($USER->auth === $this->authtype) {
            // Check if there is an alternative logout return url defined
            if (isset($this->config->logout_return_url) && !empty($this->config->logout_return_url)) {
                // Set redirect to alternative return url
                $redirect = $this->config->logout_return_url;
            }
        }
    }
1061233
function signOutUser(req, res, next) {
    debug('Signing out user');
    //make a best attempt effort at revoking the tokens
    var accessToken = req.session.auth ? req.session.auth.access_token: null;
    var refreshToken = req.session.auth ? req.session.auth.refresh_token: null;
    if (accessToken) {
        debug('Revoking access token');
        request.get({
            url: LOGOUT_URL,
            qs: {
                token: accessToken
            }
        }, function(err, response, body) {
            if (err) {
                debug('Error revoking access token', err.message);
            } else {
                debug('Revoked access token, %s', response.statusCode);
            }
        });
    }

    if (refreshToken) {

        request.get({
            url: LOGOUT_URL,
            qs: {
                token: refreshToken
            }
        }, function (err, response, body) {
            if (err) {
                debug('Error revoking refresh token', err.message);
            } else {
                debug('Revoked refresh token, %s', response.statusCode);
            }
        });
    }
    delete req.session.auth;
    res.sendStatus(200);
}
805922
public static function logout() {
    self::clearSession();
    $appUrlParts = parse_url(self::$config['app_url']);
    setcookie(
        'TILMELDAUTH',
        '',
        null,
        $appUrlParts['path'],
        $appUrlParts['host']
    );
  }