當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Session.Delete方法代碼示例

本文整理匯總了Golang中github.com/hoysoft/JexGO/sessions.Session.Delete方法的典型用法代碼示例。如果您正苦於以下問題:Golang Session.Delete方法的具體用法?Golang Session.Delete怎麽用?Golang Session.Delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/hoysoft/JexGO/sessions.Session的用法示例。


在下文中一共展示了Session.Delete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: LoginRequired

// LoginRequired verifies that the current user is authenticated. Any routes that
// require a login should have this handler placed in the flow. If the user is not
// authenticated, they will be redirected to /login with the "next" get parameter
// set to the attempted URL.
func LoginRequired(s sessions.Session, r render.Render, user IUser, req *http.Request) {
	if user.IsAuthenticated() == false {
		s.Delete(SessionKey)
		path := fmt.Sprintf("%s?%s=%s", RedirectUrl, RedirectParam, req.URL.Path)
		r.Redirect(path, 302)
	}
}
開發者ID:hoysoft,項目名稱:JexGO,代碼行數:11,代碼來源:sessionAuth.go

示例2: logoutHandle

func logoutHandle(f *Config, c martini.Context, s sessions.Session, w http.ResponseWriter, r *http.Request) {
	s.Delete(keyToken)
	path := fmt.Sprintf("%s?client_id=%s&client_secret=%s", f.Endpoint.LogoutURL, f.ClientID, f.ClientSecret)
	utils.HttpGetString(path)
	//	fmt.Println("oauth logout result:",string(str))
	f.ClientID = ""
	f.ClientSecret = ""
	c.Invoke(Logout)
	http.Redirect(w, r, "/", 302)
}
開發者ID:hoysoft,項目名稱:JexGO,代碼行數:10,代碼來源:oauth2.go

示例3: Logout

// Logout will clear out the session and call the Logout() user function.
func Logout(s sessions.Session, user IUser) {
	user.Logout()
	s.Delete(SessionKey)
}
開發者ID:hoysoft,項目名稱:JexGO,代碼行數:5,代碼來源:sessionAuth.go


注:本文中的github.com/hoysoft/JexGO/sessions.Session.Delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。