// Logout implements github.com/octavore/nagax/users.Logout
// note that there is no redirect
762196
func (m *Module) Logout(rw http.ResponseWriter, req *http.Request) {
	m.DestroySession(rw, req)
}
834088
func (c *Client) Close(ctx context.Context) error {
	return c.client.Logout(ctx)
}
680152
func (a *authenticator) logoutHandler(w http.ResponseWriter, req *http.Request) {
	decoder := json.NewDecoder(req.Body)
	var credentials credentials
	err := decoder.Decode(&credentials)
	if err != nil {
		errStr := fmt.Sprintf("500 internal server error: failed to decode json: %v", err)
		a.formatter.Text(w, http.StatusInternalServerError, errStr)
		return
	}

	a.userDb.SetLogoutTime(credentials.Username)
	a.log.Debugf("user %s was logged out", credentials.Username)
}
387770
func LogOnce(logfile string, msg string) {
	logr := OpenLogFile(logfile)
	defer logr.Close()
	LogIt(logr, msg)
}
646154
func (c *LogoutController) doLogout(ctx jsonapi.InternalServerError, redirect *string, referrer *string) (string, error) {
	if redirect == nil {
		if referrer == nil {
			log.Error(ctx, nil, "Failed to logout. Referer Header and redirect param are both empty.")
			return "", jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterErrorFromString("referrer", referrer,
				"referer Header and redirect param are both empty (at least one should be specified)"))
		}
		redirect = referrer
	}
	log.Debug(ctx, map[string]interface{}{
		"referrer": referrer,
		"redirect": *redirect,
	}, "Got Request to logout!")

	redirectURL, err := url.Parse(*redirect)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"redirect_url": *redirect,
			"err":          err,
		}, "Failed to logout. Unable to parse provided redirect url.")
		return "", jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError("redirect", *redirect))
	}
	log.Debug(ctx, map[string]interface{}{
		"redirect_url": *redirectURL,
		"err":          err,
	}, "parsed provided redirect url.")

	logoutRedirect, err := c.app.LogoutService().Logout(ctx, redirectURL.String())
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"redirect_url": redirectURL.String(),
			"err":          err,
		}, "Failed to logout.")
		return "", jsonapi.JSONErrorResponse(ctx, err)
	}

	return logoutRedirect, nil

}
1055690
func (c *Client) Logout(sessionID string) error {
	payload := &Request{
		Action: "logout",
		Param: &LogoutRequest{
			CustomerNumber:  c.customerNumber,
			APIKey:          c.apiKey,
			APISessionID:    sessionID,
			ClientRequestID: "",
		},
	}

	err := c.doRequest(payload, nil)
	if err != nil {
		return fmt.Errorf("logout error: %v", err)
	}

	return nil
}
626120
func (l *Logger) LogOp(op func() error, format string, a ...interface{}) error {
	l.opSequenceNum++
	l.PushPrefix("op(%x)", l.opSequenceNum)
	defer l.PopPrefix()

	l.logStart(format, a...)
	if err := op(); err != nil {
		l.logFail("%s: %v", fmt.Sprintf(format, a...), err)
		return err
	}
	l.logFinish(format, a...)
	return nil
}
175184
func (cli *HyperClient) HyperCmdLogout(args ...string) error {
	var parser = gflag.NewParser(nil, gflag.Default)
	parser.Usage = "logout [SERVER]\n\nLog out from a Docker registry, if no server is\nspecified \"" + registry.IndexServer + "\" is the default."
	args, err := parser.ParseArgs(args)
	if err != nil {
		if !strings.Contains(err.Error(), "Usage") {
			return err
		} else {
			return nil
		}
	}
	serverAddress := registry.IndexServer
	if len(args) > 0 {
		serverAddress = args[0]
	}

	if _, ok := cli.configFile.AuthConfigs[serverAddress]; !ok {
		fmt.Fprintf(cli.out, "Not logged in to %s\n", serverAddress)
	} else {
		fmt.Fprintf(cli.out, "Remove login credentials for %s\n", serverAddress)
		delete(cli.configFile.AuthConfigs, serverAddress)

		if err := cli.configFile.Save(); err != nil {
			return fmt.Errorf("Failed to save docker config: %v", err)
		}
	}
	return nil
}
1241198
func (wc *WebhookContext) Redirect(code int, s string) {
	wc.gin.Redirect(code, s)
}
726794
func LogSetOutputFunction(f LogOutputFunction, data interface{}) {
	ctx := &logOutputFunctionCtx{
		f: f,
		d: data,
	}

	C.LogSetOutputFunction(unsafe.Pointer(ctx))

	logOutputFunctionCache = f
	logOutputDataCache = data
}
912789
func (tc *TeleportClient) LogoutAll() error {
	err := tc.localAgent.DeleteKeys()
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
777397
func (tc *TeleportClient) Logout() error {
	err := tc.localAgent.DeleteKey()
	if err != nil {
		return trace.Wrap(err)
	}

	return nil
}
494086
func (c LoginClient) LoginOneshot(ctx context.Context, __arg LoginOneshotArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.login.loginOneshot", []interface{}{__arg}, nil)
	return
}
383326
func NewLogoutController(service *goa.Service, app application.Application) *LogoutController {
	return &LogoutController{Controller: service.NewController("LogoutController"), app: app}
}
1318432
func (s *Session) Logout(ctx context.Context) error {

	if !s.engine.session.HasToken() {
		return &apitypes.Error{
			Type: apitypes.UnauthorizedError,
			Err:  []string{"You must be logged in, to logout!"},
		}
	}

	tok := s.engine.session.Token()
	err := s.engine.client.Tokens.Delete(ctx, string(tok[:]))
	switch err := err.(type) {
	case *apitypes.Error:
		switch err.Type {
		case apitypes.InternalServerError:

			// On a 5XX response, we don't know for sure that the server
			// has successfully removed the auth token. Keep the copy in
			// the daemon, so the user may try again.
			return err
		case apitypes.NotFoundError, apitypes.BadRequestError, apitypes.UnauthorizedError:
			// A 4XX error indicates either the token isn't found, or we're
			// not allowed to remove it (or the server is a teapot).
			//
			// In any case, the daemon has gotten out of sync with the
			// server. Remove our local copy of the auth token.
			log.Printf("Got 4XX removing auth token. Treating as success")
			logoutErr := s.engine.session.Logout()
			if logoutErr != nil {
				return logoutErr
			}

			return nil
		}
	case nil:
		logoutErr := s.engine.session.Logout()
		if logoutErr != nil {
			return logoutErr
		}

		return nil
	default:
		return err
	}

	return nil
}
462004
func (m UsersAPIAuthMethod) LogoutURL(c context.Context, dest string) (string, error) {
	return user.LogoutURL(c, dest)
}
154792
func (s *Session) Logout() (err error) {

	//  _, err = s.Request("POST", LOGOUT, `{"token": "` + s.Token + `"}`)

	if s.Token == "" {
		return
	}

	data := struct {
		Token string `json:"token"`
	}{s.Token}

	_, err = s.RequestWithBucketID("POST", EndpointLogout, data, EndpointLogout)
	return
}