本文整理匯總了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)
}
}
示例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)
}
示例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)
}